|
NickSoft Linux Cookbook Quick howto's, Real live examples.
|
|
View previous topic :: View next topic |
Author |
Message |
NickSoft Site Admin
Joined: 13 Nov 2006 Posts: 22
|
Posted: Mon Nov 13, 2006 2:34 pm Post subject: [MRTG] MySQL statistics |
|
|
To check statistics of mysql server I have prepared a sipmple bash script:
Code: | #!/bin/sh
#mysql password for root
mysql_password=''
#where mysql and mysqladmin is located
mysql_bin_dir=/usr/local/mysql/bin
info=`${mysql_bin_dir}/mysqladmin -u root -p${mysql_password} status |awk '{print $2 " " $6}'`
queries=`echo $info|awk '{print $2}'`
uptime=`echo $info|awk '{print $1}'`
uptime=`echo "select sec_to_time($uptime);"|${mysql_bin_dir}/mysql -p${mysql_password} --skip-column-names`
echo $queries
echo $queries
echo $uptime |
Fill variables on top of this script with right data
Here is the mrtg.cfg entry for mysql statistics:
Code: | Target[mysql.queries]: `/etc/mrtg/mysql.sh`
Title[mysql.queries]: MySQL Queries
PageTop[mysql.queries]: <H1>MySQL Queries</H1>
MaxBytes[mysql.queries]: 10000
Options[mysql.queries]: nopercent
LegendI[mysql.queries]: Queries
LegendO[mysql.queries]:
ShortLegend[mysql.queries]: q/s
YLegend[mysql.queries]: q/s |
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|