Page 2 of 2

Re: Nagios Output file

Posted: Tue Jun 24, 2014 9:13 am
by tmcdonald
tmcdonald wrote:[...] sreinhardt was talking about your notify-service-by-email and notify-host-by-email commands in commands.cfg [...]
Please post/attach your commands.cfg file.

Re: Nagios Output file

Posted: Tue Jun 24, 2014 10:38 am
by amitdaniel

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]
        }
Thank you for your help !!

Re: Nagios Output file

Posted: Tue Jun 24, 2014 1:02 pm
by tmcdonald
Did you try replacing $HOSTOUTPUT$ and $SERVICEOUTPUT$ with $LONGHOSTOUTPUT$ and $LONGSERVICEOUTPUT$ as sreinhardt suggested?
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.

Re: Nagios Output file

Posted: Tue Jun 24, 2014 11:49 pm
by amitdaniel
It's worked !!!!!

Thanks a lot guys !!! you are the best !

Re: Nagios Output file

Posted: Wed Jun 25, 2014 9:19 am
by tmcdonald
You are quite welcome. I'll be closing this thread now, but feel free to open another if you need anything in the future!