Page 2 of 3
Re: nagios notification sent as a .bin file
Posted: Thu Feb 06, 2014 1:04 pm
by abrist
The character is an "SOH" (Start of heading). It is a transmission control character, and will cause sendmail to treat the body as an attachment. It is found right before the ip address in the email body. c You can see it for yourself by opening the file in notepad++ and going to view --> show symbol --> show all characters.
Re: nagios notification sent as a .bin file
Posted: Thu Feb 06, 2014 1:14 pm
by tmcdonald
The odd character is called a SOH (Start Of Header) and has the hex code 0x01 (see picture). From Wikipedia:
Wikipedia wrote:
The start of heading (SOH) character was to mark a non-data section of a data stream—the part of a stream containing addresses and other housekeeping data.
Basically it's a control code that was used back in the days old dumb terminals. Another common one is BEL that would cause the terminal to beep when encountered.
Since it is not intended to be printed to a screen we call this a non-printable ASCII code. sendmail sees these as binary data so any text stream that includes one will be considered binary as well. Since binary data (like MP3s or GIFs) can't be readily printed as text they are attached to an email instead of being in the email body itself. Interestingly enough, the IP shows as "92.168.71.21" in your attachment which almost certainly should be "192.168.71.21". Since the hex code for SOH is 0x01, somehow we are getting hex instead of regular decimal. The problem now is to find out why your plugin is outputting this SOH character for one check only. Please run the following:
Code: Select all
./check_disk_smb -H stor2 -s nagios -u nagios -p smbMonit0r -w 80 -c 90 > output.txt
Then attach the output.txt file in a reply.
Re: nagios notification sent as a .bin file
Posted: Thu Feb 06, 2014 2:29 pm
by drewbpearson
First of all, thank you! I just realized that it went to page 2 so Im sorry for not getting back to your response earlier. I will look at this in depth and let you know if I get it fixed!! You guys are awesome and appreciated!
~dp
Re: nagios notification sent as a .bin file
Posted: Thu Feb 06, 2014 2:32 pm
by abrist
Great. Let us know!
Re: nagios notification sent as a .bin file
Posted: Thu Feb 06, 2014 2:39 pm
by drewbpearson
Here is the output!
WARNING: Only 244.37G (13%) free on \\stor2\nagios | 'nagios'=1697358597120B;1567800201216;1763775226368;0;1959750251520
Re: nagios notification sent as a .bin file
Posted: Thu Feb 06, 2014 2:53 pm
by drewbpearson
The following are my notification commands, not sure if they help....
# 'notify-host-by-email' command definition
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: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
# 'notify-service-by-email' command definition
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" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
~dp
Re: nagios notification sent as a .bin file
Posted: Thu Feb 06, 2014 3:24 pm
by tmcdonald
drewbpearson wrote:Here is the output!
WARNING: Only 244.37G (13%) free on \\stor2\nagios | 'nagios'=1697358597120B;1567800201216;1763775226368;0;1959750251520
Could you run the command as I had posted it? We need the output saved to a file so we can inspect the file as opposed to just the text.
Code: Select all
./check_disk_smb -H stor2 -s nagios -u nagios -p smbMonit0r -w 80 -c 90 > output.txt
Re: nagios notification sent as a .bin file
Posted: Thu Feb 06, 2014 4:20 pm
by drewbpearson
Sure....Im hoping Im doing this correctly...pls let me know...Im not 100% sure how to make it display as you did....
dp
Re: nagios notification sent as a .bin file
Posted: Thu Feb 06, 2014 4:33 pm
by tmcdonald
On the command line you are showing "\\stor2\nagios" but in the email it is "92.168.71.21". Very odd.
Can you show us the output of a working command? Save to file like before and post it. Also can you share the config files for these two checks?
Re: nagios notification sent as a .bin file
Posted: Thu Feb 06, 2014 4:50 pm
by drewbpearson
Ok

I hope its all here...thx for the patience!
Host Definition:
Code: Select all
# 'stor2' host definition
define host{
use 71-server
host_name stor2
alias stor2
address 192.168.71.21
}
Service Definition:
Code: Select all
define service{
use generic-service
host_name stor2
service_description check_disk_smb
check_period workhours
max_check_attempts 3
normal_check_interval 10
retry_check_interval 2
contact_groups admins
notification_interval 120
notification_period workhours
check_command check_disk_smb!nagios!nagios!smbMonit0r!80!90
}
Host Definition to working check:
Code: Select all
# 'svr001' host definition
define host{
use 71-server
host_name svr001
alias svr001
address 192.168.71.22
}
Service definition: working
Code: Select all
define service{
use generic-service
host_name svr001
service_description check_file_age
is_volatile 0
check_period workhours
max_check_attempts 3
normal_check_interval 10
retry_check_interval 2
contact_groups admins
notification_interval 120
notification_period workhours
check_command check_file_age!18000!21600!/data/rsnapshot-svr001/hourly.0
}
PS: more info....
# 'check_disk_smb' command definition
define command{
command_name check_disk_smb
command_line $USER1$/check_disk_smb -H $HOSTADDRESS$ -s $ARG1$ -u $ARG2$ -p $ARG3$ -w $ARG4$ -c $ARG5$
}
~dp