Cisco – Process Memory Usage

ciscocisco-iossnmp

I am trying to monitor a Cisco process memory usage. This is what I get with the command line:

show system internal processes memory | inc PID|ipfib
 PID TTY      STAT     TIME MAJFLT  TRS   RSS    VSZ %MEM COMMAND
 6069 ?        Ssl  00:14:01      0    0 169480 532812  1.0 /lc/isan/bin/ipfib

I want to use my SNMP poller to get this information, so far I have only found
1.3.6.1.4.1.9.9.109.1.2.1.1 has all the process names, pid, process usage.

All I need is the memory usage, but I can't find it.

Best Answer

I don't have a device with an ipfib process available, but assuming you're running IOS, the principles are the same no matter what the process name is...

Find the index for the process in question:

First, walk cpmProcessName and find the index... for instance, I'll look for "ARP Input"...

(py27_test)[mpenning@tsunami fast]$ snmpbulkwalk -v 2c -c public 10.1.1.1  \
  .1.3.6.1.4.1.9.9.109.1.2.1.1.2 | grep "ARP Input"
CISCO-PROCESS-MIB::cpmProcessName.1.12 = STRING: ARP Input
CISCO-PROCESS-MIB::cpmProcessName.1.239 = STRING: RARP Input
(py27_test)[mpenning@tsunami fast]$

We can see the index for the "ARP Input" process is 1.12...

All memory allocated:

Now let's find all the memory that was ever allocated to this process. We will do an snmpget on cpmProcExtMemAllocatedRev... be sure to append 1.12 to the cpmProcExtMemAllocatedRev OID...

(py27_test)[mpenning@tsunami fast]$ snmpget -v 2c -c public 10.1.1.1 \
  .1.3.6.1.4.1.9.9.109.1.2.3.1.1.1.12
CISCO-PROCESS-MIB::cpmProcExtMemAllocatedRev.1.12 = Gauge32: 1259940452 bytes
(py27_test)[mpenning@tsunami fast]$

cpmProcExtMemAllocatedRev is the sum of all memory ever allocated to the process; that means you'll have to subtract all memory that was ever freed from the process.

All memory freed:

To find all the memory that was ever freed, poll the cpmProcExtMemFreedRev OID, and append the index (1.12)...

(py27_test)[mpenning@tsunami fast]$ snmpget -v 2c -c public 10.1.1.1 \
  .1.3.6.1.4.1.9.9.109.1.2.3.1.2.1.12
CISCO-PROCESS-MIB::cpmProcExtMemFreedRev.1.12 = Gauge32: 1259931892 bytes
(py27_test)[mpenning@tsunami fast]$

Totals / math:

So the total memory used by my "ARP Input" process is:

AllocatedMem - FreedMem   = MemoryUsed

1259940452   - 1259931892 = *8560 Bytes*