Page 1 of 5
Convert attachement bin to txt
Posted: Mon Nov 25, 2013 1:09 pm
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
Re: Convert attachement bin to txt
Posted: Mon Nov 25, 2013 6:09 pm
by tmcdonald
That's very odd. Is the .bin file human-readable text?
Re: Convert attachement bin to txt
Posted: Tue Nov 26, 2013 2:15 pm
by vinothsethuram
Yes, bin file is human readable in Windows but not in mac os
Re: Convert attachement bin to txt
Posted: Tue Nov 26, 2013 2:18 pm
by tmcdonald
What attachment are you referring to? Can you PM me the file in question?
Re: Convert attachement bin to txt
Posted: Tue Nov 26, 2013 3:17 pm
by vinothsethuram
I'm using $LONGSERVICEOUTPUT$ which attaches the issue details. The attached file type in .bin.
Re: Convert attachement bin to txt
Posted: Tue Nov 26, 2013 3:27 pm
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?
Re: Convert attachement bin to txt
Posted: Wed Nov 27, 2013 1:41 pm
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
Re: Convert attachement bin to txt
Posted: Wed Nov 27, 2013 1:47 pm
by tmcdonald
Can you just change the extension to .txt and PM it?
Re: Convert attachement bin to txt
Posted: Wed Nov 27, 2013 3:01 pm
by vinothsethuram
Sent PM
Re: Convert attachement bin to txt
Posted: Wed Nov 27, 2013 3:11 pm
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$
}