Skip to content

Commit

Permalink
Merge branch 'master' of github.com:barryo/nagios-plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
barryo committed Nov 28, 2014
2 parents a86114b + 366e6cd commit b04b702
Show file tree
Hide file tree
Showing 4 changed files with 424 additions and 14 deletions.
2 changes: 1 addition & 1 deletion OSS_SNMP
Submodule OSS_SNMP updated 66 files
+2 −0 .gitignore
+221 −2 OSS_SNMP/MIBS/Cisco/SMST.php
+65 −0 OSS_SNMP/MIBS/Extreme/Chassis.php
+19 −0 OSS_SNMP/MIBS/Foundry/Chassis.php
+24 −2 OSS_SNMP/MIBS/System.php
+43 −11 OSS_SNMP/Platform.php
+85 −0 OSS_SNMP/Platforms/vendor_alcatel-lucent.php
+40 −11 OSS_SNMP/Platforms/vendor_brocade.php
+7 −0 OSS_SNMP/Platforms/vendor_extreme.php
+14 −8 OSS_SNMP/Platforms/vendor_juniper.php
+66 −0 OSS_SNMP/Platforms/vendor_linux.php
+25 −0 bin/platform-playground.php
+276 −321 doc/classes.svg
+93 −47 doc/classes/OSS_SNMP.Cache.APC.html
+89 −28 doc/classes/OSS_SNMP.Cache.Basic.html
+24 −20 doc/classes/OSS_SNMP.Cache.html
+14 −153 doc/classes/OSS_SNMP.Exception.html
+31 −23 doc/classes/OSS_SNMP.MIB.html
+618 −720 doc/classes/OSS_SNMP.MIBS.Asterisk.Channels.html
+62 −76 doc/classes/OSS_SNMP.MIBS.Asterisk.Indications.html
+93 −117 doc/classes/OSS_SNMP.MIBS.Asterisk.html
+363 −418 doc/classes/OSS_SNMP.MIBS.BGP.html
+41 −47 doc/classes/OSS_SNMP.MIBS.Bridge.html
+430 −493 doc/classes/OSS_SNMP.MIBS.Cisco.CDP.html
+72 −103 doc/classes/OSS_SNMP.MIBS.Cisco.MST.html
+92 −109 doc/classes/OSS_SNMP.MIBS.Cisco.RSTP.html
+210 −101 doc/classes/OSS_SNMP.MIBS.Cisco.SMST.html
+117 −135 doc/classes/OSS_SNMP.MIBS.Cisco.VTP.html
+33 −39 doc/classes/OSS_SNMP.MIBS.Cisco.html
+136 −91 doc/classes/OSS_SNMP.MIBS.Entity.html
+182 −0 doc/classes/OSS_SNMP.MIBS.Extreme.Chassis.html
+215 −239 doc/classes/OSS_SNMP.MIBS.Extreme.Vlan.html
+33 −39 doc/classes/OSS_SNMP.MIBS.Extreme.html
+672 −0 doc/classes/OSS_SNMP.MIBS.Foundry.Chassis.html
+155 −0 doc/classes/OSS_SNMP.MIBS.Foundry.html
+33 −39 doc/classes/OSS_SNMP.MIBS.Host.html
+1,256 −1,263 doc/classes/OSS_SNMP.MIBS.Iface.html
+55 −61 doc/classes/OSS_SNMP.MIBS.LAG.html
+48 −54 doc/classes/OSS_SNMP.MIBS.MRV.System.html
+33 −39 doc/classes/OSS_SNMP.MIBS.MRV.html
+189 −0 doc/classes/OSS_SNMP.MIBS.SNMP.Engine.html
+155 −0 doc/classes/OSS_SNMP.MIBS.SNMP.html
+111 −90 doc/classes/OSS_SNMP.MIBS.System.html
+134 −71 doc/classes/OSS_SNMP.Platform.html
+232 −197 doc/classes/OSS_SNMP.SNMP.html
+37 −25 doc/classes/OSS_SNMP.Timer.html
+28 −16 doc/css/template.css
+7 −8 doc/deprecated.html
+343 −161 doc/errors.html
+5 −6 doc/graph_class.html
+8 −11 doc/index.html
+22 −5 doc/js/template.js
+27 −14 doc/markers.html
+6 −7 doc/namespaces/OSS_SNMP.Cache.html
+6 −7 doc/namespaces/OSS_SNMP.MIBS.Asterisk.html
+6 −7 doc/namespaces/OSS_SNMP.MIBS.Cisco.html
+13 −7 doc/namespaces/OSS_SNMP.MIBS.Extreme.html
+96 −0 doc/namespaces/OSS_SNMP.MIBS.Foundry.html
+6 −7 doc/namespaces/OSS_SNMP.MIBS.MRV.html
+96 −0 doc/namespaces/OSS_SNMP.MIBS.SNMP.html
+83 −11 doc/namespaces/OSS_SNMP.MIBS.html
+85 −13 doc/namespaces/OSS_SNMP.html
+66 −27 doc/packages/Default.html
+10,718 −8,013 doc/structure.xml
+206 −0 examples/mst-port-roles.php
+79 −0 examples/platform.php
46 changes: 33 additions & 13 deletions check_chassis_brocade.pl
Expand Up @@ -46,14 +46,15 @@


my $status;
my $TIMEOUT = 20;
my $timeout = 20;
my $state = "OK";
my $answer = "";
my $int;
my $snmpkey;
my $key;
my $community = "public";
my $port = 161;
my $perf = 0;

my $hostname = undef;
my $session;
Expand Down Expand Up @@ -102,19 +103,14 @@
my $cpudata = undef;
my $memdata = undef;

my $tempdataperf = undef;
my $cpudataperf = undef;
my $memdataperf = undef;

my $lastcheck = undef;

my $skipothers = 0;


# Just in case of problems, let's not hang Nagios
$SIG{'ALRM'} = sub {
print( "ERROR: No snmp response from $hostname\n" );
exit $ERRORS{"UNKNOWN"};
};
alarm( $TIMEOUT );


$status = GetOptions(
"hostname=s", \$hostname,
"community=s", \$community,
Expand All @@ -138,11 +134,20 @@
"thres-cpu-5sec=s", \$threscpuarg{'5sec'},
"thres-cpu-1min=s", \$threscpuarg{'1min'},
"ignore-psu-notpresent", \$ignorepsunotpresent,
"timeout=i", \$timeout,
"perf", \$perf,
"help|?", \$help,
"verbose", \$verbose,
"reboot=i", \$rebootWindow
);

# Just in case of problems, let's not hang Nagios
$SIG{'ALRM'} = sub {
print( "ERROR: No snmp response from $hostname\n" );
exit $ERRORS{"UNKNOWN"};
};
alarm( $timeout);

if( !$status || $help ) {
usage();
}
Expand Down Expand Up @@ -207,13 +212,21 @@
print $fandata if( defined( $fandata ) && !$skipfans );
print $psudata if( defined( $psudata ) && !$skippsu );
printf( "Up %0.2f days", $uptime ) if( !$skipreboot );
print( "\n" );
}
else
{
print "$answer\n";
print "$answer";
}

if ($perf) {
print "|";
print $cpudataperf if( !$skipcpuall && defined( $cpudataperf ) );
print $memdataperf if( !$skipmem && defined( $memdataperf ) );
print $tempdataperf if( !$skiptemp && defined( $tempdataperf ) );
}

print( "\n" );

exit $ERRORS{$state};


Expand Down Expand Up @@ -252,6 +265,7 @@ sub checkTemperature
print( "Temp #$t_index: $t_actual (Warn: $t_warning Shutdown: $t_shutdown)\n" ) if $verbose;
$tempdata = "Temp (A/W/C): " if( !defined( $tempdata ) );
$tempdata .= sprintf( "%0.1f/%0.1f/%0.1f; ", $t_actual, $t_warning, $t_shutdown );
$tempdataperf .= sprintf( "Temp=%0.1fdeg;%0.1f;%0.1f ", $t_actual, $t_warning, $t_shutdown );

if( $t_actual >= $t_warning ) {
&setstate( 'CRITICAL', "Temperature approaching SHUTDOWN threshold: $t_actual/$t_shutdown" );
Expand Down Expand Up @@ -350,14 +364,15 @@ sub checkPower
my $t_desc = $response->{$snmpPowerDesc . '.' . $t_index};
my $t_state = $PSU_STATES{$response->{$snmpPowerState . '.' . $t_index}};

if ( $ignorepsunotpresent && ($t_desc =~ /not present/) ) { $t_state = "N/A"; }

print( "PSU: $t_desc - $t_state\n" ) if $verbose;
$psudata = "PSUs:" if( !defined( $psudata ) );
$psudata .= ( $t_state eq 'NORMAL' ? ' OK' : " $t_state" );

if( $t_state =~ m/FAILURE/i ) {
&setstate( 'CRITICAL', "PSU state for $t_desc: $t_state" );
} elsif( $t_state !~ m/^NORMAL$/i ) {
} elsif( $t_state !~ m/^NORMAL|N\/A$/i ) {
&setstate( 'WARNING', "PSU state for $t_desc: $t_state" );
}
}
Expand All @@ -382,6 +397,8 @@ sub checkMemory

printf( "Memory: %d%% used\n", $memused ) if $verbose;

$memdataperf = sprintf( "Memory=%d%%;%d;%d ", $memused, $memwarn, $memcrit );

if( $memused >= $memcrit ) {
&setstate( 'CRITICAL', sprintf( "Memory Usage at %d%%", $memused ) );
} elsif( $memused >= $memwarn ) {
Expand Down Expand Up @@ -495,6 +512,7 @@ sub checkCPU
exit $ERRORS{"UNKNOWN"};
}
}
$cpudataperf .= "CPU_$t_time=$util%" . ";" . $threscpu{$t_time.'w'}. ";" . $threscpu{$t_time.'c'} . " ";

if( $util >= $threscpu{$t_time . 'c'} ) {
&setstate( 'CRITICAL', "$t_time CPU Usage $util%" );
Expand All @@ -516,6 +534,8 @@ sub usage {
printf " --hostname The hostname to check\n";
printf " --port The port to query SNMP on (using: $port)\n";
printf " --community The SNMP access community (using: $community)\n\n";
printf " --timeout <integer> Execution timeout in seconds (using: " . $timeout. ")\n";
printf " --perf Produce performance data output\n\n";
printf " --skip-mem Skip memory checks\n";
printf " --memwarn <integer> Percentage of memory usage for warning (using: " . $memwarn . ")\n";
printf " --memcrit <integer> Percentage of memory usage for critical (using: " . $memcrit . ")\n\n";
Expand Down

0 comments on commit b04b702

Please sign in to comment.