[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cobalt-users] Monitoring Sendmail (smtp/pop/mailqueu) with MRTG => How ?



<snip>
> I have installed mrtg on the famous blue box. It is running 
> fine. However I
> don't get MRTG to monitor sendmail processess (also http).
</snip>

Hi Robert,

If you need a script which simply checks how many processes of a particular type are running (e.g. sendmail, httpd, admserv, etc) then something like this should do you:

#!/bin/sh

name=$1
process=$2
numproc=`ps ax |grep $process | grep -v grep | wc -l | awk '{print $1}'`

echo $numproc
echo $numproc
echo `uptime | cut -d"," -f1,2`
echo $name


Then in your mrtg.cfg just do:
Target[index]: `/usr/sbin/pscheck index httpd`


Or do check how many mails are waiting in the mailq, use a script like this:

#!/bin/sh

name=$1
nummail=`echo $((((\`mailq | wc -l | awk '{print $1}'\` - 2)) / 2))`

echo $nummail
echo $nummail
echo `uptime | cut -d"," -f1,2`
echo $name

Again, in MRTG:
Target[mailer]: `/usr/sbin/mailqcheck index`

(Though I haven't tested the mailq one fully, it should be fine as a rough guide)


Hope that does what you need.

Regards,

Andy
andy@xxxxxxxxxx
http://www.raqpak.com/ <-- Raq/Qube unofficial PKGs and support advice