0

I am trying to get performance from network interfaces from network device (mikrotik, cisco routers etc.) about interface traffic via SNMP poll and send those data to Azure Monitor Log Analytics.

I have installed and working Azure Log Analytics agent on Debian Linux, https://docs.microsoft.com/en-us/azure/azure-monitor/agents/agent-linux and working Syslog monitoring https://docs.microsoft.com/en-us/azure/azure-monitor/agents/data-sources-syslog

However, I am unable to find a good example of CollectD configuration file using SNMP plugin and how to send those performance data to Azure Monitor service https://docs.microsoft.com/en-us/azure/azure-monitor/agents/data-sources-collectd

https://collectd.org/wiki/index.php/Plugin:SNMP

If somebody can share CollectD configuration files using SNMP CollectD plugin and sending this performance data to Azure Monitor? Or how to troubleshoot CollectD service with SNMP plugin? Or any other free software (on Linux or Windows) which can do SNMP pull (and SNMP trap) and supports sending data to Azure Monitor I would be thankful.

Hrvoje Kusulja
  • 254
  • 1
  • 11

1 Answers1

0

This page seems to give clear instructions on how to get CollectD to write to the Azure agent: https://docs.microsoft.com/en-us/azure/azure-monitor/agents/data-sources-collectd

These pages (here and enter link description here) seem to have pretty clear config with examples for polling various device types.

Can you share some of the errors that you're encountering? There's also the Linux snmpwalk tool that might help with debugging SNMP? I think I used it a long time ago to set things up, testing all the strings were correct.

UPDATE:

I've done the following to test on an EC2 instance so far, and can get CollectD to print out what it finds from SNMP. I'd suggest you get this working and then move on to pushing to Azure.

  1. Boot Amazon Linux
  2. Install net-snmp and net-snmp-utils
  3. Install collectd and collectd-snmp
  4. Create configs
  5. Start snmpd service
  6. Test snmpwalk
  7. Test collectd

Install Commands:

amazon-linux-extras install collectd
yum install -y net-snmp net-snmp-utils collectd-snmp

Config:

/etc/snmp/snmpd.conf:

com2sec AllUser default changeme
group AllGroup v2c AllUser
view SystemView included .1.3.6.1.2.1.1
view SystemView included .1.3.6.1.2.1.25.1.1
view AllView included .1
access AllGroup "" any noauth exact AllView none none
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
dontLogTCPWrappersConnects yes

/etc/collectd.conf:

Hostname    "localhost"
FQDNLookup   true
BaseDir     "/var/lib/collectd"
PIDFile     "/var/run/collectd.pid"
PluginDir   "/usr/lib64/collectd"
TypesDB     "/usr/share/collectd/types.db"
LoadPlugin logfile

<Plugin logfile>
    LogLevel info
    File STDOUT
    Timestamp true
    PrintSeverity false
</Plugin>

# LoadPlugin cpu
# LoadPlugin interface
# LoadPlugin load
# LoadPlugin memory
LoadPlugin snmp
LoadPlugin write_log

<Plugin snmp>
   <Data "hr_processes">
      Type "gauge"
      Table false
      Instance ""
      Shift -1
      Values "HOST-RESOURCES-MIB::hrSystemProcesses.0"
   </Data>

   <Host "localhost">
       Address "localhost"
       Version 2
       Community "changeme"
       Collect "std_traffic" "hr_processes"
   </Host>
</Plugin>

Include "/etc/collectd.d"

Command outputs:

# snmpwalk -v 2c -c changeme -O e localhost | grep hrSystemProcesses
HOST-RESOURCES-MIB::hrSystemProcesses.0 = Gauge32: 95
HOST-RESOURCES-MIB::hrSWRunParameters.32729 = STRING: "--color=auto hrSystemProcesses"

# collectd -f  -C /etc/collectd.conf
[2022-01-11 12:34:32] plugin_load: plugin "logfile" successfully loaded.
[2022-01-11 12:34:32] plugin_load: plugin "snmp" successfully loaded.
[2022-01-11 12:34:32] plugin_load: plugin "write_log" successfully loaded.
[2022-01-11 12:34:32] snmp plugin: No such data configured: `std_traffic'
[2022-01-11 12:34:32] Initialization complete, entering read-loop.
[2022-01-11 12:34:32] write_log values:
localhost.snmp.gauge 94 1641904472

^C[2022-01-11 12:34:34] Exiting normally.
[2022-01-11 12:34:34] collectd: Stopping 5 read threads.
[2022-01-11 12:34:34] collectd: Stopping 5 write threads.
shearn89
  • 3,143
  • 2
  • 14
  • 39
  • Hello, thank you for your comment, but I have already provided all those links. However it does not work, no errors. I need help to troubleshoot collectd, to confirm that it recieved snmp data and that it sent it to azure. snmpwalk from the same machine - works. – Hrvoje Kusulja Jan 11 '22 at 10:44
  • Also, as I wrote I am quering local network device / router which has SNMP enabled and working (checked with snmpwalk) , not on linux/localhost. Also mentioned Microsoft instructions are out of date, and their support says it is out of their scope of support (for collectd). Can you provide information on how to troubleshoot collectd behaviur and collecting the snmp data? – Hrvoje Kusulja Jan 17 '22 at 07:01
  • Okay - the example I gave was just an example, regardless of the device being monitored getting collectd to log should be the same. The configuration I provided for CollectD also shows how to log to the system log or stdout, which is what I used to get it working. I'd start there. – shearn89 Jan 17 '22 at 08:33
  • which exactly log file? or how to monitor stdout of collectd due to snmp pool-ing? – Hrvoje Kusulja Jan 18 '22 at 12:01