hello
this shell script generates the number of http requests/second on the first line and mysql requests/second (average) on second line
that's all MRTG needs to make a graphic
the script should work on any cpanel server... for other control panels it will need modifications on the apache status url (who finds the URL for other panels may post on this thread to help others):
Code:
#!/bin/sh
# by Luís Fernando Estrozi - 09/08/2004
echo `lynx -dump http://127.0.0.1/whm-server-status?auto | grep ReqPerSec | awk '{print$2}'`
PASS=`cat /root/.my.cnf | grep pass | cut -d'=' -f2`
echo `mysqladmin -uroot -p$PASS status | awk '{print$22}'`
save it as /your_mrtg_path/reqpersec
chmod 755 /your_mrtg_path/reqpersec
now edit mrtg.cfg and add:
Code:
#----------------------------
# Requests per second
#----------------------------
Target[reqpersec]: `/etc/mrtg/reqpersec`
Title[reqpersec]: Requests per second
PageTop[reqpersec]: <h3>Requests per second</h3>
YLegend[reqpersec]: Requests per second
ShortLegend[reqpersec]:
LegendI[reqpersec]: apache
LegendO[reqpersec]: mysql
service mrtg restart
good luck