New to Cacti - Remotely monitor memory/process of a process

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
infomine2
Posts: 2
Joined: Mon May 30, 2011 2:33 pm

New to Cacti - Remotely monitor memory/process of a process

Post by infomine2 »

Hey all,

I'm extremely new to using Cacti - that is, I have my servers graphed, and have managed to get most of the stuff I wanted monitored, well monitored. But I have no idea how to fine tune, or get more detail out of this tool.

What I'm after: I want to be able to monitor a random (in house developed) process and know how much CPU and memory it's consuming.

I'm assuming from what I was running into on Google, that this (or something similar) is possible? Or at least I found out how to count how many instances of a process are running with "snmpwalk -v 1 -c public 10.2.55.3 | grep -c serv" via a script.

Any suggestions / pointers?

It'll be much appreciated!
kdkanda
Posts: 1
Joined: Tue May 31, 2011 3:03 am

Re: New to Cacti - Remotely monitor memory/process of a proc

Post by kdkanda »

Hi

I am also looking for similar solution .
I have multiple ubuntu servers and need to collect metrics of our server container .
top -b -n 1 |grep "server_containe" |awk '{print $9}'
it will be great if some one can point me to right template or script .

Thanks in Advance
KK
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: New to Cacti - Remotely monitor memory/process of a proc

Post by noname »

Please configure snmpd.conf on target server so that Cacti can retrieve information via SNMP from that server.

- Extending the SNMP Agent - Cacti Docs
- Manpage of SNMPD.CONF - EXTENDING AGENT FUNCTIONALITY
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: New to Cacti - Remotely monitor memory/process of a proc

Post by noname »

This is useless information. :P

In HOST-RESOURCES-MIB, "hrSWRun" & "hrSWRunPerf" subtrees return information about resources per process.

For example:

Code: Select all

% ps -eo pid,user,pcpu,pmem,fname,args
  PID     USER %CPU %MEM COMMAND  COMMAND
    0     root  0.0  0.0 sched    sched
    1     root  0.0  0.2 init     /sbin/init
    2     root  0.0  0.0 pageout  pageout
    3     root  0.1  0.0 fsflush  fsflush
    7     root  0.0  0.5 svc.star /lib/svc/bin/svc.startd
    9     root  0.0  0.5 svc.conf /lib/svc/bin/svc.configd
  ...

% snmpwalk -v1 -c public localhost .1.3.6.1.2.1.25.4
HOST-RESOURCES-MIB::hrSWRunIndex.0 = INTEGER: 0
HOST-RESOURCES-MIB::hrSWRunIndex.1 = INTEGER: 1
HOST-RESOURCES-MIB::hrSWRunIndex.2 = INTEGER: 2
HOST-RESOURCES-MIB::hrSWRunIndex.3 = INTEGER: 3
HOST-RESOURCES-MIB::hrSWRunIndex.7 = INTEGER: 7
HOST-RESOURCES-MIB::hrSWRunIndex.9 = INTEGER: 9
...
HOST-RESOURCES-MIB::hrSWRunName.0 = STRING: "sched"
HOST-RESOURCES-MIB::hrSWRunName.1 = STRING: "init"
HOST-RESOURCES-MIB::hrSWRunName.2 = STRING: "pageout"
HOST-RESOURCES-MIB::hrSWRunName.3 = STRING: "fsflush"
HOST-RESOURCES-MIB::hrSWRunName.7 = STRING: "svc.startd"
HOST-RESOURCES-MIB::hrSWRunName.9 = STRING: "svc.configd"
...

% snmpwalk -v1 -c public localhost .1.3.6.1.2.1.25.5
HOST-RESOURCES-MIB::hrSWRunPerfCPU.0 = INTEGER: 1377
HOST-RESOURCES-MIB::hrSWRunPerfCPU.1 = INTEGER: 48314
HOST-RESOURCES-MIB::hrSWRunPerfCPU.2 = INTEGER: 32201
HOST-RESOURCES-MIB::hrSWRunPerfCPU.3 = INTEGER: 957033
HOST-RESOURCES-MIB::hrSWRunPerfCPU.7 = INTEGER: 22592
HOST-RESOURCES-MIB::hrSWRunPerfCPU.9 = INTEGER: 30053
...
HOST-RESOURCES-MIB::hrSWRunPerfMem.0 = INTEGER: 0 KBytes
HOST-RESOURCES-MIB::hrSWRunPerfMem.1 = INTEGER: 472 KBytes
HOST-RESOURCES-MIB::hrSWRunPerfMem.2 = INTEGER: 0 KBytes
HOST-RESOURCES-MIB::hrSWRunPerfMem.3 = INTEGER: 0 KBytes
HOST-RESOURCES-MIB::hrSWRunPerfMem.7 = INTEGER: 1248 KBytes
HOST-RESOURCES-MIB::hrSWRunPerfMem.9 = INTEGER: 1200 KBytes
...
But it seems these information are based on their process IDs,
probably index number (=PID) will be changed at each time your process is invoked..
infomine2
Posts: 2
Joined: Mon May 30, 2011 2:33 pm

Re: New to Cacti - Remotely monitor memory/process of a proc

Post by infomine2 »

So would it be possible to have a script that calls:

Code: Select all

snmpwalk -v 1 -c public 10.2.55.3 | grep -c serv
And then takes the output and retrieves the process ID? If we say the ID was 77, then could what noname suggests work?

Code: Select all

% snmpwalk -v1 -c public localhost .1.3.6.1.2.1.25.5
HOST-RESOURCES-MIB::hrSWRunPerfCPU.0 = INTEGER: 1377
HOST-RESOURCES-MIB::hrSWRunPerfCPU.1 = INTEGER: 48314
HOST-RESOURCES-MIB::hrSWRunPerfCPU.2 = INTEGER: 32201
HOST-RESOURCES-MIB::hrSWRunPerfCPU.3 = INTEGER: 957033
HOST-RESOURCES-MIB::hrSWRunPerfCPU.7 = INTEGER: 22592
HOST-RESOURCES-MIB::hrSWRunPerfCPU.9 = INTEGER: 30053
...
HOST-RESOURCES-MIB::hrSWRunPerfMem.0 = INTEGER: 0 KBytes
HOST-RESOURCES-MIB::hrSWRunPerfMem.1 = INTEGER: 472 KBytes
HOST-RESOURCES-MIB::hrSWRunPerfMem.2 = INTEGER: 0 KBytes
HOST-RESOURCES-MIB::hrSWRunPerfMem.3 = INTEGER: 0 KBytes
HOST-RESOURCES-MIB::hrSWRunPerfMem.7 = INTEGER: 1248 KBytes
HOST-RESOURCES-MIB::hrSWRunPerfMem.9 = INTEGER: 1200 KBytes
With that the changing process ID wouldn't matter? Not too sure though.
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: New to Cacti - Remotely monitor memory/process of a proc

Post by noname »

>> If we say the ID was 77, then could what noname suggests work?

Probably you can do that -- as far as you know what ID of the process is, and the ID is unchanged all the time.

For example, it looks like this:

Code: Select all

% snmpwalk -v1 -c public 10.2.55.3 .1.3.6.1.2.1.25.4.2.1.2.77
HOST-RESOURCES-MIB::hrSWRunName.77 = STRING: "serv"

% snmpwalk -v1 -c public 10.2.55.3 .1.3.6.1.2.1.25.5.1.1.1.77
HOST-RESOURCES-MIB::hrSWRunPerfCPU.77 = INTEGER: 2554

% snmpwalk -v1 -c public 10.2.55.3 .1.3.6.1.2.1.25.5.1.1.2.77
HOST-RESOURCES-MIB::hrSWRunPerfMem.77 = INTEGER: 1152 KBytes
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest