does MySQL have a "pretty" way to persist snapshots of various show
commands?
for example in Oracle you could just do:
insert into sysstat_log select sysdate, * from v$sysstat;
--(an ugly, overly simple example)
can the show commands be called/parsed with DBD/DBI?
so far the only way I've come up with to do this is by hacking up
tee(s) with cut, sed, etc. in bash which works fine but is rather
repulsive to look at.
in particular I'd like to build a cgi that generates a trended report
of show master status and show slave status to quantify the proagation
delay (or lack thereof) to mgmt.
any light shed would be greatly appreciated!
We do a status check using a script which runs this line, you could
modify it to suit and direct the output where you want it of course:
/usr/local/mysql/bin/mysql -e "SHOW SLAVE STATUS\G" | grep
Slave_SQL_Running
This of course returns:
Slave_SQL_Running: Yes
In mysql 4.1 there is a better variable you could grep your show
slave status for:
/usr/local/mysql/bin/mysql -e "SHOW SLAVE STATUS\G" | grep
Seconds_Behind_Master
which hopefully returns:
Seconds_Behind_Master: 0
You can build a script that uses this type of command and appends the
output to some log file.. then you can generate your trend file
against that using whatever your preferred method of analysis happens
to be... You can combine you can add data from SHOW SLAVE STATUS\G,
SHOW MASTER STATUS\G and so on in your script... and then manipulate
the output to your liking:
This script would execute the command and output a single line with a
timestamp and the output of the SHOW statement you specifically
specify in the grep - you can execute the script and pipe the output
onto the end of some sort of log file, and away you go... you can
write two or three of these scripts to collect all the lines you want
and put them in different log files, or put three lines in this
script and put them all in one log file... Cron the scripts to run
every nn minutes and you're set. Munging the data then is the easy
part (and not my dept):
#!/bin/sh
#
echo `date` `/usr/local/mysql/bin/mysql -e "SHOW SLAVE STATUS\G" |
grep Seconds_Behind_Master `
Best Regards, Bruce
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]