Additional scripts for Zabbix agent on Linux to discover and monitor several services
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

31 lines
501 B

#!/usr/bin/perl -w
use strict;
use warnings;
use JSON;
use File::Which;
use Getopt::Long;
my $json;
@{$json->{data}} = ();
my $what = 'volumes';
my $pretty = 0;
GetOptions(
'what=s' => \$what,
'pretty' => \$pretty
);
my $vdostats = which('vdostats');
if (defined $vdostats) {
foreach my $line (qx($vdostats)) {
if ($line =~ m|^/dev/mapper/([^\s]+)|) {
push @{$json->{data}}, {
'{#VDO_VOL}' => $1
};
}
}
}
print to_json($json, { pretty => $pretty }) . "\n";