Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a simple check to see if MySQL is up on a host with Nagios without authenticating and selecting a table?

share|improve this question
- added the mysql tag to this post – faultyserver Oct 8 '09 at 16:31

You can check by using tcp connections, but authenticating is definitely preferred.

One other thing to keep in mind, without authenticating properly eventually mysql will block your monitoring host for remote mysql connections due to errors and you'll have to run 'mysqladmin flush' to give it access again.

share|improve this answer

Without being able to connect to the database directly, you have some limitations. If you just want to see if the MySQL process is running on the host then using a plugin like check_ps would do the trick

Alternatively, as other posters have said, using check_tcp on port 3306 will give you an idea of if mysql is up and listening on its default port, this also has the benefit of working without having already configured NRPE or setting up check_by_ssh commands.

share|improve this answer
Thanks, so is the following correct in the server config: define service{ use generic-service host_name servone service_description MYSQL check_command check_tcp!-p3306 } I get "Port must be positive integer error" in the web interface. Ill have a look at the check_ps solution. – wooowoopo Oct 8 '09 at 16:06
for your check_command try just using 3306 (take out the "-p"), also take a look at your commands.cfg and make sure you are defining the check correctly, it is always good to run a pre-flight check with /usr/local/nagios/bin/nagios -v /etc/nagios/nagios.cfg (your directory locations may differ depending on how you installed nagios, change accordingly) – faultyserver Oct 8 '09 at 16:24

Keep in mind that mysql can be configured not to listen on a TCP socket at all. It will then use local UNIX socket. In that case, check_ps + NRPE would work.

share|improve this answer

I don't see other solution with this but check_tcp pluging do basically the job for you.

/usr/lib/nagios/plugins/check_tcp -H hostname -p 3306

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.