We’re in the midst of upgrading our Windows Server 2003 servers to 2008R2. Three down, one to go. We noticed that the 2008R2 servers threw errors back to Nagios that the 2003 servers never exhibited. Lots of:
CRITICAL SMB anon access: Domain=[CAE] OS=[Windows Server 2008 R2 Standard 7600] Server=[Windows Server 2008 R2 Standard 6.1]
errors. My obsessive-compulsive side finally got the best of me, and tonight I started digging into why these errors occur. The short form is that Server 2003 never cared if we had the wrong Netbios name when we queried it. Server 2008R2 (and possibly 2008 original) care greatly. To wit, on a Server 2003 target, these both work fine:
# /usr/lib/nagios/plugins/check_smb -H 149.149.254.IP1 OK Domain=[CAE] OS=[Windows Server 2003 3790 Service Pack 2] Server=[Windows Server 2003 5.2] # /usr/lib/nagios/plugins/check_smb -H server2003.cae.tntech.edu OK Domain=[CAE] OS=[Windows Server 2003 3790 Service Pack 2] Server=[Windows Server 2003 5.2]
but on a Server 2008R2 target, only the last one works:
# /usr/lib/nagios/plugins/check_smb -H 149.149.254.IP2 CRITICAL SMB anon access: Domain=[CAE] OS=[Windows Server 2008 R2 Standard 7600] Server=[Windows Server 2008 R2 Standard 6.1] # /usr/lib/nagios/plugins/check_smb -H server2008r2.cae.tntech.edu OK Domain=[CAE] OS=[Windows Server 2008 R2 Standard 7600] Server=[Windows Server 2008 R2 Standard 6.1]
check_smb takes its -H argument and passes it as the -L argument to smbclient (the Netbios name of the server you want to list shares on). So one quick change on my Nagios check_smb command from:
define command { command_name check_smb command_line /usr/lib/nagios/plugins/check_smb -H $HOSTADDRESS$ }
to
define command { command_name check_smb command_line /usr/lib/nagios/plugins/check_smb -H $HOSTNAME$ }
and everybody’s happy. I could have also changed check_smb to take both a $HOSTNAME$ and a $HOSTADDRESS$ argument to avoid problems if there’s a DNS failure, but this was the least invasive fix.
thank you, it works fine with samba servers, too, on ububtu 10.10!