DragonFly On-Line Manual Pages

Search: Section:  


MRTG-MYSQL-LOAD(1)              mrtg-mysql-load             MRTG-MYSQL-LOAD(1)

NAME

mrtg-mysql-load - a MySQL load analysis fetcher for MRTG

SYNOPSIS

mrtg-mysq-load [ -h hostname ] [ -P port ] [ -u username ] [ -p password ] [ -c /path/to/config/file ] [ -o ] [ -d ] [ -v ] [ -l /path/to/log/file ]

DESCRIPTION

mrtg-mysql-load runs mysqladmin (which is assumed to be available on the host), passing the -h, -P, -u and -p options as they are given. On normal exit, mrtg-mysql-load writes each of the values of questions, slow queries, uptime and version to stdout, one line per value. It is meant to be called by the Multi Router Traffic Grapher (MRTG).

INSTALLING

Please see the file INSTALLING for examples.

OPTIONS

-h the hostname to query (as -h for mysqladmin). -P The port on which to talk with the MySQL server (as -P for mysqladmin). -u The MySQL username to use -p 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. -c 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. -o Print the command that would have been used to call mysqladmin using the given options and configuration file, then exit. -d 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. -v Print version information to stdout, then exit. -l The name of an optional log file. This file will log all output (including error messages) generated by the program to that file.

RETURN VALUE

The program exits with an exit value 0, if it believes it was successful.

USING CONFIGURATION FILES

When using mrtg-mysql-load with mrtg, there are several places that may define the parameters used for connection. As noted above, mrtg-mysql- load is a wrapper around the mysqladmin program. mysqladmin will first search for its parameters from the files /etc/my.cnf and ~/my.cnf, having options in the latter overriding those of the first. mrtg-mysql-load uses the command line of mysqladmin to specify the parameters, and these will override any options set by mysqladmin's configuration files. Thus, parameters set in mrtg-mysql-load's configuration file will override any options set in /etc/my.cnf and/or ~/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 option: `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, o /etc/my.cnf o ~/my.cnf o a configuration file for mrtg-mysql-load specified by the -c parameter o switches set on the command line (or, more frequently, in the mrtg config file).

EXAMPLES

mrtg-mysql-load 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 <password> The format you would most likely use for calling mrtg-mysql-load. o An example mrtg configuration file, mrtg-cfg.example, is provided in the document directory of the distribution. o An example mrtg-mysql-load configuration file, mysql-load- cfg.example, is provided in the document directory of the distribution.

FILES

mrtg-mysql-load uses mysqladmin, which is assumed to be available in the path of the user running the program.

SEE ALSO

mrtg(1), mrtg-cfg.example, mysql-load-cfg.example http://www.mrtg.org/ http://www.bitbybit.dk/mysqlfaq/mrtg-mysql-load/

DIAGNOSTICS

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 value. 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.

RESTRICTIONS

mrtg-mysql-load 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. mrtg-mysql-load 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.

BUGS

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 list. 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

Copyright (c) 2001 Carsten H. Pedersen <carsten.pedersen@bitbybit.dk>. All Rights Reserved. See the file COPYRIGHT in the distribution for the exact terms.

AUTHOR

Written by Carsten H. Pedersen <carsten.pedersen@bitbybit.dk>. 3rd Berkeley Distribution perl v5.6.0 MRTG-MYSQL-LOAD(1)

Search: Section: