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 (OCA) Email Updates:
Status: Verified Impact on me:
None 
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
Description:
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)
  print(str)
  os.exit();
end

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)
    else
      str = string.format("%s does exist", logfile)
    end
    io.close(fhlog)
    print(str)
  end
end

io.close(fh)
------------------------------
[3 May 2011 15:34] Valeriy Kravchuk
Thank you for the feature request.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.038 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.