How to monitor systemd service with snmp?

So I have a Gunicorn service on my Ubuntu server.

First I added proc gunicorn to this file: /etc/snmp/snmpd.conf.
But I'm not sure how to get the right values.

I've seen this question (How to monitor services with SNMP?) and tried this command snmpwalk -v 2c -c public localhost 1.3.6.1.2.1.25.4.2.1.2 but I got this message:

HOST-RESOURCES-MIB::hrSWRunName = No more variables left in this MIB View (It is past the end of the MIB tree)

So I guess the OID is wrong or I have other configurations.
How can I get the status of my services with snmp?


Solution 1:

Maybe you are not able to see the corresponding output for process monitoring because of the snmpd daemon configuration (/etc/snmp/snmpd.conf)

# As shipped, the snmpd demon will only respond to queries on the
# system mib group until this file is replaced or modified for
# security purposes. 

For debugging purpose only, you can configure the access control to be full open by editing /etc/snmp/snmpd.conf.

#       name           incl/excl     subtree         mask(optional)
view    allview      included   .1

#       group          context sec.model sec.level prefix read   write  notif
access  notConfigGroup ""      any       noauth    exact  allview none none

Then restart the snmpd daemon.

systemctl restart snmpd

This is for debugging purpose only, for production the access control should be tuned to be less permissive.