[Pkg-nagios-changes] [pkg-nagios-snmp-plugins] 01/01: Adding 20_check_snmp_load_multiple_cpus

Jan Wagner waja at moszumanska.debian.org
Sat Apr 25 21:58:49 UTC 2015


This is an automated email from the git hooks/post-receive script.

waja pushed a commit to branch master
in repository pkg-nagios-snmp-plugins.

commit e4c5a528cf65632869a53b6f9216b73e8daa9c8f
Author: Jan Wagner <waja at cyconet.org>
Date:   Sat Apr 25 23:57:18 2015 +0200

    Adding 20_check_snmp_load_multiple_cpus
---
 debian/patches/20_check_snmp_load_multiple_cpus | 58 +++++++++++++++++++++++++
 debian/patches/series                           |  1 +
 2 files changed, 59 insertions(+)

diff --git a/debian/patches/20_check_snmp_load_multiple_cpus b/debian/patches/20_check_snmp_load_multiple_cpus
new file mode 100644
index 0000000..5358aa8
--- /dev/null
+++ b/debian/patches/20_check_snmp_load_multiple_cpus
@@ -0,0 +1,58 @@
+## 19_check_snmp_load_n5k by Luis I. Perez Villota
+##
+## DP: Add support for n5k to check_snmp_load.pl
+
+## From 1fcf4f4220edb886fb85931792542d962cf02ecb Mon Sep 17 00:00:00 2001
+## From: Michael Friedrich <michael.friedrich at gmail.com>
+## Date: Sat, 25 Apr 2015 15:20:32 +0200
+## Subject: [PATCH] check_snmp_load.pl - Linux load multiple CPUs
+
+## Linux load doesn't handle multiple CPUs properly. Here is a patch that makes
+## the plugin to get the number of CPUs for a particular system and multiply
+## warning and critical limits by this number.
+
+fixes #6
+---
+ plugins/check_snmp_load.pl | 19 ++++++++++++++++++-
+ 1 file changed, 18 insertions(+), 1 deletion(-)
+
+diff --git a/plugins/check_snmp_load.pl b/plugins/check_snmp_load.pl
+index fd13f71..1f29ac5 100755
+--- a/plugins/check_snmp_load.pl
++++ b/plugins/check_snmp_load.pl
+@@ -363,6 +363,20 @@ sub check_options {
+ if ($o_check_type eq "netsl") {
+ 
+ verb("Checking linux load");
++
++# Get number of CPUs
++my $resultat =  (Net::SNMP->VERSION < 4) ?
++	  $session->get_table($proc_id)
++	: $session->get_table(Baseoid => $proc_id);
++
++if (!defined($resultat)) {
++   printf("ERROR: Description table : %s.\n", $session->error);
++   $session->close;
++   exit $ERRORS{"UNKNOWN"};
++}
++
++my $ncpu = keys %$resultat;
++
+ # Get load table
+ my $resultat = (Net::SNMP->VERSION lt 4) ? 
+ 		  $session->get_table($linload_table)
+@@ -397,10 +411,13 @@ sub check_options {
+ 
+ for (my $i=0;$i<3;$i++) { $load[$i] = $$resultat{$linload_load . "." . $iload[$i]}};
+ 
+-print "Load : $load[0] $load[1] $load[2] :";
++print "Load (CPUs: $ncpu) : $load[0] $load[1] $load[2] :";
+ 
+ $exit_val=$ERRORS{"OK"};
+ for (my $i=0;$i<3;$i++) {
++  # Multiply warning and critical levels by the number of CPUs
++  $o_warnL[$i] *= $ncpu;
++  $o_critL[$i] *= $ncpu;
+   if ( $load[$i] > $o_critL[$i] ) {
+    print " $load[$i] > $o_critL[$i] : CRITICAL";
+    $exit_val=$ERRORS{"CRITICAL"};
diff --git a/debian/patches/series b/debian/patches/series
index ec6ec8b..aec3277 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,5 +5,6 @@
 17_protocol_fam
 18_check_snmp_process_tmp_file
 19_check_snmp_load_n5k
+20_check_snmp_load_multiple_cpus
 50_disable_epn
 51_fix_privacy_doc

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-nagios-snmp-plugins.git



More information about the Pkg-nagios-changes mailing list