parent
4dedf3dc30
commit
1c2c4e8377
4 changed files with 211 additions and 107 deletions
@ -1,3 +1,7 @@ |
||||
UserParameter=samba_dc.discovery[*],sudo /var/lib/zabbix/bin/disco_samba_dc_sudo --what='$1' |
||||
# Create a text item with key samba_dc.info[300] and a check interval of 300 |
||||
# Then use dependent item to get individual counters |
||||
UserParameter=samba_dc.info[*],sudo /var/lib/zabbix/bin/check_samba_dc_sudo --since=$1 |
||||
UserParameter=samba_dc.info[*],sudo /var/lib/zabbix/bin/check_samba_dc_sudo --since='$1' |
||||
# Create a text item with key samba_dc.ou[{#SAMBA_OU}], then use dependant items with JSONPath to get individual info |
||||
UserParameter=samba_dc.ou[*],sudo /var/lib/zabbix/bin/check_samba_dc_sudo --ou='$1' |
||||
|
||||
|
@ -0,0 +1,34 @@ |
||||
#!/usr/bin/perl -w |
||||
|
||||
use strict; |
||||
use warnings; |
||||
use JSON; |
||||
use Getopt::Long; |
||||
use File::Which; |
||||
|
||||
my $what = 'ou'; |
||||
my $pretty = 0; |
||||
my $json = []; |
||||
|
||||
my $samba_tool = which('samba-tool'); |
||||
|
||||
if (not defined $samba_tool){ |
||||
print $json; |
||||
exit 0; |
||||
} |
||||
|
||||
GetOptions( |
||||
'what=s' => \$what, |
||||
'pretty' => \$pretty |
||||
); |
||||
|
||||
if ($what eq 'ou'){ |
||||
foreach (qx($samba_tool ou list)){ |
||||
chomp; |
||||
push @{$json}, { |
||||
'{#SAMBA_OU}' => $_ |
||||
} |
||||
} |
||||
} |
||||
|
||||
print to_json($json, { pretty => $pretty }); |
Loading…
Reference in new issue