Nagios Output file

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios Output file

Post 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.
Former Nagios employee
amitdaniel
Posts: 25
Joined: Mon Jul 01, 2013 9:17 am

Re: Nagios Output file

Post 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 !!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios Output file

Post 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.
Former Nagios employee
amitdaniel
Posts: 25
Joined: Mon Jul 01, 2013 9:17 am

Re: Nagios Output file

Post by amitdaniel »

It's worked !!!!!

Thanks a lot guys !!! you are the best !
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios Output file

Post 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!
Former Nagios employee
Locked