check_mysql_stats - Nagios plugin for MySQL status monitoring
Why this, instead of the basic check_mysql?
- Check specific stats against thresholds
-
Want to just check the number of open tables is in a range you expect?
Sure, just
-s 'Open tables:10:200' -t 20- if the number of tables is less than 10 or more than 200, you'll get an alarm - a WARNING if it's just outside, a CRITICAL if it's outside by more than 20%. You can repeat-sparameters to check as many different stats (as returned bymysqladmin statusas you wish. - Returns perfdata
-
Using nagiosgraph or Graphios to get metrics graphing from Nagios? This plugin will return perfdata, either for all stats if no specific stats were named to check, or for the stat(s) named otherwise.
- Useful
Queries per secondmetric -
mysqladmin statusgives you aQueries per second avgmetric, which would at first glance seem useful to you if you want to graph the number of queries your database servers are seeing. It's not, though, as it's the average QPS since the server started, not for the last short period, so it won't reflect changes in the query load the DB is seeing usefully.If you use the
--saved_stateparameter, then the status we get on each run will be written to the named file; when we next run, we read the last run's stats from the file - then, given we can work out how many new queries we've seen since that file was updated, and how many seconds have passed since it was updated, we can add a newQueries per secondmetric which is actually useful.(That metric can be used for threshold-checking just like any other one, and will be returned in perfdata so you can graph it.)
David Precious <[email protected]>
Feedback very much welcomed. Do feel free to drop me an email and let me know if this is useful to you!
Hey! The above document had some coding errors, which are explained below:
- Around line 44:
-
You forgot a '=back' before '=head1'