[BlueOnyx:11056] Re: swatch and system monitoring

Michael Stauber mstauber at blueonyx.it
Tue Jul 31 04:04:15 -05 2012


Hi Richard,

> The script you want is: /usr/sbin/swatch
>  
> By the time the Perl script gets to line 170, there may be a $body
> variable containing data which is emails.
>  
> You could probably add some output to this just after the if ($body) {
> line... maybe $body .= `top -b -n1`;  (untested)
>  
> I would expect to see this file get updated from time to time, so any
> changes may get wiped when there is an update.

Yeah, I had emailed Will a small stand alone script yesterday which
performed the task of emailing the output of 'top' whenever the loadavg
went above a configured value. But then I thought kind of the same as
you: "Would be nice to have that in Active Monitor!"

It was fairly easy to code into swatch and I just published an updated
"swatch" to the BlueOnyx YUM repository.

Below is a sample output of a new CPU warning message from Active
Monitor. I cheated a bit to make it trigger way below the usual
tresholds - just for testing purpose:

-------------------

Active Monitor has detected recent changes in the state of your server
appliance. For more details, please see the Active Monitor section of
the Server Desktop.

Summary of changes:

* The CPU is being heavily used. This will result in noticeable
performance loss. Consider moving some of the services to other servers,
or reduce the complexity of the CGI scripts running on the server itself.

-------------------------------------------
System snapshot:
-------------------------------------------
top - 10:47:57 up 23 days,  4:06,  6 users,  load average: 0.00, 0.00, 0.00
Tasks:  88 total,   1 running,  87 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.2%us,  0.4%sy,  0.0%ni, 99.0%id,  0.2%wa,  0.0%hi,  0.0%si,
0.1%st
Mem:   2097152k total,  1490284k used,   606868k free,        0k buffers
Swap:  4194304k total,      588k used,  4193716k free,   560452k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 3744 mailman   20   0  198m  10m 3304 S  2.0  0.5   7:12.66 python
31673 root      20   0 15048 1028  788 R  2.0  0.0   0:00.01 top
    1 root      20   0 19208 1284 1136 S  0.0  0.1   0:05.53 init
    2 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kthreadd/106
    3 root      20   0     0    0    0 S  0.0  0.0   0:00.00 khelper/106
  131 root      16  -4 10664  484  284 S  0.0  0.0   0:00.00 udevd
  484 root      20   0  6148  536  472 S  0.0  0.0   0:00.00 portreserve
  525 rpc       20   0 18960  808  568 S  0.0  0.0   0:03.71 rpcbind
 1463 root      20   0 13528  492  364 S  0.0  0.0   1:48.21 lldpad
 1504 rpcuser   20   0 23136 1028  808 S  0.0  0.0   0:00.11 rpc.statd
 1547 root      20   0  184m 2500 1720 S  0.0  0.1   0:00.01 cupsd
 2936 root      20   0 93684 3792 2904 S  0.0  0.2   0:00.07 sshd
 2938 root      20   0  105m 1820 1388 S  0.0  0.1   0:00.03 bash
 3426 root      20   0 22080  976  732 S  0.0  0.0   0:01.28 xinetd
 3438 clamav    20   0  325m 142m 5488 S  0.0  6.9   2:15.09 clamd
 3470 root      20   0  275m  74m 3644 S  0.0  3.7   0:10.27 spamd
 3477 root      20   0  278m  76m 2540 S  0.0  3.8   0:27.58 spamd
 3479 root      20   0  275m  71m  740 S  0.0  3.5   0:00.03 spamd
 3601 root      20   0 2044m  780  428 S  0.0  0.0   0:18.34 clamav-milter
 3612 smmsp     20   0 2060m 3040  724 S  0.0  0.1   0:17.28 milter-greylist
 3655 root      20   0 2039m 1072  508 S  0.0  0.1   0:17.78 spamass-milter
 3665 root      20   0  515m  36m  14m S  0.0  1.8   1:49.77 httpd
 3685 qpidd     20   0  455m 3404 2276 S  0.0  0.2   4:32.94 qpidd
 3731 root      20   0 21428  468  292 S  0.0  0.0   0:00.02 atd
 3743 mailman   20   0  196m 8312  904 S  0.0  0.4   0:00.02 mailmanctl
 3745 mailman   20   0  198m  10m 3304 S  0.0  0.5   7:51.66 python
 3746 mailman   20   0  198m  10m 3304 S  0.0  0.5   7:14.14 python
 3747 mailman   20   0  199m  10m 3396 S  0.0  0.5   7:13.53 python
 3748 mailman   20   0  198m  10m 3304 S  0.0  0.5   7:14.25 python
 3749 mailman   20   0  199m  10m 3388 S  0.0  0.5   7:59.62 python
 3750 mailman   20   0  198m  10m 3396 S  0.0  0.5   7:13.84 python
 3751 mailman   20   0  198m  10m 3304 S  0.0  0.5   0:00.69 python
 4015 root      20   0 93864 4056 2908 S  0.0  0.2   0:07.07 sshd
 4017 root      20   0  106m 2024 1504 S  0.0  0.1   0:01.89 bash
10903 root      20   0  429m  19m 9716 S  0.0  1.0   0:27.08 httpd.admsrv
12076 apache    20   0  515m  23m 1696 S  0.0  1.1   0:00.01 httpd
12077 apache    20   0  515m  23m 1496 S  0.0  1.1   0:00.00 httpd
12078 apache    20   0  515m  23m 1496 S  0.0  1.1   0:00.01 httpd
12079 apache    20   0  515m  23m 1496 S  0.0  1.1   0:00.01 httpd
12080 apache    20   0  515m  23m 1496 S  0.0  1.1   0:00.00 httpd
12081 apache    20   0  515m  23m 1496 S  0.0  1.1   0:00.00 httpd
12082 apache    20   0  515m  23m 1496 S  0.0  1.1   0:00.00 httpd
12083 apache    20   0  515m  23m 1496 S  0.0  1.1   0:00.00 httpd
12094 apache    20   0  515m  23m 1512 S  0.0  1.1   0:00.00 httpd
12095 apache    20   0  515m  23m 1696 S  0.0  1.1   0:00.00 httpd
12096 apache    20   0  515m  23m 1696 S  0.0  1.1   0:00.00 httpd
12739 root      20   0 93684 3816 2908 S  0.0  0.2   0:01.00 sshd
12741 root      20   0  105m 1876 1416 S  0.0  0.1   0:00.14 bash
12758 root      20   0 93684 3824 2912 S  0.0  0.2   0:01.94 sshd
12760 root      20   0  105m 1876 1416 S  0.0  0.1   0:00.27 bash
13687 root      20   0 19256  676  452 S  0.0  0.0   0:00.02 dovecot
13689 dovecot   20   0 12972  924  752 S  0.0  0.0   0:00.00 anvil
13690 root      20   0 13104 1072  784 S  0.0  0.1   0:00.00 log
16057 root      20   0 17176  512  388 S  0.0  0.0   0:00.00 cceclient
16058 root      20   0 18692 1960  668 S  0.0  0.1   0:00.00 cced
17896 root      20   0 93684 3816 2908 S  0.0  0.2   0:00.36 sshd
17898 root      20   0  105m 1876 1416 S  0.0  0.1   0:00.12 bash
18554 apache    20   0  431m  15m 4012 S  0.0  0.8   0:00.48 httpd.admsrv
18555 apache    20   0  431m  16m 3876 S  0.0  0.8   0:00.37 httpd.admsrv
18556 apache    20   0  434m  18m 5184 S  0.0  0.9   0:00.50 httpd.admsrv
18557 apache    20   0  432m  16m 3904 S  0.0  0.8   0:00.86 httpd.admsrv
18558 apache    20   0  430m  14m 3748 S  0.0  0.7   0:00.50 httpd.admsrv
18559 apache    20   0  435m  18m 5084 S  0.0  0.9   0:00.84 httpd.admsrv
18560 apache    20   0  431m  15m 3604 S  0.0  0.8   0:00.49 httpd.admsrv
18561 apache    20   0  435m  18m 4764 S  0.0  0.9   0:00.54 httpd.admsrv
18578 root      20   0 18692 1976  708 S  0.0  0.1   0:00.97 cced
18781 root      20   0  243m 2084 1028 S  0.0  0.1   0:02.00 rsyslogd
19368 root      20   0 64056 1148  488 S  0.0  0.1   0:00.00 sshd
19498 root      20   0 64252  888  296 S  0.0  0.0   0:00.00 saslauthd
19501 root      20   0 85252 4076 1484 S  0.0  0.2   0:00.98 sendmail
19512 root      20   0 64252  644   52 S  0.0  0.0   0:00.00 saslauthd
19513 root      20   0 64252  640   48 S  0.0  0.0   0:00.00 saslauthd
19514 root      20   0 64252  640   48 S  0.0  0.0   0:00.00 saslauthd
19515 root      20   0 64252  640   48 S  0.0  0.0   0:00.00 saslauthd
19519 smmsp     20   0 76048 2004  612 S  0.0  0.1   0:00.00 sendmail
21773 root      20   0  114m 1280  620 S  0.0  0.1   0:03.39 crond
22749 root      20   0  136m 7684 2136 S  0.0  0.4   0:00.08 pperld
23736 root      20   0  105m 1368 1136 S  0.0  0.1   0:00.01 mysqld_safe
23836 mysql     20   0  496m  19m 4148 S  0.0  1.0  29:26.61 mysqld
24884 root      20   0 93992 4024 2908 S  0.0  0.2   0:03.06 sshd
24886 root      20   0  105m 1864 1416 S  0.0  0.1   0:00.15 bash
26282 root      20   0  118m 3728 2048 S  0.0  0.2   0:00.29 mc
26284 root      20   0  105m 1836 1400 S  0.0  0.1   0:00.06 bash
28252 apache    20   0  430m  14m 3016 S  0.0  0.7   0:00.06 httpd.admsrv
30551 root      20   0 15076 3152  840 S  0.0  0.2   0:00.00 config
30552 dovecot   20   0 74184 2532 1852 S  0.0  0.1   0:00.00 auth
31624 root      20   0  139m 8768 2176 S  0.0  0.4   0:00.29 swatch
31625 root      20   0 18692 2016  720 S  0.0  0.1   0:00.03 cced

-- 
With best regards

Michael Stauber



More information about the Blueonyx mailing list