[nagiosplug] Removed suffix of "-rate" and let user decide ...

Ton Voon tonvoon at users.sourceforge.net
Wed Jun 30 11:56:41 CEST 2010


 Module: nagiosplug
 Branch: master
 Commit: 34445190148ac113da9d29cbf8b62f4ce8606304
 Author: tonvoon <ton.voon at opsview.com>
   Date: Wed Jun 30 09:37:10 2010 +0000
    URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=3444519

Removed suffix of "-rate" and let user decide label via --label

---

 plugins/check_snmp.c       |    2 --
 plugins/tests/check_snmp.t |   10 +++++-----
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index f8cae9b..e6707a0 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -493,8 +493,6 @@ main (int argc, char **argv)
 				temp_string=labels[i];
 			else
 				temp_string=oidname;
-			if(calculate_rate)
-				asprintf(&temp_string,"%s-rate",temp_string);
 			strncat(perfstr, temp_string, sizeof(perfstr)-strlen(perfstr)-1);
 			strncat(perfstr, "=", sizeof(perfstr)-strlen(perfstr)-1);
 			len = sizeof(perfstr)-strlen(perfstr)-1;
diff --git a/plugins/tests/check_snmp.t b/plugins/tests/check_snmp.t
index 0fa1691..1e350f2 100755
--- a/plugins/tests/check_snmp.t
+++ b/plugins/tests/check_snmp.t
@@ -51,7 +51,7 @@ if ($ARGV[0] && $ARGV[0] eq "-d") {
 	}
 }
 
-my $tests = 29;
+my $tests = 33;
 if (-x "./check_snmp") {
 	plan tests => $tests;
 } else {
@@ -116,7 +116,7 @@ sleep 1;
 
 $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -w 600" );
 is($res->return_code, 1, "WARNING - due to going above rate calculation" );
-is($res->output, "SNMP RATE WARNING - *666* | iso.3.6.1.4.1.8072.3.2.67.10-rate=666 ");
+is($res->output, "SNMP RATE WARNING - *666* | iso.3.6.1.4.1.8072.3.2.67.10=666 ");
 
 $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -w 600" );
 is($res->return_code, 3, "UNKNOWN - basically the divide by zero error" );
@@ -132,13 +132,13 @@ sleep 1;
 
 $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -l inoctets" );
 is($res->return_code, 0, "OK as no thresholds" );
-is($res->output, "SNMP RATE OK - inoctets 666 | inoctets-rate=666 ", "Check label");
+is($res->output, "SNMP RATE OK - inoctets 666 | inoctets=666 ", "Check label");
 
 sleep 2;
 
 $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -l inoctets" );
 is($res->return_code, 0, "OK as no thresholds" );
-is($res->output, "SNMP RATE OK - inoctets 333 | inoctets-rate=333 ", "Check rate decreases due to longer interval");
+is($res->output, "SNMP RATE OK - inoctets 333 | inoctets=333 ", "Check rate decreases due to longer interval");
 
 
 
@@ -151,7 +151,7 @@ sleep 1;
 
 $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -l inoctets_per_minute --rate-multiplier=60" );
 is($res->return_code, 0, "OK as no thresholds" );
-is($res->output, "SNMP RATE OK - inoctets_per_minute 11.1 | inoctets_per_minute-rate=11.1 ", "Checking multiplier");
+is($res->output, "SNMP RATE OK - inoctets_per_minute 11.1 | inoctets_per_minute=11.1 ", "Checking multiplier");
 
 
 $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.11 -s '\"stringtests\"'" );





More information about the Commits mailing list