Skip to content
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

When running under Fedora, issues may be seen with snmp values #4726

Closed
majed17 opened this issue Apr 18, 2022 · 54 comments
Closed

When running under Fedora, issues may be seen with snmp values #4726

majed17 opened this issue Apr 18, 2022 · 54 comments
Labels
bug Undesired behaviour confirmed Bug is confirm by dev team resolved A fixed issue

Comments

@majed17
Copy link

majed17 commented Apr 18, 2022

this started happening in 1.2.18, i recall reading that it is a bug, so i waited for 1.2.20 but it is still present..
php 8.0.17
i'm on Fedora 35


2022/04/18 16:10:23 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[141]:api_device_ping_device(),  /lib/api_device.php[1330]:cacti_snmp_session_get(),  /lib/snmp.php[497]:SNMP->get(), CactiErrorHandler())
--
2022/04/18 16:10:23 - ERROR PHP WARNING: SNMP::get(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 497
2022/04/18 16:10:22 - CMDPHP PHP ERROR WARNING Backtrace:   (/var/lib/cacti/cli/poller_reindex_hosts.php[165]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[862]:cacti_snmp_session_get(),  /lib/snmp.php[497]:SNMP->get(), CactiErrorHandler())
2022/04/18 16:10:22 - ERROR PHP WARNING: SNMP::get(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 497
2022/04/18 16:10:22 - CMDPHP PHP ERROR WARNING Backtrace:   (/var/lib/cacti/cli/poller_reindex_hosts.php[165]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[813]:cacti_snmp_session_walk(),  /lib/snmp.php[460]:SNMP->walk(), CactiErrorHandler())

@majed17 majed17 added bug Undesired behaviour unverified Some days we don't have a clue labels Apr 18, 2022
@netniV
Copy link
Member

netniV commented Apr 18, 2022

     try {
          $out = @$session->get(trim($oid));
     } catch (Exception $e) {
          $out = false;
     }

That is what the code should look like there. Does it match yours?

@TheWitness
Copy link
Member

I think we need to isolate this error in our snmp_ignore message list. Though a generic USM error speaks to something larger.

@majed17
Copy link
Author

majed17 commented Apr 19, 2022

in /usr/share/cacti/lib/snmp.php on line: 497
i have:

try {
		$out = @$session->get(trim($oid));
	} catch (Exception $e) {
		$out = false;
	}

TheWitness added a commit that referenced this issue Apr 19, 2022
- Attempt to fix the SNMP errors reported in #4726
@TheWitness
Copy link
Member

@majed17, please update lib/functions.php from the 1.2.x branch and report back.

@majed17
Copy link
Author

majed17 commented Apr 20, 2022

that didn't solve the problem:

2022/04/20  09:51:25 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[141]:api_device_ping_device(),  /lib/api_device.php[1330]:cacti_snmp_session_get(),  /lib/snmp.php[497]:SNMP->get(), CactiErrorHandler())
--
2022/04/20 09:51:25 - ERROR PHP WARNING: SNMP::get(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 497
2022/04/20 09:51:24 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[118]:host_reload_query(), /host.php[618]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[862]:cacti_snmp_session_get(),  /lib/snmp.php[497]:SNMP->get(), CactiErrorHandler())
2022/04/20 09:51:24 - ERROR PHP WARNING: SNMP::get(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 497
2022/04/20 09:51:24 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[118]:host_reload_query(), /host.php[618]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[813]:cacti_snmp_session_walk(),  /lib/snmp.php[460]:SNMP->walk(), CactiErrorHandler())
2022/04/20 09:51:24 - ERROR PHP WARNING: SNMP::walk(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 460
2022/04/20 09:51:24 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[118]:host_reload_query(), /host.php[618]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[813]:cacti_snmp_session_walk(),  /lib/snmp.php[460]:SNMP->walk(), CactiErrorHandler())
2022/04/20 09:51:24 - ERROR PHP WARNING: SNMP::walk(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 460
2022/04/20 09:51:24 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[118]:host_reload_query(), /host.php[618]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[813]:cacti_snmp_session_walk(),  /lib/snmp.php[460]:SNMP->walk(), CactiErrorHandler())
2022/04/20 09:51:24 - ERROR PHP WARNING: SNMP::walk(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 460
2022/04/20 09:51:23 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[118]:host_reload_query(), /host.php[618]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[813]:cacti_snmp_session_walk(),  /lib/snmp.php[460]:SNMP->walk(), CactiErrorHandler())
2022/04/20 09:51:23 - ERROR PHP WARNING: SNMP::walk(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 460
2022/04/20 09:51:23 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[118]:host_reload_query(), /host.php[618]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[813]:cacti_snmp_session_walk(),  /lib/snmp.php[460]:SNMP->walk(), CactiErrorHandler())
2022/04/20 09:51:23 - ERROR PHP WARNING: SNMP::walk(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 460
2022/04/20 09:51:15 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[141]:api_device_ping_device(),  /lib/api_device.php[1330]:cacti_snmp_session_get(),  /lib/snmp.php[497]:SNMP->get(), CactiErrorHandler())
2022/04/20 09:51:15 - ERROR PHP WARNING: SNMP::get(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 497
2022/04/20 09:48:53 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[141]:api_device_ping_device(),  /lib/api_device.php[1330]:cacti_snmp_session_get(),  /lib/snmp.php[497]:SNMP->get(), CactiErrorHandler())
2022/04/20 09:48:53 - ERROR PHP WARNING: SNMP::get(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 497

@TheWitness
Copy link
Member

Okay, add a Cacti log to the trimmed OID and let's see which ones cause the errors;

cacti_log("The OID is '$oid'", false, 'SNMP');

Then let's try to track down the host. It's not going to be entirely easy.

@majed17
Copy link
Author

majed17 commented Apr 20, 2022

where to add it?

@TheWitness
Copy link
Member

Just before line 497. Review your log.

@TheWitness
Copy link
Member

And line 460.

@majed17
Copy link
Author

majed17 commented Apr 20, 2022

ok


2022/04/20  15:29:20 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[141]:api_device_ping_device(),  /lib/api_device.php[1330]:cacti_snmp_session_get(),  /lib/snmp.php[499]:SNMP->get(), CactiErrorHandler())
--
2022/04/20 15:29:20 - ERROR PHP WARNING: SNMP::get(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 499
2022/04/20 15:29:20 - SNMP The OID is '.1.3.6.1.2.1.1.1.0'

@netniV
Copy link
Member

netniV commented Apr 20, 2022

That's a fairly generic OID, suggests that maybe the SNMP details aren't correct, You can find out the host using $session->hostname but the problem you will have is that this is a private variable (at least if using the phpsnmp class that we include). You could have use the info variable but that is also useless as it's not being primed in the current version.

Your best bet is to dump the session var using var_export($session, true) to a log and see if it includes those private variables to help you track the host down.

@netniV
Copy link
Member

netniV commented Apr 20, 2022

If you want a fix for that, btw, edit the include/phpsnmp/classSNMP.php and change the $info variable to $this->info at the end of the __construct function. Then you'll be able to use $session->info to see the host details without using var_export.

netniV added a commit that referenced this issue Apr 20, 2022
Whilst being unable to obtain SNMP data, the $session->info
variable is empty despite appearing to be primed by
classSNMP.php's SNMP class.
@majed17
Copy link
Author

majed17 commented Apr 21, 2022

i added:

try {
		cacti_log("The OID is '$oid'", false, 'SNMP');
		$out = @$session->get(trim($oid));
		$session->hostname;
	} catch (Exception $e) {
		$out = false;
	}

and

try {
		cacti_log("The OID is '$oid'", false, 'SNMP');
		$session->hostname;
		$out = @$session->walk(trim($oid), false, $max_repetitions, $non_repeaters);
	} catch (Exception $e) {
		$out = false;
	}

and replaced $info with $this->info in classSNMP.php and got:




2022/04/21  12:51:11 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[118]:host_reload_query(), /host.php[618]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[862]:cacti_snmp_session_get(),  /lib/snmp.php[501]:CactiErrorHandler())
--
2022/04/21 12:51:11 - ERROR PHP WARNING: Undefined property:  phpsnmp\SNMP::$hostname in file: /usr/share/cacti/lib/snmp.php  on line:  501
2022/04/21 12:51:11 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[118]:host_reload_query(), /host.php[618]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[862]:cacti_snmp_session_get(),  /lib/snmp.php[500]:SNMP->get(), CactiErrorHandler())
2022/04/21 12:51:11 - ERROR PHP WARNING: SNMP::get(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 500
2022/04/21 12:51:11 - SNMP The OID is '.1.3.6.1.2.1.2.1.0'
2022/04/21 12:51:11 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[118]:host_reload_query(), /host.php[618]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[813]:cacti_snmp_session_walk(),  /lib/snmp.php[462]:SNMP->walk(), CactiErrorHandler())
2022/04/21 12:51:11 - ERROR PHP WARNING: SNMP::walk(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 462
2022/04/21 12:51:11 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[118]:host_reload_query(), /host.php[618]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[813]:cacti_snmp_session_walk(),  /lib/snmp.php[461]:CactiErrorHandler())
2022/04/21 12:51:11 - ERROR PHP WARNING: Undefined property:  phpsnmp\SNMP::$hostname in file: /usr/share/cacti/lib/snmp.php  on line:  461
2022/04/21 12:51:11 - SNMP The OID is '.1.3.6.1.2.1.2.2.1.1'

if you need more info, please don't treat me like a programmer. just write what to add to what file with the complete syntax, thanks.

@TheWitness
Copy link
Member

Did you update the $base_path/include/vendor/phpsnmp/snmp.php file from 1.2.x?

@majed17
Copy link
Author

majed17 commented Apr 21, 2022

now that you mentioned it, i went ahead and did it..but that idn't chnage the output:



2022/04/21  15:27:44 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[141]:api_device_ping_device(),  /lib/api_device.php[1330]:cacti_snmp_session_get(),  /lib/snmp.php[501]:CactiErrorHandler())
--
2022/04/21 15:27:44 - ERROR PHP WARNING: Undefined property:  phpsnmp\SNMP::$hostname in file: /usr/share/cacti/lib/snmp.php  on line:  501
2022/04/21 15:27:44 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[141]:api_device_ping_device(),  /lib/api_device.php[1330]:cacti_snmp_session_get(),  /lib/snmp.php[500]:SNMP->get(), CactiErrorHandler())
2022/04/21 15:27:44 - ERROR PHP WARNING: SNMP::get(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 500
2022/04/21 15:27:44 - SNMP The OID is '.1.3.6.1.2.1.1.1.0'
2022/04/21 15:27:40 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[141]:api_device_ping_device(),  /lib/api_device.php[1330]:cacti_snmp_session_get(),  /lib/snmp.php[501]:CactiErrorHandler())
2022/04/21 15:27:40 - ERROR PHP WARNING: Undefined property:  phpsnmp\SNMP::$hostname in file: /usr/share/cacti/lib/snmp.php  on line:  501
2022/04/21 15:27:40 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[141]:api_device_ping_device(),  /lib/api_device.php[1330]:cacti_snmp_session_get(),  /lib/snmp.php[500]:SNMP->get(), CactiErrorHandler())
2022/04/21 15:27:40 - ERROR PHP WARNING: SNMP::get(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 500
2022/04/21 15:27:40 - SNMP The OID is '.1.3.6.1.2.1.1.1.0'
2022/04/21 15:27:39 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[118]:host_reload_query(), /host.php[618]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[862]:cacti_snmp_session_get(),  /lib/snmp.php[501]:CactiErrorHandler())
2022/04/21 15:27:39 - ERROR PHP WARNING: Undefined property:  phpsnmp\SNMP::$hostname in file: /usr/share/cacti/lib/snmp.php  on line:  501
2022/04/21 15:27:39 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[118]:host_reload_query(), /host.php[618]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[862]:cacti_snmp_session_get(),  /lib/snmp.php[500]:SNMP->get(), CactiErrorHandler())
2022/04/21 15:27:39 - ERROR PHP WARNING: SNMP::get(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 500
2022/04/21 15:27:39 - SNMP The OID is '.1.3.6.1.2.1.2.1.0'
2022/04/21 15:27:39 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[118]:host_reload_query(), /host.php[618]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[813]:cacti_snmp_session_walk(),  /lib/snmp.php[462]:SNMP->walk(), CactiErrorHandler())
2022/04/21 15:27:39 - ERROR PHP WARNING: SNMP::walk(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 462
2022/04/21 15:27:39 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[118]:host_reload_query(), /host.php[618]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[813]:cacti_snmp_session_walk(),  /lib/snmp.php[461]:CactiErrorHandler())
2022/04/21 15:27:39 - ERROR PHP WARNING: Undefined property:  phpsnmp\SNMP::$hostname in file: /usr/share/cacti/lib/snmp.php  on line:  461
2022/04/21 15:27:39 - SNMP The OID is '.1.3.6.1.2.1.2.2.1.1'
2022/04/21 15:27:39 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[118]:host_reload_query(), /host.php[618]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[813]:cacti_snmp_session_walk(),  /lib/snmp.php[462]:SNMP->walk(), CactiErrorHandler())
2022/04/21 15:27:39 - ERROR PHP WARNING: SNMP::walk(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 462
2022/04/21 15:27:39 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[118]:host_reload_query(), /host.php[618]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[813]:cacti_snmp_session_walk(),  /lib/snmp.php[461]:CactiErrorHandler())
2022/04/21 15:27:39 - ERROR PHP WARNING: Undefined property:  phpsnmp\SNMP::$hostname in file: /usr/share/cacti/lib/snmp.php  on line:  461
2022/04/21 15:27:39 - SNMP The OID is '.1.3.6.1.2.1.2.2.1.1'
2022/04/21 15:27:34 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[141]:api_device_ping_device(),  /lib/api_device.php[1330]:cacti_snmp_session_get(),  /lib/snmp.php[501]:CactiErrorHandler())
2022/04/21 15:27:34 - ERROR PHP WARNING: Undefined property:  phpsnmp\SNMP::$hostname in file: /usr/share/cacti/lib/snmp.php  on line:  501
2022/04/21 15:27:34 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[141]:api_device_ping_device(),  /lib/api_device.php[1330]:cacti_snmp_session_get(),  /lib/snmp.php[500]:SNMP->get(), CactiErrorHandler())
2022/04/21 15:27:34 - ERROR PHP WARNING: SNMP::get(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 500
2022/04/21 15:27:34 - SNMP The OID is '.1.3.6.1.2.1.1.1.0'


@TheWitness
Copy link
Member

@majed17, what is the hostname? Just need the pattern, not the real name. Is it IPv4 or IPv6? The php-snmp won't work very well with IPv6. Well, it's broken. Not enough time in my days to fix that (in php).

@TheWitness
Copy link
Member

Last thing, is php-snmp installed even?

@majed17
Copy link
Author

majed17 commented Apr 21, 2022

the host name is ipv4, (lucky you), and it's called Bo__ov 1__1

@TheWitness
Copy link
Member

Okay, so no special characters like tcp:Bo_ov:192 or something like that. Good.

@majed17
Copy link
Author

majed17 commented Apr 21, 2022

Package php-snmp-8.0.18-1.fc35.x86_64 is already installed.

@TheWitness
Copy link
Member

You updated $base_path/lib/snmp.php too right?

@majed17
Copy link
Author

majed17 commented Apr 21, 2022

the __ are substitute for letters or numbers..and this is happening to all the hosts

@TheWitness
Copy link
Member

I have to check the PHP documentation, but running out of time. Work starts in a few minutes.

@majed17
Copy link
Author

majed17 commented Apr 21, 2022

https://github.com/Cacti/cacti/tree/1.2.x/lib snmp.php has been updated 2 months ago, so what to be updated or from where?

@TheWitness
Copy link
Member

@netniV made a change yesterday. Pretty sure. Maybe he made that change locally. Anyway, just for giggles there is this line at the beginning of the file:

image

Comment out all except the include_once(...classSNMP.php... and see if it starts working.

@TheWitness
Copy link
Member

Oh, and he made changes to classSNMP.php yesterday. So, that's what you need to grab. Sorry about that.

@majed17
Copy link
Author

majed17 commented Apr 22, 2022

cacti

@TheWitness
Copy link
Member

Yea, that dog won't hunt with php-snmp. Are you on net-snmp 5.8+?

@TheWitness
Copy link
Member

If so, just uninstall php-snmp and restart apache.

@majed17
Copy link
Author

majed17 commented Apr 22, 2022

Package net-snmp-1:5.9.1-7.fc35.x86_64 is already installed.

yum remove php-snmp will also remove cacti, spine and net-snmp, among lots others

@TheWitness
Copy link
Member

use rpm -e --nodeps and it'll remove cleanly.

@majed17
Copy link
Author

majed17 commented Apr 23, 2022

did the rpm -e --nodeps php-snmp and restarted apache..


2022/04/23  17:45:55 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[141]:api_device_ping_device(),  /lib/api_device.php[1330]:cacti_snmp_session_get(),  /lib/snmp.php[501]:CactiErrorHandler())
--
2022/04/23 17:45:55 - ERROR PHP WARNING: Undefined property:  phpsnmp\SNMP::$hostname in file: /usr/share/cacti/lib/snmp.php  on line:  501
2022/04/23 17:45:55 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[141]:api_device_ping_device(),  /lib/api_device.php[1330]:cacti_snmp_session_get(),  /lib/snmp.php[500]:SNMP->get(), CactiErrorHandler())
2022/04/23 17:45:55 - ERROR PHP WARNING: SNMP::get(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 500
2022/04/23 17:45:55 - SNMP The OID is '.1.3.6.1.2.1.1.1.0'

@TheWitness TheWitness changed the title system snmp error Issues gathering snmp values on Fedora 35 Apr 24, 2022
@TheWitness TheWitness changed the title Issues gathering snmp values on Fedora 35 Issues gathering snmp values on Fedora 35 using snmpv3 and php-snmp Apr 24, 2022
@TheWitness TheWitness added confirmed Bug is confirm by dev team and removed unverified Some days we don't have a clue labels Apr 24, 2022
TheWitness added a commit that referenced this issue Apr 24, 2022
@TheWitness
Copy link
Member

Okay, this is fixed now, but to use snmpv3 you will have to always run with php-snmp uninstalled until we can get php-snmp updated for modern settings. I'll have to check the PHP group to see if they have incorporated them yet.

@TheWitness TheWitness added the resolved A fixed issue label Apr 24, 2022
@majed17
Copy link
Author

majed17 commented Apr 29, 2022

now i get:


2022/04/29  09:16:55 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[141]:api_device_ping_device(),  /lib/api_device.php[1330]:cacti_snmp_session_get(),  /lib/snmp.php[501]:CactiErrorHandler())
--
2022/04/29 09:16:55 - ERROR PHP WARNING: Undefined property:  phpsnmp\SNMP::$hostname in file: /usr/share/cacti/lib/snmp.php  on line:  501
2022/04/29 09:16:55 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[141]:api_device_ping_device(),  /lib/api_device.php[1330]:cacti_snmp_session_get(),  /lib/snmp.php[500]:SNMP->get(), CactiErrorHandler())
2022/04/29 09:16:55 - ERROR PHP WARNING: SNMP::get(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 500
2022/04/29 09:16:55 - SNMP The OID is '.1.3.6.1.2.1.1.1.0'

@majed17
Copy link
Author

majed17 commented Apr 29, 2022

after removing host name:


2022/04/29  09:24:11 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[141]:api_device_ping_device(),  /lib/api_device.php[1330]:cacti_snmp_session_get(),  /lib/snmp.php[500]:SNMP->get(), CactiErrorHandler())
--
2022/04/29 09:24:11 - ERROR PHP WARNING: SNMP::get(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 500
2022/04/29 09:24:11 - SNMP The OID is '.1.3.6.1.2.1.1.1.0'


@netniV
Copy link
Member

netniV commented Apr 29, 2022

Hostname should have been ->info instead. That contains all the host details so you can identify the host having the issue.

@majed17
Copy link
Author

majed17 commented Apr 29, 2022

here it is with ->info




2022/04/29  09:47:35 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[118]:host_reload_query(), /host.php[618]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[862]:cacti_snmp_session_get(),  /lib/snmp.php[501]:SNMP->get(), CactiErrorHandler())
--
2022/04/29 09:47:35 - ERROR PHP WARNING: SNMP::get(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 501
2022/04/29 09:47:35 - SNMP The OID is '.1.3.6.1.2.1.2.1.0'
2022/04/29 09:47:35 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[118]:host_reload_query(), /host.php[618]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[813]:cacti_snmp_session_walk(),  /lib/snmp.php[463]:SNMP->walk(), CactiErrorHandler())
2022/04/29 09:47:35 - ERROR PHP WARNING: SNMP::walk(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 463
2022/04/29 09:47:35 - SNMP The OID is '.1.3.6.1.2.1.2.2.1.1'


 

@netniV
Copy link
Member

netniV commented Apr 29, 2022

I don't see info there, have you stripped that out?

@majed17
Copy link
Author

majed17 commented Apr 29, 2022

try {
		cacti_log("The OID is '$oid'", false, 'SNMP');
		//$session->hostname;
		$session->info;
		$out = @$session->walk(trim($oid), false, $max_repetitions, $non_repeaters);
	} catch (Exception $e) {
		$out = false;
	}
try {
		cacti_log("The OID is '$oid'", false, 'SNMP');
		$out = @$session->get(trim($oid));
		//$session->hostname;
		$session->info;
	} catch (Exception $e) {
		$out = false;

@majed17
Copy link
Author

majed17 commented Apr 29, 2022

full output:


2022/04/29  09:47:39 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[141]:api_device_ping_device(),  /lib/api_device.php[1330]:cacti_snmp_session_get(),  /lib/snmp.php[501]:SNMP->get(), CactiErrorHandler())
--
2022/04/29 09:47:39 - ERROR PHP WARNING: SNMP::get(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 501
2022/04/29 09:47:39 - SNMP The OID is '.1.3.6.1.2.1.1.1.0'
2022/04/29 09:47:36 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[141]:api_device_ping_device(),  /lib/api_device.php[1330]:cacti_snmp_session_get(),  /lib/snmp.php[501]:SNMP->get(), CactiErrorHandler())
2022/04/29 09:47:36 - ERROR PHP WARNING: SNMP::get(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 501
2022/04/29 09:47:36 - SNMP The OID is '.1.3.6.1.2.1.1.1.0'
2022/04/29 09:47:35 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[118]:host_reload_query(), /host.php[618]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[862]:cacti_snmp_session_get(),  /lib/snmp.php[501]:SNMP->get(), CactiErrorHandler())
2022/04/29 09:47:35 - ERROR PHP WARNING: SNMP::get(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 501
2022/04/29 09:47:35 - SNMP The OID is '.1.3.6.1.2.1.2.1.0'
2022/04/29 09:47:35 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[118]:host_reload_query(), /host.php[618]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[813]:cacti_snmp_session_walk(),  /lib/snmp.php[463]:SNMP->walk(), CactiErrorHandler())
2022/04/29 09:47:35 - ERROR PHP WARNING: SNMP::walk(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 463
2022/04/29 09:47:35 - SNMP The OID is '.1.3.6.1.2.1.2.2.1.1'
2022/04/29 09:47:35 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[118]:host_reload_query(), /host.php[618]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[813]:cacti_snmp_session_walk(),  /lib/snmp.php[463]:SNMP->walk(), CactiErrorHandler())
2022/04/29 09:47:35 - ERROR PHP WARNING: SNMP::walk(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 463
2022/04/29 09:47:35 - SNMP The OID is '.1.3.6.1.2.1.2.2.1.1'
2022/04/29 09:47:35 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[118]:host_reload_query(), /host.php[618]:run_data_query(),  /lib/data_query.php[106]:query_snmp_host(),  /lib/data_query.php[813]:cacti_snmp_session_walk(),  /lib/snmp.php[463]:SNMP->walk(), CactiErrorHandler())
2022/04/29 09:47:35 - ERROR PHP WARNING: SNMP::walk(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 463
2022/04/29 09:47:35 - SNMP The OID is '.1.3.6.1.2.1.2.2.1.1'
2022/04/29 09:47:31 - CMDPHP PHP ERROR WARNING Backtrace:   (/host.php[141]:api_device_ping_device(),  /lib/api_device.php[1330]:cacti_snmp_session_get(),  /lib/snmp.php[501]:SNMP->get(), CactiErrorHandler())
2022/04/29 09:47:31 - ERROR PHP WARNING: SNMP::get(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 501
2022/04/29 09:47:31 - SNMP The OID is '.1.3.6.1.2.1.1.1.0'

@TheWitness
Copy link
Member

Did update the $base_path/include/vendor/phpsnmp/classSNMP.php? Did you restart php-fpm as well as httpd?

@netniV
Copy link
Member

netniV commented Apr 30, 2022

You aren't logging info, just accessing it

@majed17
Copy link
Author

majed17 commented May 2, 2022

i restarted httpd anf php-fpm, the error persists but now i get:


2022/05/02 08:47:33 - SNMP The OID is '.1.3.6.1.2.1.1.1.0'
--
2022/05/02 08:47:29 - SNMP The OID is '.1.3.6.1.2.1.1.1.0'
2022/05/02 08:47:22 - SNMP The OID is '.1.3.6.1.2.1.1.1.0'

@majed17
Copy link
Author

majed17 commented May 2, 2022

my mistake, today is a holiday and so the host is down.. i tried another host and it is working!

@TheWitness
Copy link
Member

Okay, marking this closed. We will continue to tell users to uninstall php-snmp if they plan on polling using snmpv3 especially with advanced options such as yours. When I get some free time, I'll do a code contribution for the php guys maybe. Thanks for hanging in there. Cacti 1.2.21 coming out soon.

@majed17
Copy link
Author

majed17 commented May 2, 2022

thanks for constantly improving cacti, sadly your country banned us, almost totally, from contributing financially.

@TheWitness
Copy link
Member

Yea, that's some real BS. I'm not a big fan of waring around. Governments like to have control. The people just want to live their lives in peace, but the ruling class have to divide and profit on others suffering.

I was once asked which country bombed more countries since the end of WWII. I was surprised to see the US had bombed more than 40 far outstripping the next country. That was my red pill moment. The US has major blood on its hands in Iraq too. Too much detail for here.

Be well.

@netniV netniV changed the title Issues gathering snmp values on Fedora 35 using snmpv3 and php-snmp When running under Fedora, issues may be seen with snmp values May 15, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Nov 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour confirmed Bug is confirm by dev team resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

3 participants