Does a SNMP call to get CPU usage for a Linux box eventually just read the /proc/stat file?
Linux – How does SNMP get CPU usage on Linux
linuxsnmp
linuxsnmp
Does a SNMP call to get CPU usage for a Linux box eventually just read the /proc/stat file?
Best Answer
Sigh1. Fortunately you don't need
/proc/stat
man 5 proc
:But you probably need to consult the source for http://www.net-snmp.org/ to determine what they actually use:
net-snmp-5.7.3/agent/mibgroup/ucd-snmp/loadave.c :
Footnote 1. Sometimes you really can't chose who you work with.
In response to your comments, again, sigh. Since only the kernel is aware of what it is actually doing, any monitoring will, one way or the other, need to interact with the kernel to retrieve such information. The common interface to interact with the kernel is
/proc/
although other methods can be contrived as well (auditd
andkerneltap
come to mind). But those are hardly "more lightweight" at all....There will always be a certain amount of observer effect and impact caused by monitoring.
The only zero impact method is not to do any monitoring at all. And then whoever has pager duty can claim that since no alerts were observed the system isn't down either.
I would call that a win!