pmp-check-mysql-pidfile - Alert when the mysqld PID file is missing.
Usage: pmp-check-mysql-pidfile [OPTIONS] Options: -c CRIT Critical threshold; makes a missing PID file critical. --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; ignored. --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 checks to make sure that the MySQL PID file is not missing. The PID file contains the process ID of the MySQL server process, and is used by init scripts to start and stop the server. If it is deleted for some reason, then it is likely that the init script will not work correctly. The file can be deleted by poorly written scripts, an accident, or a mistaken attempt to restart MySQL while it is already running, especially if mysqld is executed directly instead of using the init script.
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 warning by default, and if the -c option is given, it raises an error instead, regardless of the option.
By default, this plugin will attempt to detect all running instances of MySQL, and verify the PID file’s existence for each one. It does this purely by examining the Unix process table with the ps tool. However, in some cases the process’s command line does not list the path to the PID file. If the tool fails to detect the MySQL server process, or if you wish to limit the check to a single instance in the event that there are multiple instances on a single server, then you can specify MySQL authentication options. This will cause the plugin to skip examining the Unix processlist, log into MySQL, and examine the pid_file variable from SHOW VARIABLES to find the location of the PID file.
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 either get variables from MySQL or 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.
Also an user you run the plugin from should be able to access MySQL PID file file, so you may want to add it into mysql unix group etc.
Percona Monitoring Plugins pmp-check-mysql-pidfile 1.1.4