| 1 |
cpumon.pl |
| 2 |
|
| 3 |
I use this script to monitor cpu usage on any process that |
| 4 |
maintains a pid file. Usage is very simple: |
| 5 |
|
| 6 |
cpumon.pl <pidfile> |
| 7 |
|
| 8 |
To install, first edit the "ps" and "psargs" variables as |
| 9 |
needed. I found it easier to have these defined rather than |
| 10 |
hardcoded due to differences between ucb-based and SysV-based |
| 11 |
ps functions. |
| 12 |
|
| 13 |
cpumon.pl will return the cpu usage of the pid in the pidfile |
| 14 |
you specify in the appropriate format for MRTG. For monitoring |
| 15 |
processes on remote machines that are not snmpable, I run this |
| 16 |
program out of inetd (so I can tcp_wrap it) on a high port. |
| 17 |
See http://www.blackened.com/ircstats/ for cpu monitoring |
| 18 |
examples. |
| 19 |
|
| 20 |
To run this from mrtg, the syntax would be like: |
| 21 |
|
| 22 |
Target[cpu]: `path/to/cpumon.pl /path/to/pidfile` |
| 23 |
|
| 24 |
Direct questions or suggestions to me. |
| 25 |
|
| 26 |
Have fun! |
| 27 |
|
| 28 |
-mjr <[email protected]> |
| 29 |
|
| 30 |
|
| 31 |
|