SNMP version population problem

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
dma_k
Posts: 47
Joined: Thu Aug 07, 2008 6:56 am
Contact:

SNMP version population problem

Post by dma_k »

After migration from v0.8.8 to v1.2.16 I've noticed that all SNMP sources are not populated anymore due to this error:

Code: Select all

04/07/2021 10:50:01 - POLLER: Poller[1] Device[3] DS[32] ERROR: Invalid SNMP Data Source.  Please either delete it from the database, or correct it.
04/07/2021 10:50:01 - POLLER: Poller[1] Device[3] DS[32] TT[0.06] SNMP: v0: 127.0.0.1, dsname: cache_objects, oid: .1.3.6.1.4.1.3495.1.3.1.7.0, output: U
Here is the corresponding code snippet from cmd.php:

Code: Select all

725                 if (($item['snmp_version'] == 0) || (($item['snmp_community'] == '') && ($item['snmp_version'] != 3))) {
726                     cacti_log("Device[$host_id] DS[$data_source] ERROR: Invalid SNMP Data Source. Please either delete it from the database, or correct it.", $print_data_to_stdout, 'POLLER');
727                     $output = 'U';                        
728                 }else {                                   
I have checked that the reason is that $item['snmp_version'] == 0 in that expression.

I have opened the give datasource (/data_sources.php?action=ds_edit&id=32) and clicked on "Edit Data Template" in top right corner and that is what I see:
cacti_1.png
cacti_1.png (44.5 KiB) Viewed 5860 times
so SNMP Version is defined but does not find it's way to $item['snmp_version']. Note that in Configuration → Settings → Device Defaults tab → SNMP Defaults → Version I don't have the version set, but above should work fine without it being set.

P.S. I have rerun Utilities → System Utilities → Rebuild Poller Cache but the issue is still there.
dma_k
Posts: 47
Joined: Thu Aug 07, 2008 6:56 am
Contact:

Re: SNMP version population problem

Post by dma_k »

I took a look at this problem again, and I think the issue is in the way how host and poller_item are joined. In particular Cacti executes this query:

Code: Select all

SELECT SQL_NO_CACHE * FROM poller_item AS pi LEFT JOIN host AS h ON h.id = pi.host_id WHERE pi.poller_id = '1' AND (h.disabled = "" OR h.disabled IS NULL) AND pi.host_id >= '3' AND pi.host_id <= '3' AND pi.rrd_next_step <= 0 ORDER by pi.host_id
As a result the value of $item['snmp_version'] is unpredictable (in cmd.php:725 above) because there is host.snmp_version and poller_item.snmp_version in result so believe the first one is picked up. I believe that if the value "Not in use" in Device settings means that the value is overridden by Data Source but it looks that does not happen. I've changed SNMP Version to 2 for the device, and the warning Poller[1] Device[3] DS[32] ERROR: Invalid SNMP Data Source. Please either delete it from the database, or correct it is gone but it started to use the port from Device settings (161 instead of 3401) so that one also needed to be updated.

Can somebody put a light on that?
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: SNMP version population problem

Post by netniV »

I would double check but I think this has been fixed in later versions. You should search in the repo on GitHub
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests