NAME

mysar - sar-like utility for MySQL

VERSION

Current version is v0.5-alpha Report bugs @ http://bugs.launchpad.net/mysar/

SYNOPSIS

Minimum set of parameters

   mysar.pl --user user --pass passwd --variables|status

See USAGE for optional parameters and defaults.

DESCRIPTION

This utiliy sole purpose is to take a snapshot of MySQL's running status in a number of tables so it they can be queried and cross reference with other utilities and external and internal logs. For example: sar or MySQL's query logs.

USAGE

 Options List:
      --host <hostname>    Connect to a remote host to perform tests
      --socket <socket>    Use a different socket for a local connection
      --port <port>        Port to use for connection (default: 3306)
      --user <username>    (required) Username to use for authentication
      --pass <password>    (required) Password to use for authentication
      --variables          Gather the global variables values
      --status             Gather the global status values
                           You need to specify at least one of the options
                           above
      --varfile            File with the list of variables to monitor
      --statfile           File with the list of status variables to 
                           monitor 
                           For variables/status specification you may 
                           use '%' as wildcard
      --database           Specifies which schema contains the tables 
                           'value_var' & 'value_stat'
      --purge              Specify the number of rows to keep in the table(s)
                           being updated.

Options details

host

Specify the host being monitored, default value is localhost

socket

Specify the socket to use to connecto to the database. The default value is taken from the configuration files.

port

Which port to use to connect to the database. Default value is 3306

user

MANDATORY PARAMETER. Which user to connect to the database. There is no default value. Make sure that it has been granted at least PROCESS, CREATE for all schemas and ALL for the mysar schema.

   GRANT USAGE, PROCESS, CREATE ON *.* TO 'mysar'@'localhost' IDENTIFIED BY 'passwd';
   GRANT ALL ON mysar.* TO 'mysar'@'localhost' 

User mysar should only be defined to connect from localhost, unless you're monitoring a remote server. Replace mysar and passwd with the values of your preference.

pass

MANDATORY PARAMETER. Password to use to connect to the database. There is no default value.

variables / status

ONE OF THE 2 HAS TO BE PRESENT. One of these 2 parameters needs to be present. variables gathers the result of SHOW GLOBAL VARIABLES and status from SHOW GLOBAL STATUS.

varfile

It is possible to limit the variables to gather by using a file where each line contains a reg expression like what you would use in SHOW GLOBAL VARIABLES LIKE 'reg_exp'.

statfile

Same as before with the expressions to use in SHOW GLOBAL STATUS LIKE 'reg_exp'.

database

Specify the schema that mysar will use to create its tables. Details on defaults are not completely defined and currently the database has to exist when running mysar.pl for the first time. Use:

   CREATE DATABASE dbname;
purge

Specify the number of days being kept in the tables that are being updated. The default is 30, specifying 0 implies no purge.

KNOWN ISSUES

Running on other OS than Linux

I have not tested the routine with other OS like Windows and Solaris. I currently don't see any issues on why it shouldn't run on them as long as you have a proper Perl installation. This may vary in future releases, especially Windows due to its file naming convention. In the long term Windows will be fully supported, but for now it'll be implemented towards the end of each release cycle (a resources issue).

Running with MySQL v4.1

Since there is no need for the trigger, it should run with MySQL v4.1. However, since v4.1 is an end of life'd release, keeping it backward compatible with v4.1 is not a priority (another resources issue). The utility will remain untested for earlier releases.