Page 3 of 5
Re: Convert attachement bin to txt
Posted: Mon Dec 02, 2013 1:58 pm
by vinothsethuram
Sent PM
Re: Convert attachement bin to txt
Posted: Mon Dec 02, 2013 1:59 pm
by tmcdonald
I need the exact file; you just copied+pasted the contents in your PM. I am trying to see if there are some weird line endings in your file that would cause /bin/mail to treat it as a .bin file. Can you also verify what version you are running?
Re: Convert attachement bin to txt
Posted: Mon Dec 02, 2013 2:15 pm
by vinothsethuram
Sent PM.
Version details
12.4 7/29/08
Re: Convert attachement bin to txt
Posted: Mon Dec 02, 2013 2:28 pm
by tmcdonald
Still not attaching the message, you're still copying and pasting the contents.
In the Nagios Support Forum, click "User Control Panel" in the upper-left-hand corner and go to the "Private messages" tab.
In the first box next to "Find a member" type in "tmcdonald"
In the text box labeled "Subject" type "Command definition"
In the biggest box type "Attaching config file"
Now you will need to save your "/usr/local/nagios/etc/commands.cfg" file (without quotes) to your desktop on Windows, using something like FTP or SCP. You will need to rename the file so it can properly be attached in your Nagios Support Forum private message to me. I want you to rename it to "commands.txt" instead of "commands.cfg". Sometimes it will try to save a "commands.cfg.txt" or "commands.txt.cfg" but it needs to be "commands.txt"
Back in the Nagios Support Forum page where you are sending the PM, click "Browse" down below next to where it says "Filename:" and select the "commands.txt" file. Click "Add the file" and finally hit "Submit".
Re: Convert attachement bin to txt
Posted: Mon Dec 02, 2013 2:39 pm
by vinothsethuram
Sorry for the inconvenience. Attached file in PM
Re: Convert attachement bin to txt
Posted: Mon Dec 02, 2013 2:43 pm
by tmcdonald
That was a .rtf file...
Are you actually moving the file off your server or are you copying and pasting the contents into Wordpad?
Re: Convert attachement bin to txt
Posted: Mon Dec 02, 2013 2:48 pm
by abrist
We need the file raw, copied from the server. Or, we may be able to fix the line endings from the cli. What distribution is running on your nagios server?
Re: Convert attachement bin to txt
Posted: Mon Dec 02, 2013 3:07 pm
by vinothsethuram
sent file in PM . Moved file from Linux to Windows using smbclient. renamed .cfg to txt
Re: Convert attachement bin to txt
Posted: Mon Dec 02, 2013 3:08 pm
by vinothsethuram
Using FEDORA distribution
Re: Convert attachement bin to txt
Posted: Mon Dec 02, 2013 3:16 pm
by tmcdonald
Exactly what I thought, windows line endings are sneaking in. I want you to edit your notify-service-by-email command to make the following change (adding sed 's/\r//' ):
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" | sed 's/\r//' | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
This should remove the windows-style newline (that's what was causing /bin/mail to attach it as a bin).