-
Notifications
You must be signed in to change notification settings - Fork 12
/
README
executable file
·68 lines (43 loc) · 2.32 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
README to mysql_health_check.pl
-------------------------------------------
Requirements:
A recent version of perl5.
CPAN Modules:
Nagios::Plugin - if you're lucky, rpmforge repo is configured in yum and you
can issue 'yum install perl-Nagios-Plugin' to install everything you need.
(optional) Writable directory for meta data cache from mysql. Defaults to
'/tmp/pdb_nagios_cache'. Can also run in non-caching mode, see below or
--help for more info.
To install:
* copy plugin to nagios plugin directory.
* chmod 755.
* Make sure cache directory is writable by nagios user.
Usage examples:
To check for long running queries, warn at 40 seconds, critical at 60 seconds:
mysql_health_check.pl --hostname=localhost --user=root --mode=long-query \
--warning=900 --critical=1800
To checked for locked queries:
mysql_health_check.pl --hostname=localhost --user=root --mode=locked-query
To check mysql status and variables; for example max connections, alert at > 80% used:
mysql_health_check.pl --hostname=localhost --user=root --mode=varcomp \
--expression="Max_used_connections/max_connections * 100" --comparison_warning=">80" \
--comparison_critical=">100"
--shortname=max_connections
In varcomp, you can use any variable from 'SHOW GLOBAL STATUS' and
'SHOW GLOBAL VARIABLES'.
To compare status and variables from previous run's cache file, you can do something like:
mysql_health_check.pl --hostname=localhost --user=root --mode lastrun-varcomp \
--comparison_warning ">80" \
--comparison_critical ">100" \
--expression "(current{Queries} - lastrun{Queries}) / (current{Uptime} - lastrun{Uptime})"
current{keyword} and lastrun{keyword} will be replaced with the appropriate value from the cache.
WARNING: There isn't good sanity checking here yet, so please get the keywords right or else you'll see warnings.
To check if mySQL is read-only, you can do:
mysql_health_check.pl --hostname=localhost --user=root --mode simple --expression read_only
To check the default storage engine, you can do:
mysql_health_check.pl --hostname=localhost --user=root --mode simple --expression engine
General Notes:
--warning and --critical Thresholds are very flexible, please see:
http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT
for detailed info on how to use them.
Use --help to a full list of supported arguments.