Thursday, September 13, 2018

debian - Cacti not working for SNMP data sources




I installed packages cacti and snmpd on a Debian server. I'm able to display common graphs in Cacti (such as memory usage, load average, logged in users, etc) using the data templates listed as Unix. Now I want to replace these graphs with new ones using SNMP data sources, because I see there is also CPU usage and because it's not excluded I have to manage multiple hosts in the future.



So, I installed snmpd on the machine and left the snmpd.conf as it is. In Cacti, I created three new data sources from SNMP templates for 127.0.0.1 host:




  • ucd/net - CPU Usage - Nice

  • ucd/net - CPU Usage - System

  • ucd/net - CPU Usage - User




Then I created a new graph from template ucd/net - CPU Usage, and select the three data sources in the Graph Item Fields section. Graph is now enabled and running, but empty. No data have been collected.



Under Console -> Devices my SNMP host is listed as up and running:



System:Linux ip-xx-xx-xxx-xxx 3.2.0-23-virtual #36-Ubuntu SMP Tue Apr 10 22:29:03 UTC 2012 x86_64
Uptime: 929267 (0 days, 2 hours, 34 minutes)
Hostname: ip-xx-xx-xxx-xxx
Location: Sitting on the Dock of the Bay
Contact: Me me@example.org



In SNMP Options I left all as it is:




  • SNMP Version: Version 1

  • SNMP Community: public

  • SNMP Timeout: 500 ms

  • Maximum OID's Per Get Request: 10




In Console -> Utilities -> Cacti Log I have multiple warning (two for each data source) every 5 minutes:



10/29/2012 01:45:01 PM - CMDPHP: Poller[0] Host[2] DS[18] WARNING: Result from SNMP not valid. Partial Result: U
10/29/2012 01:45:01 PM - CMDPHP: Poller[0] WARNING: SNMP Get Timeout for Host:'127.0.0.1', and OID:'.1.3.6.1.4.1.2021.4.15.0'
10/29/2012 01:45:01 PM - CMDPHP: Poller[0] Host[1] DS[9] WARNING: Result from SNMP not valid. Partial Result: U
10/29/2012 01:45:01 PM - CMDPHP: Poller[0] WARNING: SNMP Get Timeout for Host:'127.0.0.1', and OID:'.1.3.6.1.4.1.2021.11.52.0'
10/29/2012 01:40:01 PM - CMDPHP: Poller[0] Host[2] DS[19] WARNING: Result from SNMP not valid. Partial Result: U
10/29/2012 01:40:01 PM - CMDPHP: Poller[0] WARNING: SNMP Get Timeout for Host:'127.0.0.1', and OID:'.1.3.6.1.4.1.2021.4.6.0'
[...]



I have the feeling I'm missing something, but I cannot get it...


Answer



Could you try this command (OID is from Cacti log):



SNMPv1:



  $ snmpwalk -Cc -On -v 1 -c public 127.0.0.1 1.3.6.1.4.1.2021.11.52.0



SNMPv2c: Nowadays is very common SNMPv2c as default, so also try.



  $ snmpwalk -Cc -On -v 1 -c public 127.0.0.1 1.3.6.1.4.1.2021.11.52.0


Also, try changing COMMUNITY and/or IP ADDRESS to local network instead loopback.



If you don't get a result like .1.3.6.1.4.1.2021.11.52.0 = Counter32: 250038, then edit /etc/snmp/snmpd.conf adding or decommenting:



rocommunity public  localhost 



And restart snmpd using one of:



/etc/init.d/snmpd restart
service snmpd restart

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...