check_disk_smb with nagios 3.0.6 install

I’m just migrating from 2.9 to 3.0.6.

Both of my instances run on Mac OS X and have been installed via MacPorts.

Both are functional, sending me warnings as expected/configured, and working almost perfectly.

I rely on the check_disk_smb plugin to give me information about available space on a variety of SMB shares in my architecture.

The plugin works just fine in 2.9 installation.

The new 3.0.6 installation is behaving quite oddly though.

On the 3.0.6 nagios machine, when executed from the command line in /opt/local/libexec/nagios with the same construct as my commands.cfg definition I am able to obtain the expected results. Here’s how the command is defined in my commands.cfg file:

define command{ command_name check_smb command_line $USER1$/check_disk_smb -H $HOSTNAME$ -s $ARG1$ -W mydomain -u myuser -p mypasswd }

Here’s the syntax & result for the CLI attempt from within /opt/local/libexec/nagios/:

Domain=[mydomain] OS=[Windows Server 2003 3790 Service Pack 2] Server=[Windows Server 2003 5.2] Disk ok - 1.71G (85%) free on \\vrdc01.mydomain.local\Users

However when the plugin is called by nagios, I get a (null) result. I see nothing in the nagios.log file when I re-schedule and execute the command.

I’ve tried restarting the smb service on a couple of the target servers, just to make sure I’m not crazy.

I even tried the ostensibly updated check_disk_smb_spaces plugin from Nagios Exchange just to see if it might make a difference.

Thus far, I’m out of ideas.

Anyone have any thoughts about how to figure out the problem?

Thanks.

PJT

Are you specifying good $ARG1$ from the service definition? And that the $HOSTNAME$ defined in Nagios is typed exactly like the real host?

Ok, here is a sample definition of the service from services.cfg:

define service{
        use                     generic-service
        host_name               fileserve
        service_description     SMB Share FILESERVE - Agency_Drop
        check_command           check_smb!Agency_Drop
        max_check_attempts      5
        normal_check_interval   30
        retry_check_interval    15
        check_period            24x7
        notification_interval   60
        notification_period     24x7
        notification_options    w,c,r
        contact_groups          it-staff
        servicegroups           smb
        }

The share name is exactly ‘Agency_Drop’.

And from our hosts.cfg file, the definition of the hostname/server is as follows:

define host{
     use                        generic-host     ; Name of host template to use
     host_name                  fileserve
     alias                      Apple Xserve (2xXeon) - fileserve
     address                    192.168.1.9
     max_check_attempts         10     ;number of attempts for a bad return
     notification_interval      1     ;how long to wait in minutes to notify someone
     contact_groups             it-staff
     }

So, in essence, nagios should be running the smb_disk check against an ip and not even have to fuss with name resolution.

I suppose I could quote the $ARG1$ argument.

Not really, 'cause check_disk_smb --help gives this output:
-H, --hostname=HOST
NetBIOS name of the server
-s, --share=STRING
Share name to be tested
-W, --workgroup=STRING
Workgroup or Domain used (Defaults to “WORKGROUP”)
-a, --address=IP
IP-address of HOST (only necessary if HOST is in another network)

That means, if -H switch is used then it has to be real hostname, like the one you’ve provided from the command line:

./check_disk_smb -H vrdc01.mydomain.local -s Users -W mydomain -u myuser -p mypasswd

But if you let nagios fulfill the $HOSTNAME$ variable it will put the hostname you’ve specified in the host definition, which in this case would be fileserve, and it’s command, according to this:

$USER1$/check_disk_smb -H $HOSTNAME$ -s $ARG1$ -W mydomain -u myuser -p mypasswd

would look like this:

./check_disk_smb -H fileserve -s Agency_Drop -W mydomain -u myuser -p mypasswd

So I would rather put command definition this way:

$USER1$/check_disk_smb -a $HOSTADDRESS$ -s $ARG1$ -W mydomain -u myuser -p mypasswd

$ARG1$ looks ok.

Which version of the plugin are you using b/c I do NOT see that -a option in my help statement?

root@nagios3 -> /opt/local/libexec/nagios # ./check_disk_smb -h
check_disk_smb v1247 (nagios-plugins 1.4.13)
The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute
copies of the plugins under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
Copyright (c) 2000 Michael Anthon/Karl DeBisschop

Perl Check SMB Disk plugin for Nagios

Usage: check_disk_smb -H <host> -s <share> -u <user> -p <password> 
      -w <warn> -c <crit> -W <workgroup>] -P <port>]

-H, --hostname=HOST
   NetBIOS name of the server
-s, --share=STRING
   Share name to be tested
-W, --workgroup=STRING
   Workgroup or Domain used (Defaults to "WORKGROUP")
-u, --user=STRING
   Username to log in to server. (Defaults to "guest")
-p, --password=STRING
   Password to log in to server. (Defaults to an empty password)
-w, --warning=INTEGER or INTEGER[kMG]
   Percent of used space at which a warning will be generated (Default: 85%)
      
-c, --critical=INTEGER or INTEGER[kMG]
   Percent of used space at which a critical will be generated (Defaults: 95%)
-P, --port=INTEGER
   Port to be used to connect to. Some Windows boxes use 139, others 445 (Defaults to smbclient default)
   
   If thresholds are followed by either a k, M, or G then check to see if that
   much disk space is available (kilobytes, Megabytes, Gigabytes)

   Warning percentage should be less than critical
   Warning (remaining) disk space should be greater than critical.

Send email to [email protected] if you have questions
regarding use of this software. To submit patches or suggest improvements,
send email to [email protected].
Please include version information with all correspondence (when possible,
use output from the --version option of the plugin itself).

check_disk_smb v1247 (nagios-plugins 1.4.12)

Heh, can’t believe it. It seems there weren’t any changes in the check_disk_smb plugin itself, cause it’s the same version in 1.4.12. and 1.4.13. Have you tried to run it with the -a switch, maybe it will work as a hidden feature. If it doesn’t work try to download 1.4.12 plugin package:
repo.or.cz/w/nagiosplugins.git

ladminx@nagios3 -> /opt/local/libexec/nagios % ./check_disk_smb -a 192.168.1.8
Unknown option: a
Share volume not specified
ladminx@nagios3 -> /opt/local/libexec/nagios % ./check_disk_smb -A 192.168.1.8
Unknown option: A
Share volume not specified

Weird huh?

So thing is about installing the older plugin version, I installed via MacPorts. To uninstall the 1.4.13_1 I’d have to rip out nagios too. Furthermore, I’m not thrilled about having to build the 1.4.12 plugins INTO MacPorts.

Currently I’m looking at something from NagiosExchange called check_smb_shares.pl. It’s needs a different form of libsmbclient on Mac OS X but I’m figuring it out now.