10.3. Monitoring MySQL Databases.

What should you configure in osagent.conf.xml to monitor your MySQL Databases ?

10.3.1. Checks for monitoring MySQL Databases

  • Checking running background processes with PROC

  • Checking open sockets on port 3306 (default) with SOCKETS

  • Checking the my.log (MySQL log file) with LOGS

  • Checking the health of the database server with MYSQL

  • Checking free space with DISK

10.3.2. Example configuration for monitoring MySQL Databases

			
<!-- ... -->
  <DISK>
    <FS>
      <!-- The mysql mountpoint -->
      <FSNAME>^/var/lib/mysql$</FSNAME>
      <ERRORLEVEL>ERROR</ERRORLEVEL>
      <DESCRIPTION>This is the file system with the MySQL data files. 
        Maybe you want to resize this file system</DESCRIPTION>
      <VALUE>98</VALUE>
      <FORMULA>PERCENT</FORMULA>
    </FS>
				
    <!-- More filesystems to check -->
  </DISK>

  <PROC>
    <PROCESS>
      <!-- MySQL Background processes (the names differ on some MySQL versions
        -->
      <PROCNAME>mysqld_safe|mysqld</PROCNAME>
      <ERRORLEVEL>ERROR</ERRORLEVEL>
      <DESCRIPTION>Some/All MySQL background processes are not running! 
        Please check this. You should take a look to /var/log/my.log and to the
        trace files.</DESCRIPTION>
      <NUMBER>2</NUMBER><!-- 2 Background processes -->
    </PROCESS>

  </PROC>

  <LOGS>				
    <LOGFILE>
      <!-- log slow queries -->
      <LOGFILENAME>/var/log/mysql/mysql-slow.log</LOGFILENAME>
      <LOGFILTER>
        <REGEX>select * from very_big_table</REGEX>
        <PRIORITY>10</PRIORITY>
        <ERRORLEVEL>NORMAL</ERRORLEVEL>
      </LOGFILTER>
      <LOGFILTER>
        <REGEX>.*</REGEX>
        <PRIORITY>1000</PRIORITY>
        <ERRORLEVEL>WARNING</ERRORLEVEL>
      </LOGFILTER>
    </LOGFILE>
  </LOGS>

  <MYSQL>
    <USERNAME>root</USERNAME>
    <PASSWORD>start01</PASSWORD>
    <VALUE>
      <NAME>Slow queries</NAME> <!-- one output of "mysqladmin status" -->
      <MAX_VALUE>20</MAX-VALUE>
    <VALUE>

    <VALUE>
      <NAME>Queries per second avg</NAME>
      <MAX_VALUE>56</MAX_VALUE>
    <VALUE>
  </MYSQL>

  <!-- ... -->