Nagios 4 to 4 - How to configure email alerts
Вставка
- Опубліковано 22 чер 2023
- A video to show you how to configure email alerts in the Nagios monitoring system.
My Nagios playlist:
• Nagios
The French version / La version française:
• Nagios 4 de 4 - Config...
----------------
0:00 Intro
1:02 Configure Postfix server to send a email to a SMTP server. (relayhost)
3:17 The notification options we can configure for our monitored hosts.
8:43 The notification options we can configure for our monitored service.
13:33 Create new contacts and contact groups.
19:53 Create a time period.
22:19 Other configuration examples for hosts and services regarding notifications.
27:15 Restart Nagios service.
27:56 Take a look at the nagios console.
28:32 What to check if you don't receive an email alert.
32:41 Conclusion.
----------------
If you would like to pay me a coffee to support my work.
ko-fi.com/benlinux
--------------------
Here all commands I used in this video
sudo nano /etc/postfix/main.cf
An excerpt from my config file:
relayhost = 24.201.245.36:25
myorigin = testbenlinux55.com
sudo postfix check
sudo systemctl restart postfix
for the video explaining how to use Gmail as smarthost (relay host)
• Postfix - how to use g...
sudo nano /etc/nagios4/objects/linuxhosts.cfg
sudo nano /etc/nagios4/objects/templates.cfg
An excerpt from my config file:
define service {
name linux-services ;
use generic-service
check_period 24x7
max_check_attempts 2
check_interval 5
retry_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 120
notification_period 24x7
register 0
}
sudo nano /etc/nagios4/objects/linuxservices.cfg
sed -i s/original_word/new_word/ file.txt
sudo sed -i s/generic\-service/linux\-services/ /etc/nagios4/objects/serviceslinux.cfg
sudo nano /etc/nagios4/objects/contacts.cfg
An excerpt from my config file:
define contact {
contact_name nagiosadmin
use generic-contact
alias Nagios Admin
email exemple@gmail.com
}
define contact {
contact_name batman
use generic-contact
contactgroups sysadmins
alias batman
email courriel_de_batman@yopmail.com
host_notification_period night
service_notification_period night
host_notification_options d,u,r
service_notification_options w,u,c,r
}
define contact {
contact_name alfred
use generic-contact
contactgroups directeurs
alias Alfred Pennyworth
email courriel_de_alfred@yopmail.com
host_notification_period 24x7
service_notification_period 24x7
host_notification_options d,u,r
service_notification_options w,u,c,r
}
define contactgroup {
contactgroup_name sysadmins
alias Les sysadmins
}
define contactgroup {
contactgroup_name directeurs
alias Les directeurs
}
sudo nano /etc/nagios4/objects/timeperiods.cfg
Un extrait du fichier de config:
define timeperiod {
name night
timeperiod_name night
alias night Hours
sunday 00:00-06:00,20:00-00:00
monday 00:00-06:00,20:00-00:00
tuesday 00:00-06:00,20:00-00:00
wednesday 00:00-06:00,20:00-00:00
thursday 00:00-06:00,20:00-00:00
friday 00:00-06:00,20:00-00:00
saturday 00:00-06:00,20:00-00:00
}
sudo nano /etc/nagios4/objects/windowshosts.cfg
sudo nano /etc/nagios4/objects/windowsservices.cfg
sudo nagios4 -v /etc/nagios4/nagios.cfg
sudo systemctl restart nagios4
less /var/log/mail.log - Наука та технологія
Very good videos about Nagios, thank you so much! 😎
Do you plan other videos about Puppet or how to combine Nagios + Puppet?
Hello, can you send to us link how to install and configure Nagios Server from scratch? Of course, if You have that kind of link available.
Can I use/mention any domain name in the postfix configuration to send email alerts. Here in my office they already configured postfix for some other notifications. How do I overcome from it or use it?
Hi Karthickrajadurairaj,
You case base your nagios server postfix config from my config to send email to your other postfix server already configured. As relay_host, enter your other postfix server. Adjust your tcp port and ssl protocol used by this other postfix smtp server.
On your postfix server currently in place, maybe you will have to specify your nagios server ip address to allow email from it.
Maybe this following video can help you too to create your postfix config if you use smtp with ssl.
ua-cam.com/video/y99BoulATuI/v-deo.html
I hope this comment help you.