I checked the nagios.cfg config file and confirmed that it's set to "enable_notifications=1 "
The commands and services it seem to be working as shown in nagios.log, except the email Notification alerts.
See attached nagios.log
set up email alerts using mailx
Re: set up email alerts using mailx
- Attachments
-
- nagios.log
- (525.81 KiB) Downloaded 232 times
Re: set up email alerts using mailx
Both of the email commands that you have defined have errors in them and that is causing them to fail
Edit this command
Change the command line from
to
Edit this command
Change the command line from
to
Save it and restart nagios and test the sending of notifications.
Edit this command
Code: Select all
notify-service-by-email
Code: Select all
/usr/bin/printf "%b" "***** Nagios Monitor Core Alert*****\n\Notification Type: $NOTIFICATIONTYPE$\n\nHost: $HOSTNAME$\n\nState: $HOSTSTATE$\n\nAddress: $HOSTADDRESS$\n\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -S smtp=mailrelay.int.company.com -S from=alerts.gainspeed@company.com $CONTACTEMAIL$
Code: Select all
/usr/bin/printf "%b" "***** Nagios Monitor Core Alert*****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nHost: $HOSTNAME$\n\nState: $HOSTSTATE$\n\nAddress: $HOSTADDRESS$\n\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -S smtp=mailrelay.int.company.com -S from=alerts.gainspeed@company.com $CONTACTEMAIL$
Code: Select all
notify-host-by-email
Code: Select all
/usr/bin/printf "%b" "***** Nagios Monitor Core Alert *****\n\Notification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\n\nHost: $HOSTALIAS$\n\nAddress: $HOSTADDRESS$\n\State: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nnAdditional Info:\n\n$SERVICEOUTPUT$\" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -S smtp=mailrelay.int.company.com -S from=alerts.gainspeed@company.com $CONTACTEMAIL$
Code: Select all
/usr/bin/printf "%b" "***** Nagios Monitor Core Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\n\nHost: $HOSTALIAS$\n\nAddress: $HOSTADDRESS$\n\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -S smtp=mailrelay.int.company.com -S from=alerts.gainspeed@company.com $CONTACTEMAIL$
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: set up email alerts using mailx
If you look at the previous commands.cfg file in this thread, already contains the following commands . Please see attached commands.cfg file.
"notify-service-by-email"
"notify-host-by-email"
Could you explain to me more what do you mean by "Edit this command" and "Change the command line from"?
Thanks!
"notify-service-by-email"
"notify-host-by-email"
Could you explain to me more what do you mean by "Edit this command" and "Change the command line from"?
Thanks!
- Attachments
-
- commands.cfg
- (7.42 KiB) Downloaded 244 times
Re: set up email alerts using mailx
Your commands that send the emails have errors in then so they need to be edited.
What I mean by Change it from , to us to edit the command line and change it from the wrong command to the corrected.
I edited the commands for you so if you replace your commands.cfg file with the one that is attached to the post, it should fix the errors.
What I mean by Change it from , to us to edit the command line and change it from the wrong command to the corrected.
I edited the commands for you so if you replace your commands.cfg file with the one that is attached to the post, it should fix the errors.
- Attachments
-
- commands.cfg
- (7.16 KiB) Downloaded 236 times
Be sure to check out our Knowledgebase for helpful articles and solutions!