pmp-check-mysql-deleted-files - Alert when MySQL’s files are deleted.
Usage: pmp-check-mysql-deleted-files [OPTIONS] Options: -c CRIT Critical threshold; ignored. --defaults-file FILE Only read mysql options from the given file. Defaults to /etc/nagios/mysql.cnf if it exists. -H HOST MySQL hostname. -l USER MySQL username. -L LOGIN-PATH Use login-path to access MySQL (with MySQL client 5.6). -p PASS MySQL password. -P PORT MySQL port. -S SOCKET MySQL socket file. -w WARN Warning threshold; changes the alert to WARN instead of CRIT. --help Print help and exit. --version Print version and exit. Options must be given as --option value, not --option=value or -Ovalue. Use perldoc to read embedded documentation with more details.
This Nagios plugin looks at the files that the mysqld process has open, and warns if any of them are deleted that shouldn’t be. This typically happens when there is a poorly written logrotate script or when a human makes a mistake at the command line. This can cause several bad effects. If a table has been deleted, of course, it is a serious matter. Such a file can also potentially fill up the disk invisibly. If the file is the server’s log, it might mean that logging is effectively broken and any problems the server experiences could be undiagnosable.
The plugin accepts the -w and -c options for compatibility with standard Nagios plugin conventions, but they are not based on a threshold. Instead, the plugin raises a critical alert by default, and if the -w option is given, it raises a warning instead, regardless of the option’s value.
This plugin doesn’t alert about deleted temporary files, which are not a problem. By default, this plugin assumes that the server’s temporary directory is either the TMPDIR environment variable, or if that is not set, then /tmp/. If you specify MySQL authentication options, the value will log into the specified MySQL instance and look at the tmpdir variable to find the temporary directory.
This plugin looks at the first running instance of MySQL, as found in the system process table, so it will not work on systems that have multiple instances running. It probably works best on Linux, though it might work on other operating systems. It relies on either lsof or fstat or the ability to list the files in the process’s /proc/pid/fd directory.
This plugin executes the following commands against MySQL:
This plugin executes the following UNIX commands that may need special privileges:
The plugin should be able to find mysqld PID using ps command.
On BSD, if sysctl option security.bsd.see_other_uids is set to 0, ps will not return mysqld PID if the plugin run from non-root user.
Percona Monitoring Plugins pmp-check-mysql-deleted-files 1.1.4