parent
33c78c9eb5
commit
5214d25e14
2 changed files with 31 additions and 0 deletions
@ -0,0 +1,2 @@ |
|||||||
|
# Check if nmbd is available and working |
||||||
|
UserParameter=samba.nmbd.status,/var/lib/zabbix/bin/check_nmblookup --server=127.0.0.1 --host=linuxsrv |
@ -0,0 +1,29 @@ |
|||||||
|
#!/usr/bin/perl -w |
||||||
|
|
||||||
|
use strict; |
||||||
|
use Getopt::Long; |
||||||
|
|
||||||
|
my %opts; |
||||||
|
$opts{server} = '127.0.0.1'; |
||||||
|
|
||||||
|
GetOptions( |
||||||
|
"server=s" => \$opts{server}, |
||||||
|
"host=s" => \$opts{host} |
||||||
|
); |
||||||
|
|
||||||
|
if (!$opts{host}){ |
||||||
|
print "You have to specify a hostname to lookup with the --host argument\n"; |
||||||
|
exit(1); |
||||||
|
} |
||||||
|
|
||||||
|
my $res = qx(/usr/bin/nmblookup -U $opts{server} $opts{host}); |
||||||
|
my @lines = split /\n/, $res; |
||||||
|
# Look at the last line |
||||||
|
my $resp = $lines[$#lines]; |
||||||
|
my $status = 0; |
||||||
|
|
||||||
|
if ($resp =~ m/^\d+\.\d+\.\d+\.\d+ $opts{host}/){ |
||||||
|
$status = 1; |
||||||
|
} |
||||||
|
|
||||||
|
print $status . "\n"; |
Loading…
Reference in new issue