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

Convert attachement bin to txt

Post by vinothsethuram »

Hi,

I'm using $LONGSERVICEOUTPUT$ to get the complete details of the issue.Notification/Alert email is attaching the file in .bin type. Is there any possibility to get the attachment as .txt file or sending the issue details in email body itself without attachment

Regards
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Convert attachement bin to txt

Post by tmcdonald »

That's very odd. Is the .bin file human-readable text?
Former Nagios employee
vinothsethuram
Posts: 147
Joined: Thu Nov 07, 2013 11:44 am

Re: Convert attachement bin to txt

Post by vinothsethuram »

Yes, bin file is human readable in Windows but not in mac os
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Convert attachement bin to txt

Post by tmcdonald »

What attachment are you referring to? Can you PM me the file in question?
Former Nagios employee
vinothsethuram
Posts: 147
Joined: Thu Nov 07, 2013 11:44 am

Re: Convert attachement bin to txt

Post by vinothsethuram »

I'm using $LONGSERVICEOUTPUT$ which attaches the issue details. The attached file type in .bin.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Convert attachement bin to txt

Post by tmcdonald »

I'm not entirely clear on what's happening here since (as far as I know) Nagios should not be attaching anything in the first place. Can you post the full email notification command you have defined? And can you please PM a copy of the .bin attachment?
Former Nagios employee
vinothsethuram
Posts: 147
Joined: Thu Nov 07, 2013 11:44 am

Re: Convert attachement bin to txt

Post by vinothsethuram »

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$LONGSERVICEOUTPUT$\n " | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}


This is the command used to send email. If I use $SERVICEOUTPUT$ then there is no attachment in email ,but getting limited details. If I use $LONGSERVICEOUTPUT$ then email is attaching a bin file which has complete issue details

I tried to PM you, but couldn't attach the bin file
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Convert attachement bin to txt

Post by tmcdonald »

Can you just change the extension to .txt and PM it?
Former Nagios employee
vinothsethuram
Posts: 147
Joined: Thu Nov 07, 2013 11:44 am

Re: Convert attachement bin to txt

Post by vinothsethuram »

Sent PM
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Convert attachement bin to txt

Post by tmcdonald »

Seems to be perfectly readable. 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
Locked