The system load average message

Invader Zim

Verified User
Joined
Sep 4, 2004
Messages
184
When a server's load crosses a certain threshold an email is sent and a ticket is created with the output of top (top -d 1 on FreeBSD apparently).

Is there a way to change the options? I mean, it's nice to see which process is so offensive, but I'd also like to see more in case it is php-cgi. So it only shows the following:

Code:
 97029 user1       1  68    0 86564K 31900K RUN     1   0:00  2.98% php-cgi

I'd like to see this (top -d 1 -a on FreeBSD):
Code:
37012 user1        1  59    0   113M 59388K getblk  0   3:19 17.58% /usr/local/php5/bin/php-cgi /home/user1/domains/domain.com

Can we set these options somewhere? Because having to look for a site that causes a high load in a domain list of 50 does kind of take the fun out of it :)
 
Ah! Now I get it. This is not at all what I asked for :) I'm not interested in which load average, I'm interested in other command line options for top (at least, I'm still guessing the load warning ticket is top's output). I'd like to add an option which, at least on FreeBSD, is a lot more useful than just the name of the process, as stated above.
 
oh I dont know if thats hard coded or not. You might want to email directadmin support and ask. I just use the csf load monitor and it emails me all the output of ps and top

Here is a ghetto shell script you can use if not.

Code:
#!/bin/sh

MAXLOAD=5
EMERGENCYLOAD=8
ADMINMAIL="[email protected]"
CURRENTLOAD=`uptime | sed -e 's/.*averages: //' | cut -d',' -f1 | sed 's/[.].*//'`
LOGFILEPS=/tmp/.ps-$$.log
LOGFILETOP=/tmp/.cputop-$$.log

log_header() {
echo >> $1
echo "-------------------------------" >> $1
date >> $1
echo "-------------------------------" >> $1
echo >> $1
}

email_notify() {
/usr/sbin/sendmail -t -oi <<EOF
Subject: SERVER LOAD MORE THAN $EMERGENCYLOAD
To: $ADMINMAIL

-----------------------------
`date`
-----------------------------

TOP OUTPUT:
`top -b -n 1`



PS OUTPUT:
`ps xuawww`
EOF
}

if [ "$CURRENTLOAD" -gt "$EMERGENCYLOAD" ]; then
  email_notify
fi

if [ "$CURRENTLOAD" -gt "$MAXLOAD" ]; then
  log_header $LOGFILETOP
  top -b -n 1 >> $LOGFILETOP

  log_header $LOGFILEPS
  ps xuawww >> $LOGFILEPS
fi

rm -rf $LOGFILEPS $LOGFILETOP
 
Last edited:
I'm not shy about mailing for support. I just like to see if someone on the forum knows the answer. :)
 
Maybe it can be a directadsmin.conf option, be your choice what output top gives.

eg.

top=-c -b -n 1 | /usr/bin/head -n 30
 
Back
Top