Hi,
I would like add all of the information from the Nagios alert email to the end of the message in .csv format eg:
***** Nagios *****
Notification Type: PROBLEM
Service: Port 13 B/W Usage - Sage
Host: Conquest PowerConnect 2
Address: 172.x.x.x
State: WARNING
Date/Time: Mon Feb 20 08:54:14 GMT 2012
Additional Info:
Traffic WARNING - Avg. In = 614.2 KB/s, Avg. Out = 5.0 MB/s
PROBLEM,Port 13 B/W Usage - Sage,Conquest PowerConnect 2,172.x.x.x,WARNING,Mon Feb 20 08:54:14 GMT 2012
Is this possible?
Thanks
Command.cfg
Re: Command.cfg
You will want to modify your notification commands to include the desired information. They are probably named notify-host-by-email and notify-service-by-email. By default they look like this:
Notice that the definition includes the body of the email with some placeholders like $SERVICEDESC$ (also, in case you're not a programmer you should know that '\n' means a new line). These are automatically replaced by appropriate values by nagios. You can find the full list here. Simply edit the command to include what you want.
Code: Select all
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\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}