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
666 B

#!/usr/bin/perl -w
use strict;
use File::Which;
use JSON;
my $json;
@{$json->{data}} = ();
my $cli = which('hpacucli') || which('ssacli');
# hpacucli or ssacli utility is needed
if (not defined $cli){
print to_json($json);
exit(0);
}
open( CLI, "$cli controller all show status|" )
or die "An error occured while running $cli: $!";
foreach my $line (<CLI>){
if ( $line =~ m/Another instance of hpacucli is running! Stop it first\./i ){
die "Another instance of hpacucli is running\n";
}
elsif ( $line =~ m/(.*) in Slot (\d+)/i ) {
push @{$json->{data}}, {"{#MODEL}" => $1, "{#SLOT}" => $2};
}
}
close CLI;
print to_json($json);
exit(0);