[SNMP] GET CPU usage and memory usage

Setup /etc/snmp/snmpd.conf

view   systemonly  included   .1.3.6.1.4.1.2021.11
view   systemonly  included   .1.3.6.1.4.1.2021.4

Restart snmpd

service snmpd restart

We can get the result from snmpget or snmpwalk command

root@AG-192-168-98-28:~# snmpwalk -v2c -c public localhost 1.3.6.1.4.1.2021.4
UCD-SNMP-MIB::memIndex.0 = INTEGER: 0
UCD-SNMP-MIB::memErrorName.0 = STRING: swap
UCD-SNMP-MIB::memTotalSwap.0 = INTEGER: 3903484 kB
UCD-SNMP-MIB::memAvailSwap.0 = INTEGER: 3903484 kB
UCD-SNMP-MIB::memTotalReal.0 = INTEGER: 16434216 kB
UCD-SNMP-MIB::memAvailReal.0 = INTEGER: 10146564 kB
UCD-SNMP-MIB::memTotalFree.0 = INTEGER: 14050048 kB
UCD-SNMP-MIB::memMinimumSwap.0 = INTEGER: 16000 kB
UCD-SNMP-MIB::memShared.0 = INTEGER: 1296 kB
UCD-SNMP-MIB::memBuffer.0 = INTEGER: 452852 kB
UCD-SNMP-MIB::memCached.0 = INTEGER: 907872 kB
UCD-SNMP-MIB::memSwapError.0 = INTEGER: noError(0)
UCD-SNMP-MIB::memSwapErrorMsg.0 = STRING:
root@AG-192-168-98-28:~# snmpwalk -v2c -c public localhost 1.3.6.1.4.1.2021.11
UCD-SNMP-MIB::ssIndex.0 = INTEGER: 1
UCD-SNMP-MIB::ssErrorName.0 = STRING: systemStats
UCD-SNMP-MIB::ssCpuRawUser.0 = Counter32: 1896016
UCD-SNMP-MIB::ssCpuRawNice.0 = Counter32: 25470
UCD-SNMP-MIB::ssCpuRawSystem.0 = Counter32: 424044
UCD-SNMP-MIB::ssCpuRawIdle.0 = Counter32: 126362153
UCD-SNMP-MIB::ssCpuRawWait.0 = Counter32: 32674
UCD-SNMP-MIB::ssCpuRawKernel.0 = Counter32: 0
UCD-SNMP-MIB::ssCpuRawInterrupt.0 = Counter32: 1
UCD-SNMP-MIB::ssIORawSent.0 = Counter32: 85710718
UCD-SNMP-MIB::ssIORawReceived.0 = Counter32: 1442374
UCD-SNMP-MIB::ssRawInterrupts.0 = Counter32: 218127440
UCD-SNMP-MIB::ssRawContexts.0 = Counter32: 638628872
UCD-SNMP-MIB::ssCpuRawSoftIRQ.0 = Counter32: 11290
UCD-SNMP-MIB::ssRawSwapIn.0 = Counter32: 0
UCD-SNMP-MIB::ssRawSwapOut.0 = Counter32: 0
UCD-SNMP-MIB::ssCpuRawSteal.0 = Counter32: 0
UCD-SNMP-MIB::ssCpuRawGuest.0 = Counter32: 0
UCD-SNMP-MIB::ssCpuRawGuestNice.0 = Counter32: 0

Trouble shooting

snmpget

No more variables left in this MIB View (It is past the end of the MIB tree)

=> No value of this SNMP OID or no permission
Reference:
System Info: http://oidref.com/1.3.6.1.2.1.25.1
CPU usage: http://oidref.com/1.3.6.1.4.1.2021.11
Memory usage: http://oidref.com/1.3.6.1.4.1.2021.4

0
0 Comments
Inline Feedbacks
View all comments