Bug #61040 Add rule to compare logrotate settings with mysql variables
Submitted: 3 May 2011 13:14 Modified: 3 May 2011 15:34
Reporter: Daniël van Eeden Email Updates:
Status: Verified Impact on me:
Category:MySQL Enterprise Monitor: Advisors/Rules Severity:S4 (Feature request)
Version:2.3.3 OS:Any
Assigned to: CPU Architecture:Any

[3 May 2011 13:14] Daniël van Eeden
A common cause of downtime is a full filesystem. 

For MySQL this can be prevented by:
- Setting expire_logs_days (Old binlogs wil be removed)
- Setting innodb_file_per_table (OPTIMIZE TABLE will return space)
- Changing the logrote script /etc/logrotate.d/mysql support-files/mysql-log-rotate so that it checks the correct files.

MySQL Enterprise Monitor does have enough information to check the first 2 causes of excessive disk use, but not for the last one.

If logrotate is configured to rotate /var/log/mysqld.log but the real error log is in /var/lib/mysql/hostname-err.err that that could fill-up the disk. The error log is not really that big, but the slow query log and general log could get big enough to cause issues.

How to repeat:
See Description

Suggested fix:
Add data collection item and rules for logrotate.

Lua script which could be used to create a data collectionn item:
logrotatemysql = "/etc/logrotate.d/mysql"

local fh = io.open(logrotatemysql, "r")
if not fh then 
  str = string.format("Could not open %s for reading",logrotatemysql)

for line in fh:lines() do
  if string.find(line,"^/") then
    s,e = string.find(line,"/[a-z/.-_]*")
    logfile = string.sub(line, s, e-1)
    fhlog = io.open(logfile)
    if not fhlog then
      str = string.format("%s does not exist", logfile)
      str = string.format("%s does exist", logfile)

[3 May 2011 15:34] Valeriy Kravchuk
Thank you for the feature request.