birmingham@ic.fbi.gov , phoenix@ic.fbi.gov , fbise@leo.gov
NickSoft Linux Cookbook Index NickSoft Linux Cookbook
Quick howto's, Real live examples.
 
 FAQFAQ   SearchSearch   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[MRTG] MySQL statistics

 
Post new topic   Reply to topic    NickSoft Linux Cookbook Index -> MRTG
View previous topic :: View next topic  
Author Message
NickSoft
Site Admin


Joined: 13 Nov 2006
Posts: 22

PostPosted: Mon Nov 13, 2006 2:34 pm    Post subject: [MRTG] MySQL statistics Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    NickSoft Linux Cookbook Index -> MRTG All times are GMT
Page 1 of 1

 
Jump to:  
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




MLDb.org Magic Eight Ball Croler Web Search Croler Web Directory Bianca Ryan MyBestMatch.net Microlab.info

Powered by 220V