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.
 
 

15 lines
381 B

#!/usr/bin/perl -w
use JSON;
opendir(my $dh, "/sys/class/net") or die "Couldn't open /sys/class/net: $!";
my @nics = grep { $_ !~ m/^\./ } readdir($dh);
closedir($dh);
my $json;
foreach my $nic (@nics){
next unless ($nic =~ m/^(\w+[\.:]?(\d+)?)$/);
$nic = $1;
push @{$json->{data}}, { "{#IFNAME}" => $nic};
}
print to_json($json) if (defined $json->{data});
exit(0);