Re: Nagios Output file
Posted: Tue Jun 24, 2014 9:13 am
Please post/attach your commands.cfg file.tmcdonald wrote:[...] sreinhardt was talking about your notify-service-by-email and notify-host-by-email commands in commands.cfg [...]
Support for Nagios products and services
https://support.nagios.com/forum/
Please post/attach your commands.cfg file.tmcdonald wrote:[...] sreinhardt was talking about your notify-service-by-email and notify-host-by-email commands in commands.cfg [...]
Code: Select all
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\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$ [email protected]
}
# 'notify-service-by-email' command definitioni
#$CONTACTEMAIL$
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$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ [email protected]
}
sreinhardt wrote:As slansing mentioned, this isn't totally a size issue, but more of after a newline in standard output, the rest is only returned if you request longoutput to be appended to your commands. I would suggest by adding $LONGSERVICEOUTPUT$ to your notification command so that the data after is correctly added to your emails.