5.11. mysql

The mysql module allows queries to be performaed against targets as checks. The results of the query are used as metrics.

loader

C

image

mysql.so

5.11.1. Module Configuration

5.11.2. Check Configuration

dsn
required

required

allowed

.+

The connect string for MySQL. The syntax of this string is explained in the PostgreSQL documentation. See Database Connection Control Functions. The MySQL-specific behavior is explained in the mysql_real_connect documentation.

sql
required

required

allowed

.+

The query that will be executed.

Example 5.12. Tracking MySQL database sizes.

This will track the sizes of all databases on 10.225.209.35 and 10.225.209.56. We will connect to the mysql database as the user "noit" with password "noit." We only run this check every 5 minutes.

      <noit>
        <modules>
          <module image="mysql" name="mysql"/>
        </modules>
        <checks>
          <databases>
            <mysql module="mysql" period="300000">
              <config>
                <dsn>host=%[target] dbname=%[name] user=noit password=noit</dsn>
                <sql>select table_schema "dbname", sum( data_length + index_length ) "size" from information_schema.tables group by table_schema</sql>
              </config>
              <check uuid="8c5ca46c-77d7-11dd-ab5b-53bc639517d6" target="10.225.209.35"/>
              <check uuid="90b8aea2-77d7-11dd-8447-0f281e6a48eb" target="10.225.209.56"/>
            </mysql>
          </databases>
        </checks>
      </noit>