How to monitor services with SNMP?

12,254

The zeroes reported in OIDs below 1.3.6.1.4.1.2021.2.1.100 actually mean that everything is alright and non-zero would indicate an error.

For future reference: OIDs below 1.3.6.1.4.1.2021.2.1.101 give further information in case of an error.

Share:
12,254

Related videos on Youtube

Sethos II
Author by

Sethos II

Updated on September 18, 2022

Comments

  • Sethos II
    Sethos II over 1 year

    I want to monitor the status of several services via SNMP.

    The manpage says:

    proc NAME [MAX [MIN]]
                  monitors the number of processes called NAME (as reported by "/bin/ps -e") running on the local system.
    

    So I added these lines to /etc/snmp/snmpd.conf:

    proc smbd
    proc nfsd
    

    but the corresponding OIDs still return zero:

    iso.3.6.1.4.1.2021.2.1.100.4 = INTEGER: 0
    iso.3.6.1.4.1.2021.2.1.100.5 = INTEGER: 0
    

    allthough ps -e shows smbd and nfsd processes:

    > ps -e | grep "smbd\|nfsd"
     8267 ?        00:00:01 smbd
    10179 ?        00:00:04 smbd
    11068 ?        00:00:00 nfsd4_callbacks
    11072 ?        00:12:53 nfsd
    11073 ?        00:13:33 nfsd
    11074 ?        00:14:35 nfsd
    11075 ?        00:16:23 nfsd
    11076 ?        00:21:52 nfsd
    11077 ?        00:33:34 nfsd
    11078 ?        00:48:10 nfsd
    11079 ?        01:02:44 nfsd
    15135 ?        00:00:03 smbd
    15137 ?        00:00:17 smbd
    15141 ?        00:00:05 smbd
    20603 ?        00:00:00 smbd
    

    I'm also able to get the list of running processes with OID 1.3.6.1.2.1.25.4.2.1.2 which also contains smbd and nfsd processes:

    > snmpwalk -v 2c -c secret host 1.3.6.1.2.1.25.4.2.1.2 | grep "smbd\|nfsd"
    iso.3.6.1.2.1.25.4.2.1.2.11068 = STRING: "nfsd4_callbacks"
    iso.3.6.1.2.1.25.4.2.1.2.11072 = STRING: "nfsd"
    iso.3.6.1.2.1.25.4.2.1.2.11073 = STRING: "nfsd"
    iso.3.6.1.2.1.25.4.2.1.2.11074 = STRING: "nfsd"
    iso.3.6.1.2.1.25.4.2.1.2.11075 = STRING: "nfsd"
    iso.3.6.1.2.1.25.4.2.1.2.11076 = STRING: "nfsd"
    iso.3.6.1.2.1.25.4.2.1.2.11077 = STRING: "nfsd"
    iso.3.6.1.2.1.25.4.2.1.2.11078 = STRING: "nfsd"
    iso.3.6.1.2.1.25.4.2.1.2.11079 = STRING: "nfsd"
    iso.3.6.1.2.1.25.4.2.1.2.11724 = STRING: "smbd"
    iso.3.6.1.2.1.25.4.2.1.2.12367 = STRING: "smbd"
    iso.3.6.1.2.1.25.4.2.1.2.15135 = STRING: "smbd"
    iso.3.6.1.2.1.25.4.2.1.2.15137 = STRING: "smbd"
    iso.3.6.1.2.1.25.4.2.1.2.15141 = STRING: "smbd"
    iso.3.6.1.2.1.25.4.2.1.2.29897 = STRING: "smbd"
    

    Is it supposed to work like this and is monitoring services with the proc directive of SNMP a good idea or should I use extends (already got them working for ZFS and SLURM status)?

    Environement:

    • NET-SNMP 5.7.3
    • Ubuntu Server 16.04