How to add process info (like from top) in cpu alert email?
Posted: Tue May 17, 2016 5:34 pm
Is there a way to add the output from the "top" command to an email alert? We currently use nrpe to monitor Linux systems.
For example, when cpu or load crosses a threshold, I would like to include the output of something like this:
top -cSbn 1 | head -14 | tail -8
...and the resulting output looks like this:
Thanks
For example, when cpu or load crosses a threshold, I would like to include the output of something like this:
top -cSbn 1 | head -14 | tail -8
...and the resulting output looks like this:
Code: Select all
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
17294 apache 20 0 515m 84m 8768 R 100.0 2.2 4:13.14 /usr/sbin/httpd
29665 nagios 20 0 51656 3168 1036 S 2.0 0.1 17:21.22 /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
31175 nagios 20 0 15164 1188 816 R 2.0 0.0 0:00.01 top -cSbn 1
1 root 20 0 19364 1028 820 S 0.0 0.0 12797:05 /sbin/init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.01 [kthreadd]
3 root RT 0 0 0 0 S 0.0 0.0 19:43.57 [migration/0]
4 root 20 0 0 0 0 S 0.0 0.0 4:26.39 [ksoftirqd/0]