help | logout
dbstat

dbstat

Name

dbstat -- Reports current activity levels of MySQL database servers.

Description

The dbstat module connects to one or more MySQL database servers and reports the current activity level of the server (in queries per second). Optionally, the dbstat module can check the activity level against a pre-determined threshold, and report a warning if it has deviated from an acceptable standard.

Configuration

The dbstat module is configured like other RSP modules: in the rspd.conf file, list the MySQL database servers you wish to connect to and the required parameters to log into each server (address, login and password). An example configuration follows:

config
{
   # The shorten_suffix parameter instructs dbstat to report activity 
   # levels as either "queries per second" or "q/s".  A value of 1 uses "q/s".
   shorten_suffix = 1
   
   # A site variable names a new connection to a database.  This name 
   # must be an alphanumeric word (no spaces or special characters), and 
   # is used to describe the parameters of this server in future instructions.
   site = database1

   # Once the name of the server has been defined using the "site"
   # parameter above, the following parameters can be defined.
   
   # The host parameter is the address (either hostname or IP address) of 
   # the database server.
   database1.host = dbserver.mycompany.com
   
   # Currently, dbstat only handles MySQL database servers, but in the 
   # future, other types may be defined here (such as postgresql, etc).
   database1.type = mysql
   
   # The user parameter is the login name for the MySQL database.  
   # Although using the root account is permissible, it is not advised.  
   # Instead, it is recommended that your database administrator create 
   # a separate account for the dbstat module.  Make sure the account is 
   # allowed to login from the address of the machine dbstat is running on.
   database1.user = username
   
   # The password parameter is the password (in clear text) of the 
   # username used above.
   database1.password = password
}
		

Any number of sites may be defined.

Windows users may specify the same information by clicking the Modules tab in the Configuration dialog box and selecting (or adding) dbStat.

Thresholds

To define thresholds for dbstat, add one or more thresholds to the threshold block (see Chapter 2 for more details). Each "threshold" entry contains "dbStat." followed by the name of the site (defined in the "config" block, followed by a test operation sign (less than, less than or equal to, greater than, greater than or equal to, or equal to), and then a value. For instance:

thresh1.threshold = dbStat.database1 > 50
		

This will instruct dbstat to report a threshold warning whenever the activity level of the database1 MySQL server goes above 50 queries per second.

History Data

The dbstat module will save the number of queries per second for each MySQL database server monitored as history data. Using the RSP History Viewer and RSP Web tools, graphs can be created showing trends in the activity levels of these servers.