Convert attachement bin to txt

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.
vinothsethuram
Posts: 147
Joined: Thu Nov 07, 2013 11:44 am

Re: Convert attachement bin to txt

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

Re: Convert attachement bin to txt

Post 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$
}
Former Nagios employee
vinothsethuram
Posts: 147
Joined: Thu Nov 07, 2013 11:44 am

Re: Convert attachement bin to txt

Post by vinothsethuram »

Adding $SERVICEOUTPUT$ will not change the file type .bin to .txt
vinothsethuram
Posts: 147
Joined: Thu Nov 07, 2013 11:44 am

Re: Convert attachement bin to txt

Post by vinothsethuram »

Added SERVICEOUTPUT. But still getting file as .bin
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Convert attachement bin to txt

Post by tmcdonald »

vinothsethuram wrote:Added SERVICEOUTPUT. But still getting file as .bin
Okay, and now can you PM that new file?
Former Nagios employee
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Convert attachement bin to txt

Post by tmcdonald »

Do me a favor and check the file type of the .bin file on the linux server:

Code: Select all

file ATT00002.bin
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
Former Nagios employee
vinothsethuram
Posts: 147
Joined: Thu Nov 07, 2013 11:44 am

Re: Convert attachement bin to txt

Post by vinothsethuram »

No such files(ATT....bin) in my Linux machine
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Convert attachement bin to txt

Post 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.
Former Nagios employee
vinothsethuram
Posts: 147
Joined: Thu Nov 07, 2013 11:44 am

Re: Convert attachement bin to txt

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

Re: Convert attachement bin to txt

Post 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?

Code: Select all

mail -V
Former Nagios employee
Locked