monitoring configuration-configuration of notifications
Notify by email when there is a problem with the service
1, configure the command to send mail
Edit/usr/local/nagios/etc/objects/commands.cfg
The default output macros $hostoutput$ and $serviceoutput$ only output the first line of information, and we use $longhostoutput$ and $longserviceoutput$ to output the complete information.
in order to accept the format of a good, and Chinese text-free hypertext message, you can set the SendEmail "-o message-content-type=html-omessage-charset=utf8" option.
# ' notify-host-by-email ' command definition
Define Command{
Command_name Notify-host-by-email
command_line/usr/bin/printf "%b" "*****nagios *****\n\nnotification Type: $NOTIFICATIONTYPE $\nhost: $HOSTNAME $\ Nstate: $HOSTSTATE $\naddress: $HOSTADDRESS $\ninfo: $HOSTOUTPUT $\n$longhostoutput$\n\ndate/time: $LONGDATETIME $\n "| /usr/bin/mutt-s "* * $NOTIFICATIONTYPE $ Hostalert: $HOSTNAME $ is $HOSTSTATE $ * *" $CONTACTEMAIL $
}
# ' Notify-service-by-email ' commanddefinition
Define Command{
Command_name Notify-service-by-email
command_line/usr/bin/printf "%b" "*****nagios *****\n\nnotification Type: $NOTIFICATIONTYPE $\n\nservice:$ Servicedesc$\nhost: $HOSTALIAS $\naddress: $HOSTADDRESS $\nstate: $SERVICESTATE $\n\ndate/time: $LONGDATETIME $\n\ nadditionalinfo:\n\n$serviceoutput$\n$longserviceoutput$ "| /usr/bin/mutt-s "* * $NOTIFICATIONTYPE $ Service Alert: $HOSTALIAS $/$SERVICEDESC $ is $SERVICESTATE $**" $CONTACTEMAIL $
}
...
Nagiosian Monitoring Page Garbled resolution: Modify the Monitor host/usr/local/apache2/conf last line increase
Adddefaultcharset Utf-8
Modify/usr/local/nagios/etc/cgi.cfg
Escape_html_tags=0
Restart Apache using the following command
#/usr/local/apache2/bin/apachectlrestart