Dell's Nagios Plugin
Flaherty, Patrick
pflaherty at wsi.com
Mon Jun 29 13:09:37 CDT 2009
Eh, I didn't like the ones on nagios exchange as much, so I hacked this
one together. Basically scraps omreport. I don't think I've ever tested
it with two percs, but I think I set the code up right to deal with it.
There's an issue with ipmi (or something) crashing, and omreport no
longer reporting back errors. The which the regular nagiosexchange(now
monitoring exchange) doesn't catch it, because it looks for failures,
not a lack of information. If omreport returns back less than 15 lines,
this script throws a warning. You can usually solve that problem by
running "srvadmin-services.sh stop && service ipmi start &&
srvadmin-services.sh start", but sometimes have to powercycle the
machines.
#!/usr/bin/perl
# pflaherty at wsi.com 2008 (GPL2 or later)
use warnings;
use strict;
my $omrep = "/usr/bin/omreport";
my $omrep_chassis_minlength = 15;
my $states = { OK => 0,
WARNING => 1,
CRITICAL => 2,
UNKNOWN => 3,
};
my $exit_state = -1;
my $omrep_chassis = `$omrep chassis`;
if ($? != 0){
print "UNKNOWN: Can't run $omrep chassis correctly.\n";
exit $states->{CRITICAL};
}
my $omrep_chassis_linecount = 0;
$omrep_chassis_linecount++ while ($omrep_chassis =~ /\n/g);
if ($omrep_chassis_linecount < $omrep_chassis_minlength){
print "CRITICAL: OMSA Not Running Correctly\n";
exit $states->{CRITICAL};
}
my $output_line = '';
foreach my $line (split(/\n/, $omrep_chassis)){
next unless my ($state,$component) =
$line =~ /(OK|WARNING|CRITICAL)\s*:\s*(\w*)/i;
#print $state . ":" . $component . "\n";
$output_line .= $component . '(' . $state . ') ';
if ($exit_state < $states->{"\U$state"} &&
$exit_state != $states->{CRITICAL}){
$exit_state = $states->{"\U$state"};
}
}
my $omrep_controller = `$omrep storage controller`;
if ($? != 0){
print "UNKNOWN: Can't run $omrep storage controller correctly.\n";
exit 3;
}
my $controllers = {};
my $current_id;
foreach my $line (split(/\n/, $omrep_controller)){
if ($line =~ /^id/i){
($current_id) = $line =~ /(\d*)$/;
$controllers->{$current_id}->{id} = $current_id;
}elsif($line =~ /^status/i && $current_id =~ /\d/){;
my ($status) = $line =~ /([-\w]*)$/;
$controllers->{$current_id}->{status} = $status;
}
}
foreach my $controller (keys %{$controllers}){
my $pdisks = `$omrep storage pdisk controller=$controller`;
$output_line .= "StorageController$controller(" .
$controllers->{$controller}->{status} . ") ";
if($controllers->{$controller}->{status} =~ /^non-critical/i){
$exit_state = $states->{WARNING};
}
if($controllers->{$controller}->{status} =~ /^critical/i){
$exit_state = $states->{CRITICAL};
}
my $storage_errors = 0;
foreach my $line (split (/\n/, $pdisks)){
next unless $line =~ /^status/i;
next if $line =~ /ok$/i;
$storage_errors++;
$exit_state = $states->{CRITICAL};
}
if ($storage_errors > 0){
$output_line .= "Controller" . $controller . "_Disks($storage_errors
bad) ";
$exit_state = $states->{CRITICAL};
}else{
$output_line .= "Controller" . $controller . "_Disks(OK)";
}
}
print $output_line . "\n";
if( $exit_state == -1) {$exit_state = 0; }
exit $exit_state;
> -----Original Message-----
> From: linux-poweredge-bounces at lists.us.dell.com
> [mailto:linux-poweredge-bounces at lists.us.dell.com] On Behalf
> Of Mark Baxter
> Sent: Monday, June 29, 2009 5:12 AM
> To: Max Glucksmann; linux-poweredge at lists.us.dell.com
> Subject: RE: Dell's Nagios Plugin
>
> Max,
>
>
>
> Sorry for the late reply. I was on vacation for a few days.
>
>
>
> Unfortunately I haven't had any luck with Dell's plugin. I
> think I am going to investigate the other plugins that are
> out there instead.
>
>
>
> Regards,
>
>
>
> Mark Baxter
>
>
>
> ________________________________
>
> Mark Baxter
> OnDemand Administrator, Visma Proceedo AB
>
> Switchboard : +46 8 522 930 30 - Direct : +46 8 522 930 60 -
> Mobile : +46 73 978 92 60 - Fax : +46 8 58 88 48 29
>
> ________________________________
>
> ________________________________
>
> From: Max Glucksmann [mailto:maxglucksmann at comtel-networks.com]
> Sent: den 25 juni 2009 00:06
> To: linux-poweredge at lists.us.dell.com
> Cc: Mark Baxter
> Subject: Dell's Nagios Plugin
>
>
>
> Hello Mark,
>
>
>
> I'm wondering if you got the output of the plugin to show properly...
>
>
>
> I'm also getting (No Output).
>
>
>
> I have set the SETUID bit so the plugin is run as root as
> Misha suggested, but had no success.
>
>
>
> Any advice or comments about your experience would be great.
>
>
>
> Thanks,
>
> Max Glucksmann
>
> Comtel Networks Corp
>
> E-mail: maxglucksmann at comtel-networks.com
>
> IM: maxglucksmann at hotmail.com
>
> T/F: 954-366-6429
>
>
>
>
More information about the Linux-PowerEdge
mailing list