hmib plugin bugreport with patch

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
bb123
Posts: 1
Joined: Fri Jan 17, 2014 8:23 am

hmib plugin bugreport with patch

Post by bb123 »

I have found a bug in snmp.php of plugin hmib-v1.4-2:

The function cacti_snmp_get is called from poller_hmib.php with a maxoids parameter several times. however the function definition in snmp.php lacks this parameter.

Another Problem I have on my version of php (5.4.23 on FreeBSD) is that the oids are not returned numerically. So I have to call the function snmp_set_oid_output_format additionally to snmp_set_valueretrieval.

here is the diff:

Code: Select all

--- snmp.php.orig	2014-01-17 14:17:08.824526824 +0100
+++ snmp.php	2014-01-17 14:28:06.201527505 +0100
@@ -42,7 +42,7 @@
 	define("SNMP_ESCAPE_CHARACTER", "\"");
 }
 
-function cacti_snmp_get($hostname, $community, $oid, $version, $username, $password, $auth_proto, $priv_pass, $priv_proto, $context, $port = 161, $timeout = 500, $retries = 0, $method = SNMP_VALUE_LIBRARY, $environ = SNMP_POLLER) {
+function cacti_snmp_get($hostname, $community, $oid, $version, $username, $password, $auth_proto, $priv_pass, $priv_proto, $context, $port = 161, $timeout = 500, $retries = 0, $maxoids = 20, $method = SNMP_VALUE_LIBRARY, $environ = SNMP_POLLER) {
 	global $config;
 
 	/* determine default retries */
@@ -68,6 +68,7 @@
 		snmp_set_quick_print(0);
 
 		/* set the output format to numeric */
+		snmp_set_oid_output_format(SNMP_OID_OUTPUT_NUMERIC);
 		snmp_set_valueretrieval($method);
 
 		if ($version == "1") {
@@ -186,6 +187,7 @@
 		snmp_set_quick_print(0);
 
 		/* set the output format to numeric */
+		snmp_set_oid_output_format(SNMP_OID_OUTPUT_NUMERIC);
 		snmp_set_valueretrieval($method);
 
 		if ($version == "1") {
@@ -317,6 +319,7 @@
 		snmp_set_quick_print(0);
 
 		/* set the output format to numeric */
+		snmp_set_oid_output_format(SNMP_OID_OUTPUT_NUMERIC);
 		snmp_set_valueretrieval($method);
 
 		if ($version == "1") {
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests