cacti/ping_php_version4_snmpgetnext.patch

43 lines
1.2 KiB
Diff
Raw Normal View History

--- cacti-0.8.6j/lib/ping.php 2007-01-17 19:23:10.000000000 -0500
+++ cacti-0.8.6j-patch/lib/ping.php 2007-01-20 19:45:55.015625000 -0500
@@ -281,7 +281,13 @@
/* poll sysUptime for status */
$retry_count = 0;
+
+ /* getnext does not work in php versions less than 5 */
+ if (version_compare("5", phpversion(), "<")) {
$oid = ".1";
+ }else{ $oid = ".1.3.6.1.2.1.1.3.0";
+ }
+
while (1) {
if ($retry_count >= $this->retries) {
$this->snmp_status = "down";
@@ -289,6 +295,8 @@
return false;
}
+ /* getnext does not work in php versions less than 5 */
+ if (version_compare("5", phpversion(), "<")) {
$output = cacti_snmp_getnext($this->host["hostname"],
$this->host["snmp_community"],
$oid,
@@ -298,6 +306,16 @@
$this->host["snmp_port"],
$this->host["snmp_timeout"],
SNMP_CMDPHP);
+ }else{ $output = cacti_snmp_get($this->host["hostname"],
+ $this->host["snmp_community"],
+ $oid,
+ $this->host["snmp_version"],
+ $this->host["snmp_username"],
+ $this->host["snmp_password"],
+ $this->host["snmp_port"],
+ $this->host["snmp_timeout"],
+ SNMP_CMDPHP);
+ }
/* determine total time +- ~10% */
$this->time = $this->get_time($this->precision);