Red Hat Bugzilla – Bug 1472852
systemd returns 0 prCount when net-snmpd collect number of running processes
Last modified: 2017-08-15 05:07:47 EDT
+++ This bug was initially created as a clone of Bug #1461666 +++
Description of problem:
Configure following lines in /etc/snmp/snmpd.conf,
in order to monitor number of runnig processes by net-snmp.
In case of systemd, the snmpd failed to collect number
of running processes.
In case of "other than systemd", the snmpd successfully
collect number of running processes.
Steps to Reproduce:
1. Add following 2 lines in /etc/snmp/snmpd.conf
2. Restart net-snmpd
# systemctl restart snmpd.service
3. Access MIB
snmpwalk -v 2c -c public 127.0.0.1 .184.108.40.206.4.1.2021.2
# snmpwalk -v 2c -c public 127.0.0.1 .220.127.116.11.4.1.2021.2
UCD-SNMP-MIB::prIndex.1 = INTEGER: 1
UCD-SNMP-MIB::prIndex.2 = INTEGER: 2
UCD-SNMP-MIB::prNames.1 = STRING: systemd
UCD-SNMP-MIB::prNames.2 = STRING: sshd
UCD-SNMP-MIB::prMin.1 = INTEGER: 1
UCD-SNMP-MIB::prMin.2 = INTEGER: 1
UCD-SNMP-MIB::prMax.1 = INTEGER: 0
UCD-SNMP-MIB::prMax.2 = INTEGER: 0
UCD-SNMP-MIB::prCount.1 = INTEGER: 0 <== Always 0
UCD-SNMP-MIB::prCount.2 = INTEGER: 8 <== Expected
UCD-SNMP-MIB::prErrorFlag.1 = INTEGER: error(1) <= Not expected
UCD-SNMP-MIB::prErrorFlag.2 = INTEGER: noError(0)
UCD-SNMP-MIB::prErrMessage.1 = STRING: No systemd process running <= not expected
UCD-SNMP-MIB::prErrMessage.2 = STRING:
UCD-SNMP-MIB::prErrFix.1 = INTEGER: noError(0)
UCD-SNMP-MIB::prErrFix.2 = INTEGER: noError(0)
UCD-SNMP-MIB::prErrFixCmd.1 = STRING:
UCD-SNMP-MIB::prErrFixCmd.2 = STRING:
prCount for systemd should be same as running systemd processes.
Same test on Fedora 24, the prCount for systemd is 1.
Judging from these test result, I suspect something wrong
wrong with systemd-219 side.
--- Additional comment from Lukáš Nykrýn on 2017-06-15 07:27:58 EDT ---
Well I know nothing about net-snmp especially how it determines running processes.
ALso the results on fedora looks fishy, since systemd runs as one process.
Reassigning to net-snmp, so someone more qualified in this area could check it.
--- Additional comment from Josef Ridky on 2017-07-19 10:03 EDT ---
I apologize for later answer.
Here is proposed patch, which solves described problem.
Issue was caused by wrongly used iterator, which iterates thru net-snmp structure and always ignore first record.
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle.
Changing version to '27'.