diff --git a/zabbix_conf/nut_ups.conf b/zabbix_conf/nut_ups.conf index 91b7f54..5f5c1c4 100644 --- a/zabbix_conf/nut_ups.conf +++ b/zabbix_conf/nut_ups.conf @@ -30,3 +30,9 @@ UserParameter=ups.status[*],upsc $1 ups.status # Key: ups.model[UPS] # Type of information: Text UserParameter=ups.model[*],upsc $1 ups.model + +# UPS discovery +UserParameter=hardware.ups.discovery[*],/var/lib/zabbix/bin/disco_nut_ups $1 + +# This is a new, more generic nut ups UserParameter +UserParameter=hardware.ups[*],upsc $1 $2 diff --git a/zabbix_scripts/disco_nut_ups b/zabbix_scripts/disco_nut_ups new file mode 100644 index 0000000..c74a2b8 --- /dev/null +++ b/zabbix_scripts/disco_nut_ups @@ -0,0 +1,17 @@ +#!/usr/bin/perl -w + +use JSON; + +my $json; + +if (system("upsc -l >/dev/null 2>&1") == 0){ + foreach my $ups (`upsc -l`){ + chomp($ups); + push @{$json->{data}}, {"{#UPSNAME}" => $ups}; + } + print to_json($json) if (defined $json->{data}); +} +else{ + print 'ZBX_NOTSUPPORTED'; +} +exit(0);