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 »

Thanks a ton. It fixed now. What was the issue? Could you please explain briefly ?



And more over , please look at this command which is used to notify host and let me know if any changes required.

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: $LONGHOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
        }
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Convert attachement bin to txt

Post by tmcdonald »

Before we get into that, what plugin are you using? Is this a standard Nagios plugin? Is it a third-party? Did you develop it yourself? Is there a link to it?

The problem is that the /bin/mail program sees any input containing windows line-endings as a .bin file and assumes it will have binary data, so it makes it an attachment. In this case, I simply had the "sed" program remove those line-endings before sendig it off to /bin/mail.

Now this is definitely a bit of a hack since Nagios should not be the culprit here, which is why I am asking about the plugin. There might be a better way, such as fixing the plugin itself.
Former Nagios employee
vinothsethuram
Posts: 147
Joined: Thu Nov 07, 2013 11:44 am

Re: Convert attachement bin to txt

Post by vinothsethuram »

And one more help.

Email doesn't have complete string.. Nagios web UI is showing the complete html string but email is having halt content, remaining half contents are missing in email. is there any size limit for alert emails.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Convert attachement bin to txt

Post by tmcdonald »

You haven't told us what plugin you are using.
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 Nagios core 4.0.1. No external plugins.

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

Re: Convert attachement bin to txt

Post by tmcdonald »

You have to be using a plugin because there is literally no other way that Nagios can function.

I would assume you're using check_http in this case?
Former Nagios employee
vinothsethuram
Posts: 147
Joined: Thu Nov 07, 2013 11:44 am

Re: Convert attachement bin to txt

Post by vinothsethuram »

Yes, I'm using check_http
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Convert attachement bin to txt

Post by tmcdonald »

In this case I think the web page you are checking is returning the windows-style line endings. Remove the sed portion from the notify-service-by-email command for now and we'll see what we can come up with for a solution.

Is this happening for all HTTP checks or just a certain few?
Former Nagios employee
vinothsethuram
Posts: 147
Joined: Thu Nov 07, 2013 11:44 am

Re: Convert attachement bin to txt

Post by vinothsethuram »

Behaviour is different. Few mails having complete response, few having partial and few emails are emplty...
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Convert attachement bin to txt

Post by tmcdonald »

vinothsethuram wrote:Behaviour is different. Few mails having complete response, few having partial and few emails are emplty...
Did you change the notify-service-by-email command back to what it was before I had you add in the sed?
Former Nagios employee
Locked