mrtg-mysql-load - a MySQL load analysis fetcher for MRTG
[ -h hostname
] [ -P port
] [ -p password
] [ -c
] [ -o
] [ -d
] [ -v
(which is assumed to be available
on the host), passing the -h, -P, -u
options as they are
given. On normal exit, mrtg-mysql-load
writes each of the values of
questions, slow queries, uptime
to stdout, one line
It is meant to be called by the Multi Router Traffic Grapher (MRTG).
Please see the file INSTALLING for examples.
- the hostname to query (as -h for mysqladmin).
- The port on which to talk with the MySQL server (as -P for
- The MySQL username to use
- The password to use when calling mysqladmin. Note that
mrtg-mysql-load, unlike mysqladmin, doesn't care whether you
put whitespace between the -p and the password or not.
- Read the values for host, port, username and password from a configuration
file. The configuration file consists of lines of the form
var=value, where var is one of 'host', 'port', 'username' or
'password' and value is the (unquoted) corresponding value. Blank
lines may be added to the configuration file for readability, and comments
may be entered on separate lines starting with '#'.
If the same value is defined in the configuration file and on the command
line, the value on the command line takes precence.
- Print the command that would have been used to call mysqladmin using the
given options and configuration file, then exit.
- Will print a lot of very ugly debugging info to stderr. Mostly good for
demonstrating the programmer's lack of trust in his Perl skills.
- Print version information to stdout, then exit.
- The name of an optional log file. This file will log all output (including
error messages) generated by the program to that file.
The program exits with an exit value 0, if it believes it was successful.
When using mrtg-mysql-load
, there are several places
that may define the parameters used for connection. As noted above,
is a wrapper around the mysqladmin
will first search for its parameters from the files
, having options in the latter
overriding those of the first.
uses the command line of mysqladmin
to specify the
parameters, and these will override any options set by mysqladmin
configuration files. Thus, parameters set in mrtg-mysql-load
configuration file will override any options set in /etc/my.cnf
Any options set on the command line of mrtg-mysql-load
will override any
other options set by one of the previous methods. The command line switches
are most frequently used directly in the mrtg
config file, when
specifying the Target
- `Target[trgt.MySQL]: `/path/to/mrtg-mysql-load -opt1 val1 -opt2 val2 ...
To sum up, the parameters used when specifying the parameters for making a
connection to the MySQL server may be specified in no less than 4 places,
which are, in increasing order of precedence,
- a configuration file for mrtg-mysql-load specified by the -c
- switches set on the command line (or, more frequently, in the mrtg
- This is the most basic way to call mrtg-mysql-load. It will work, too, if
run on the same host as mysqld and mysqld is configured to let local users
connect. (By default, it does, though I believe this is a really stupid
decision on the part of the developers. You really should set permissions
in MySQL to disallow this.
- mrtg-mysql-load -h <mysql.host.name> -u <username> -p
- The format you would most likely use for calling mrtg-mysql-load.
- An example mrtg configuration file, mrtg-cfg.example, is provided
in the document directory of the distribution.
- An example mrtg-mysql-load configuration file,
mysql-load-cfg.example, is provided in the document directory of the
, which is assumed to be available
in the path of the user running the program.
(1), mrtg-cfg.example, mysql-load-cfg.example
- ERROR: ignoring superfluous arguments
- mrtg-mysql-load doesn't take any command-line arguments. If you get
this message, you most likely forgot to specify a switch name.
- ERROR: Can't open mysqladmin ...
- mysqladmin could not be run. Check that mysqladmin is available and
that the user running mrtg-mysql-load has the proper permissions.
- ERROR: mysqladmin returned an error message: ...
- mysqladmin did run, but hit a snag, probably when connecting to the
server. Check the displayed error message, and/or check whether you have
specified the correct host, username and password.
- ERROR: Unable to read config file ...
- mrtg-mysql-load could not open the config file specified by the
-c switch. Make sure the file exists and that the user running
mrtg-mysql-load has the permissions to read it.
- Error: I don't understand line xx of <configfile>
- There was an error on line xx of the configuration file. Each line must
either be blank, start with a '#' to mark it as a comment, or have the
form var=value, where var is one of 'host', 'port',
'username' or 'password' and value is the (unquoted) corresponding
- ERROR: could not find match for 'xxx' in mysqladmin output ...
- mysqladmin returned some output, but it was not formatted as
expected. Your particular version of mysqladmin may not match the
author's. The current version of mrtg-mysql-load was written for
mysql v. 3.23.35; Please contact the author with more information, and
he'll try to make it match your particular version.
is a Perl script. It has been created with and tested on
Perl v. 5.6.0-i386-linux. Minimum requirement is Perl 5.003.
relies on access to mysqladmin
. If mysqladmin is
not installed on the machine, or the user running mrtg-mysql-load does not
have the proper permissions to run mysqladmin, the program will fail.
The <MySQL> server must be configured with a user capable of connecting to
the server and retrieve the information.
The -t option which was available in previous versions, has now been removed. It
seems to have been removed from recent versions of mysqladmin, and it caused a
lot of trouble anyway -- at least according to users on the MySQL mailing
Most error messages are written to stdout as well as stderr. This may cause some
confusion, if the program is run from the console.
Copyright (c) 2001 Carsten H. Pedersen <firstname.lastname@example.org>. All
See the file COPYRIGHT in the distribution for the exact terms.
Written by Carsten H. Pedersen <email@example.com>.