Page 2 of 5
Re: Convert attachement bin to txt
Posted: Wed Nov 27, 2013 3:24 pm
by vinothsethuram
$SERVICEOUTPUT$ will give the few details in email. But $LONGSERVICEOUTPUT$ is responsible for attaching .bin file. I need to convert it to .txt
Re: Convert attachement bin to txt
Posted: Wed Nov 27, 2013 3:29 pm
by tmcdonald
vinothsethuram wrote:$SERVICEOUTPUT$ will give the few details in email. But $LONGSERVICEOUTPUT$ is responsible for attaching .bin file. I need to convert it to .txt
Yep. Try changing your command to show $SERVICEOUTPUT$
right before the $LONGSERVICEOUTPUT$:
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$\n$LONGSERVICEOUTPUT$\n " | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
Re: Convert attachement bin to txt
Posted: Wed Nov 27, 2013 3:38 pm
by vinothsethuram
Adding $SERVICEOUTPUT$ will not change the file type .bin to .txt
Re: Convert attachement bin to txt
Posted: Wed Nov 27, 2013 3:44 pm
by vinothsethuram
Added SERVICEOUTPUT. But still getting file as .bin
Re: Convert attachement bin to txt
Posted: Wed Nov 27, 2013 3:53 pm
by tmcdonald
vinothsethuram wrote:Added SERVICEOUTPUT. But still getting file as .bin
Okay, and now can you PM that new file?
Re: Convert attachement bin to txt
Posted: Wed Nov 27, 2013 4:04 pm
by tmcdonald
Do me a favor and check the file type of the .bin file on the linux server:
I think line endings might be screwing up the mailx client:
http://superuser.com/questions/309530/p ... a-bin-file
http://whynotwiki.com/Line_endings
Re: Convert attachement bin to txt
Posted: Wed Nov 27, 2013 4:42 pm
by vinothsethuram
No such files(ATT....bin) in my Linux machine
Re: Convert attachement bin to txt
Posted: Mon Dec 02, 2013 9:54 am
by tmcdonald
I guess I worded that poorly:
Transfer the file to your linux machine and then run the command to check the file type.
Re: Convert attachement bin to txt
Posted: Mon Dec 02, 2013 11:44 am
by vinothsethuram
I transferred the file using smbclient and checked the file mime type.
mime type:- text/plain
mime encoding :- us-ascii
ASCII text, with CRLF, LF line terminators
But email is having attachment as .bin. confused...
Thanks
Vinoth
Re: Convert attachement bin to txt
Posted: Mon Dec 02, 2013 1:42 pm
by tmcdonald
Can you PM me an exact copy of your /usr/local/nagios/etc/commands.cfg file?
In addition what is your mail version?