Closed xmacan closed 3 years ago
Let me know if this works for you....
--- a/lib/snmp.php
+++ b/lib/snmp.php
@@ -72,7 +72,7 @@ function cacti_snmp_session($hostname, $community, $version, $auth_user = '', $a
$timeout_us = (int) ($timeout_ms * 1000);
try {
- $session = new SNMP($version, $hostname . ':' . $port, ($version == 3 ? $auth_user : $community), $timeout_us, $retries);
+ $session = @new SNMP($version, $hostname . ':' . $port, ($version == 3 ? $auth_user : $community), $timeout_us, $retries);
} catch (Exception $e) {
return false;
}
better, now I see only: SNMP Information System SNMP error - SNMP::get(): Could not open snmp connection: Unknown host (mail.wrong-name.xz) (Invalid argument)
Is that good enough or should we work on it more?
I guess that it is enough. PHP warning is gone and message Could not open snmp connection: Unknown host is sufficient
In console -> devices -> device -> I got warning (in section SNMP Information): Warning: SNMP::__construct(): php_network_getaddresses: getaddrinfo failed: Name does not resolve in /usr/local/share/cacti/lib/snmp.php on line 75 System SNMP error - SNMP::get(): Could not open snmp connection: Unknown host (mail.wrong-name.xz) (Invalid argument)
It is happen in the case: 1) wrong hostname 2) PHP SNMP enabled
Without PHP SNMP, I got correctly- Host SNMP error
I guess that the error message should be the same.
Cacti 1.2.17, FreeBSD 12.1, PHP 7.4.8