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 the ability to list the
files in the process’s /proc/pid/fd directory.