check_smb_shares.pl won't work for me, anyone know how

I’ve downloaded the script from nagiosexchange and it refuses to give me an output error code (I’m wrong, there is errorcode output, just “no output” in the status information in nagios). It does however report correctly the FILECOUNT, FOLDERSIZE, and WRITEABLE options for the script, if ran by command line.

nagiosexchange.org/Windows.4 … nagext_pi1[p_view]=38

Does anyone else have this same trouble or can you get it to work? I have no clue on perl scripting.

./check_smb_shares.pl -S FILECOUNT -U nagios -P somepassword -D somedomain -H somehost -A /Vol1/DPS-ADS/Bus_Sys/ASC -w 0 -c 5
4 Items (2 Directorys, 2 Files, 0 Links, 115 ) in smb://somehost//Vol1/DPS-ADS/Bus_Sys/ASC | ‘FILECOUNT’=4;0;5

Edited ]

There must be at least one person using this check successfully, please share. Or perhaps, could someone else try it out, and see if they can get it to cough up some error codes?

i have a check_disk_smb in the libexec directory but never used it… just gave it a quick look but i get an error:

Result from smbclient not suitable

I should start mnonitoring the smb shares though… :shock:

I think i’ll give it a better look, sorry but this will be on monday… almost out of here… :slight_smile:

Luca

When i first tried this script, it worked in the command line as user nagios, but when setup in nagios, I got “no output” for the Status Information. I modified the script so it would print the errorcode and by the command line, it would print 0, 1 or 2 depending on my warning/critical settings, but still, in nagios, I got “no output”.

As a last straw, I recompiled nagios and now I"m getting “(Return code of 13 is out of bounds)” which, is some permission error I think. I’ve checked permissions, and I know it’s actually executing the script, because if I chown to root.root the file, then I get “plugin not found”.

So, since the plugin is executing, it’s something in the script that differ’s from the command line.

Anyone else try to use this plugin please, at least give it a quick try, it’s easy to setup.
checkcommands.cfg
define command{
command_name check_smb_shares
command_line /usr/local/nagios/libexec/check_smb_shares.pl -H $HOSTADDRESS$ -S $ARG1$ -U $ARG2$ -P $ARG3$ -D $ARG4$ -A $ARG5$ -w $ARG6$ -c $ARG7$
services.cfg
define service{
use generic-service ; Name of service template to use
host_name somehost
service_description filecount
check_command check_smb_shares!FILECOUNT!nagios!guest!somedomain!/Vol1/DPS-ADS/Bus_Sys/ASC!5!6
contact_groups PP-Hosts
process_perf_data 0 ; Process performance data
}

I don’t like how I got it working, but this is the best I can come up with. It must have something to do with env.

define service{
use generic-service ; Name of service template to use
host_name somehost
service_description filecount
check_command check_smb_shares
contact_groups PP-Hosts
process_perf_data 0 ; Process performance data
}

checkcommands.cfg

define command{
command_name check_smb_shares
command_line sudo /usr/local/nagios/libexec/check_smb_shares.pl -H somehost -S FILECOUNT -U nagios -P guest -A /Vol1/DPS-ADS/Bus_Sys/ASC -w 5 -c 6 -D somedomain

visudo
nagios ALL = NOPASSWD: /usr/local/nagios/libexec/check_smb_shares.pl -H somehost -S FILECOUNT -U nagios -P guest -A /Vol1/DPS-ADS/Bus_Sys/ASC -w 5 -c 6 -D somedomain

so you need su rights for every checkcommand (redefined for every share)? :x

Luca

I don’t really think it needs superuser rights, but my thinking is that it’s an environment issue. But yea, every command has to be defined. I’m not using this check alot at this point, and won’t until I resolve the env issue.

Have you tried to download the script and try it out?

no… have to test an upgrade for our antivirus-antispam system so nagios has fallen a bit behind in the priority list… sorry :frowning:

Luca