check_log + mysqld.log
mark redding
mwjredding at gmail.com
Mon Dec 10 10:19:42 CET 2007
Hi,
On 10/12/2007, Roger <Roger at nagioswiki.com> wrote:
> I'm thinking about using check_log to monitor mysqld.log
I've found it more useful to check the status of the mysql processes
themselves rather than the log file. So I monitor the number of active
connections, and those in a locked state and alert when either of
these values gets too high. I therefore use the following :-
1) a basic perl script to process the 'processlist' command (it could
be improved by parameterising the thresholds, I've just never felt the
need to do so) :-
#!/usr/bin/perl
# mysql-procs.pl
use vars qw($PROGNAME);
use lib "/usr/local/nagios/libexec" ;
use utils qw (%ERRORS &print_revision &support);
my(@res) = ` mysqladmin --user=??? --password=??? processlist`;
my($tcount) = 0;
my($lcount) = 0;
my($status) = "OK";
foreach(@res) {
$tcount++ if(m/auser/); # check for a specific user connecting
$tcount++ if(m/buser/); # check for another specific user connecting
$lcount++ if(m/Locked/); # check for Locked processes
}
$status = "WARNING" if($tcount > 200);
$status = "CRITICAL" if($lcount > 5);
print "MYSQL-PROCS " . $status . " - " . $tcount . " processes, " .
$lcount . " locked\n";
exit $ERRORS{$status};
which is run out of nrpe on the server hosting the mysql database.
2) an nrpe.cfg entry on the server :-
command[check_mysqlprocs]=/home/nagios/mysql-procs/mysql-procs.pl
3) a service within the nagios configuration :-
define service {
name ops-mysql-procs
use ops-service
service_description MYSQL-PROCS
max_check_attempts 3
normal_check_interval 5
retry_check_interval 2
check_command check_nrpe!check_mysqlprocs
register 0
}
4) a service line for each host with a mysql database running :-
define host {
use live-host
host_name mysql-dbserver
alias mysql server
parents big-switch
address ???.???.???.???
check_command check-host-alive
}
...
define service {
use ops-mysql-procs
host_name mysql-dbserver
}
The log file monitoring is okay, but knowing when the entire database
is locked out is far more useful I feel.
regards,
Mark
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list