Enabling the SNMP interface to retrieve hardware information

You can configure Platform Manager to send hardware metrics and other details to any data center management system via SNMP interface.

Before you begin

  • Ensure that netsnmpagent is installed in your system. To verify, run the command:
    pip freeze | grep netsnmpagent
    
  • Ensure that snmpd.service is in Active state on control nodes:
    [apuser@e1n1 root]$ service snmpd.service status
    Redirecting to /bin/systemctl status snmpd.service
    ● snmpd.service - Simple Network Management Protocol (SNMP) Daemon.
       Loaded: loaded (/usr/lib/systemd/system/snmpd.service; enabled; vendor preset: disabled)
       Active: active (running) since Thu 2019-06-13 13:58:59 CEST; 2 weeks 6 days ago
     Main PID: 24535 (snmpd)
        Tasks: 1
       Memory: 14.4M
       CGroup: /system.slice/snmpd.service
               └─24535 /usr/sbin/snmpd -LS0-6d -f
  • firewalld must allow traffic on ports 161 and 162 which are used by snmpd. These ports are open by default. You can verify with the following command, the ports should be listed as in the example:
    [root@e1n1 ~]# DEFAULT_ZONE=$(grep DefaultZone /etc/firewalld/firewalld.conf | cut -d= -f2); grep -A 4 ‘<!--SNMP-->’ /etc/firewalld/zones/$DEFAULT_ZONE.xml
    <!--SNMP-->
    <port protocol="tcp" port="161"/>
    <port protocol="udp" port="161"/>
    <port protocol="tcp" port="162"/>
    <port protocol="udp" port="162"/>

About this task

The SNMP interface is disabled by default. You can use apsnmpagent command to manage its state:
apsnmpagent [-h] {on,off,state}

Enables or disables snmpd.service and magneto-snmp-agent.service on all accessible nodes of hadomain1.

positional arguments:
  {on,off,state}    Performs enabling/starting, stopping/disabling or checks if snmpd
                    and magneto-snmp-agent services have consistent state on accessible nodes of hadomain1.
                    options:
                    on    - enables and starts services
                    off   - stops and disables services
                    state - collects state of magneto-snmp-agent and snmpd services

optional arguments:
  -h, --help        show this help message and exit
  -s, --snmpd_only  Modifies positional argument. If given, action applied only against snmpd.service.

You can use the ap config --set snmp to configure SNMP traps as described in Configuring SNMP trap notifications.

The MIB file (Management Information Base - the file that describes the properties of managed resources and the services that the agent supports) is available in /usr/share/snmp/mibs/IBM-GT-MIB.txt on every node.

SNMP traps support all alerts that are listed with the following command:
ap issues --show_registry

Troubleshooting:

  • The ap issues <issue id> command output includes the section where the reason for SNMP configuration failure might be listed:
    Processing Status
    	State                    : CLOSED
    	Log Collection Status    : COLLECTED
    	SMTP Status              : NOT_APPLICABLE
    	SNMP Status              : FAILED
    	SNMP Failure Reason      : Incomplete SNMP configuration. Missing: snmp_auth_key
    	Call Home Status         : NOT_APPLICABLE
  • You can use the ap config --test snmp command to test if the SNMP configuration is correct and send a test SNMP notification. The following example shows a failed run, as on the host there was no service to receive the notification and respond:
    [root@e1n1 ~]# ap config --set snmp --snmp_version 3 --snmp_notification_type inform --snmp_auth_key auth.md5 --snmp_auth_protocol 1
    Updated successfully
    [root@e1n1 ~]# ap config --test snmp
    SNMP connectivity test: FAILED. localhost:33162 - "Timeout"
    [root@e1n1 ~]# 
    A successful run looks like the following:
    [root@e1n1 ~]# ap config --test snmp
    2021-07-16 14:19:00
    SNMP connectivity test: SUCCESS. Note: INFORMs are acknowledged, successfully delivered.
    [root@e1n1 ~]#