New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unnecessary warnings appear when host name is not resolved #4267
Comments
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: |
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 |
netniV
changed the title
PHP warning for wrong specified hostname
SNMP library can display extra warning messages when host does not resolve
May 19, 2021
netniV
added a commit
that referenced
this issue
May 19, 2021
netniV
added
confirmed
Bug is confirm by dev team
and removed
unverified
Some days we don't have a clue
labels
May 19, 2021
netniV
changed the title
SNMP library can display extra warning messages when host does not resolve
Unnecessary warnings appear when host name is not resolved
Jul 4, 2021
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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:
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
The text was updated successfully, but these errors were encountered: