Retrieving platform state information with SNMP
This task describes how to retrieve IAS hardware and software registries, opened and closed issues, and events using SNMP. snmpget, snmptable, and snmpwalk are used to retrieve IAS state.
Before you begin
- IAS has to have
snmpd.service
up and running. - User needs to get credentials, which will allow to communicate with
snmpd.service
. - User needs to start SNMP sub-agent, which is responsible for responding to requests.
Procedure
-
Verify that
snmpd.service
is up and running on IAS:[apuser@node0101 root]$ service snmpd 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 Fri 2019-07-12 11:29:22 UTC; 3 weeks 4 days ago Main PID: 172815 (snmpd) Tasks: 1 Memory: 11.3M CGroup: /system.slice/snmpd.service └─172815 /usr/sbin/snmpd -LS0-6d -f
- Get the credentials, which will allow to communicate with
snmpd.service
:Note: Superuser access in required for this step.- From the output of the service snmpd status command in the previous
step, you can read that
snmpd
was started with default configuration file snmpd.conf which is located in /etc/snmp/(172815 /usr/sbin/snmpd -LS0-6d -f). If there was -C -c /root/.snmp/snmpd.conf, it would mean that the service reads configuration from the file located in /root/.snmp/, omitting the one located in /etc/snmp/. - Find the file that is used for configuration on your system, and search for the lines
beginning with
rocommunity
. There is a community string defined, which allows to requestsnmpd.service
:[root@node0101 ~]# grep -m 1 rocommunity /etc/snmp/snmpd.conf rocommunity ****** <some_ip> default
Community strings were masked on the above snippet intentionally.
Attention: If you need to add a directive in the /etc/snmp/snmpd.conf file, which specifies the creation of users who can be used in SNMPv3 requests, consider developing backing-up scripts. The backing-up scripts are needed because appliance upgrade procedures overwrite the /etc/snmp/snmpd.conf file and restore its default content.Another recommended way of managing SNMP users is through the
snmpusm
application. Note that even with thesnmpusm
application post-upgrade settings restoration is required.Tip: For more information, you are suggested to read manual pagessnmpusm(1)
, and theSNMPv3 USM Users
section ofsnmpd.conf(5)
.
- From the output of the service snmpd status command in the previous
step, you can read that
- Start SNMP sub-agent, which is responsible for responding to requests:
Inventory retrieving is provided by SNMP sub-agent called
magneto-snmp-agent.service
, which should be up and running on IAS. The main daemonsnmpd.service
will delegate SNMP requests aiming the OIDs defined in IIAS-MIB module to the sub-agent. You use the apsnmpagent utility to manage the state of the sub-agent. Note that it allows you to switch on/switch off the sub-agent and the mainsnmpd.service
as well. Use it carefully to avoid stoppingsnmpd.service
by mistake.To enable and startsnmpd.service
after using the command apsnmpagent, run the command with optional argument--snmpd_only
or-s
as follows:
In the above example, the first command stops and disables services'apsnmpagent off && apsnmpagent on --snmpd_only'
magneto-snmp-agent
andsnmpd
, and the second command enables and startssnmpd
.Called with argument
state
, apsnmpagent collects information ifmagneto-snmp-agent
is enabled on all nodes of hadomain1. If its state is inconsistent, a proper information is printed. apsnmpagent acts on all active nodes of hadomain1. - Use Net-SNMP snmptable application to retrieve tables defined in
IIAS-MIB.txt. IIAS-MIB.txt is located in
/usr/share/snmp/mibs. You can use snmptranslate -Tp -IR
IIAS-MIB::iias to see its structure as a tree. A node called
applianceTables
contains defined tables which could be used to retrieve system state provided by the ap command with different arguments. The following table shows the mapping:Option Description hwInventoryTable ap hw -d softwareTable ap sw -d openIssuesTable ap issues closedIssuesTable ap issues -c eventsTable ap issues -e nodesTable ap node -d dfSharedTable ap df dfLocalTable ap df gpfsFilesystemTable ap fs fsMountTable ap fs Tip: It might be convenient to use-Cl
optional argument in snmptable command to set 'left justify' to the output.Using snmpget withhwInventoryTable
, you can get the 'details' column, where useful information is gathered in a in comma-separated format. For example, you can find node average power consumption:[root@node0101 ~]# snmpwalk -v2c -c $(grep rocommunity -m 1 /etc/snmp/snmpd.conf | cut -d' ' -f2) localhost IIAS-MIB::hwUnitDetails.\"hadomain1\".\"node1\".\"\" IIAS-MIB::hwUnitDetails."hadomain1"."node1"."" = STRING: cpu_clock_exp:3325.0MHz,inlet_temp_celsius:21,power:on,unrecoverable_events:0,cpu_clock_avg:3325.0MHz, led:on,base_temp1_celsius:28,cpu_clock_tuned:active,cpu_smt_config:SMT=4,memsize:512GB,cpu_cores_enab:24, position:P1,avgpwr:650 Watts,base_temp3_celsius:33,base_temp2_celsius:35