nagios notification sent as a .bin file
Re: nagios notification sent as a .bin file
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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: nagios notification sent as a .bin file
The odd character is called a SOH (Start Of Header) and has the hex code 0x01 (see picture). From Wikipedia:
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:
Then attach the output.txt file in a reply.
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.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.
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
Former Nagios employee
-
drewbpearson
- Posts: 13
- Joined: Wed Feb 05, 2014 5:50 pm
Re: nagios notification sent as a .bin file
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
~dp
Re: nagios notification sent as a .bin file
Great. Let us know!
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
-
drewbpearson
- Posts: 13
- Joined: Wed Feb 05, 2014 5:50 pm
Re: nagios notification sent as a .bin file
Here is the output!
WARNING: Only 244.37G (13%) free on \\stor2\nagios | 'nagios'=1697358597120B;1567800201216;1763775226368;0;1959750251520
WARNING: Only 244.37G (13%) free on \\stor2\nagios | 'nagios'=1697358597120B;1567800201216;1763775226368;0;1959750251520
-
drewbpearson
- Posts: 13
- Joined: Wed Feb 05, 2014 5:50 pm
Re: nagios notification sent as a .bin file
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
# '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
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.drewbpearson wrote:Here is the output!
WARNING: Only 244.37G (13%) free on \\stor2\nagios | 'nagios'=1697358597120B;1567800201216;1763775226368;0;1959750251520
Code: Select all
./check_disk_smb -H stor2 -s nagios -u nagios -p smbMonit0r -w 80 -c 90 > output.txt
Former Nagios employee
-
drewbpearson
- Posts: 13
- Joined: Wed Feb 05, 2014 5:50 pm
Re: nagios notification sent as a .bin file
Sure....Im hoping Im doing this correctly...pls let me know...Im not 100% sure how to make it display as you did....
dp
dp
- Attachments
-
output.txt- (121 Bytes) Downloaded 441 times
Re: nagios notification sent as a .bin file
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?
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?
Former Nagios employee
-
drewbpearson
- Posts: 13
- Joined: Wed Feb 05, 2014 5:50 pm
Re: nagios notification sent as a .bin file
Ok
I hope its all here...thx for the patience!
Host Definition:
Service Definition:
Host Definition to working check:
Service definition: working
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
Host Definition:
Code: Select all
# 'stor2' host definition
define host{
use 71-server
host_name stor2
alias stor2
address 192.168.71.21
}
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
}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
}# '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
- Attachments
-
outputFA.txt- (78 Bytes) Downloaded 439 times