mycheckpoint is used in two ways:
- For recording status data (one would issue this every few minutes, repeatedly, as in crontab)
- As an HTTP server, serving HTML reports (as of revision 190)
When recording status data, you may:
- Monitor and write to a single server
- Monitor one server, writing to another (e.g. monitoring a slave server, writing to the master server)
See Use case, local monitoring, Use case, remote monitoring, below, for a simple setup.
Help
To get full list of available options, run:
mycheckpoint --help
Simple usage
mycheckpoint
Deploying & auto-deploying mycheckpoint
As of revision 72, mycheckpoint has an auto-deploy mechanism. This means there is no specific action to take when upgrading mycheckpoint or installing a new version. It will automatically detect version change, rebuild tables, views; add missing columns; and, finally, monitor your database.
To strictly deploy (setup) mycheckpoint, without monitoring status
Pass the “deploy” command line argument:
mycheckpoint deploy
Single server: provide connection parameters (see Defaults file following), optionally verbose:
mycheckpoint --host=myserver --port=17401 --user=msandbox --password=msandbox deploy
mycheckpoint --host=localhost --socket=/tmp/mysql_sandbox17401.sock --user=msandbox --password=msandbox -v deploy
mycheckpoint --defaults-file=/root/.my-checkpoint.cnf --verbose deploy
Setting up Google charts configuration (see also Chart Basics):
mycheckpoint --defaults-file=/root/.my-checkpoint.cnf --chart-width=500 --chart-height=300 --chart-service-url=http://127.0.0.1/eastwood/chart deploy
Usage for recording status data
Take a recording (sampling) of current status and variables; purge old data:
mycheckpoint
Provide connection parameters (see Defaults file following):
mycheckpoint --user=msandbox --password=msandbox --host=myserver --port=17401
mycheckpoint --user=msandbox --password=msandbox --host=localhost --socket=/tmp/mysql_sandbox17401.sock
mycheckpoint --defaults-file=/root/.my-checkpoint.cnf
Same as above, verbose:
mycheckpoint --defaults-file=/root/.my-checkpoint.cnf -v
Specify database name other than mycheckpoint:
mycheckpoint --defaults-file=/root/.my-checkpoint.cnf -v --database=my_other_schema
Remote host monitoring (should most probably supply database name)
mycheckpoint --monitored-host=slave01.mynetwork.com --database=mycheckpoint_slave01 --defaults-file=/root/.my-checkpoint.cnf -v
Specify purge days: rows older than given number of days will be removed (default is 182, approx. 6 months)
mycheckpoint --defaults-file=/root/.my-checkpoint.cnf --verbose --purge-days=62
If monitoring user does not have SUPER nor REPLICATION CLIENT privileges (see Replication page):
mycheckpoint --defaults-file=/root/.my-checkpoint.cnf -v --skip-check-replication
Defaults file
To avoid passing user+password on command line, one may provide with the –defaults-file option. The file must be provided in full path (i.e. ~/.my-checkpoint.cnf home shortcut is invalid).
The default defaults file is expected on /etc/mycheckpoint.cnf. If this file exists, one does not have to specify –defaults-file on the command line.
A defaults file is similar in structure to my.cnf. It may include the following:
[mycheckpoint]
smtp_host = mail.my-server-company.com
smtp_from = monitor@my-server-company.com
smtp_to = dba@my-server-company.com
monitored_port = 3306
purge_days = 60
#... Any command line option can go here; replace dash ("-") with underscored ("_")
[client]
user=dbmonitor
password=123456
socket=/tmp/mysql.sock
port=3306
host=localhost
Use case, local monitoring
Once mycheckpoint is installed, add repeating monitoring to crontab:
*/5 * * * * mycheckpoint --defaults-file=/root/.my-checkpoint.cnf
Use case, remote monitoring
Once mycheckpoint is installed on master node, add repeating monitoring to crontab:
*/5 * * * * mycheckpoint --monitored-host=master.mynetwork.com --database=mycehckpoint_master --defaults-file=/root/.my-checkpoint.cnf */5 * * * * mycheckpoint --monitored-host=slave1.mynetwork.com --database=mycehckpoint_slave1 --defaults-file=/root/.my-checkpoint.cnf */5 * * * * mycheckpoint --monitored-host=slave2.mynetwork.com --database=mycehckpoint_slave2 --defaults-file=/root/.my-checkpoint.cnf
Note:
- We use distinct databases per monitored MySQL server
- We do monitoring per MySQL server separately.
See Remote & multiple hosts for more details.