pcp
[Top] [All Lists]

PMIE Help

To: pcp@xxxxxxxxxxx
Subject: PMIE Help
From: Chandana De Silva <chandana@xxxxxxxxxxxxx>
Date: Fri, 02 Nov 2012 20:59:34 +1100
Reply-to: chandana@xxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1
All,

I am rying to write a rule to check MySQL Slave lag.

I have a simple rule which works, as shown below. What I want to have is a slightly more complex rule which also prints the rate of change, which the number of seconds the slave has caught up or lost in the
last minute. I think I can get that with the calculation for lag_rateofchange.
 I need to have a rule which is something like;

$replication_lag >= $lag_critical && $lag_rateofchange >0
    -> shell "$send_nagios -S MySQL_Replication -s 1 Slave %v seconds behind master, catching up at <X> seconds per minute\n";

How can I get the value of $ lag_rateofchange in the ouput text ? ( I have tried a second %v as suggested by the pmie man page, but that repeated the first value.)

Thanks in advance;
Chandana

//----------------------------------------------------------------------------------------------
// Global variables
//----------------------------------------------------------------------------------------------
// this script sends pmie results to nagios
send_nagios = "/usr/local/bin/send_nagios -nv";

delta = 1 min;
//----------------------------------------------------------------------------------------------
// Simple Slave Replication lag
//----------------------------------------------------------------------------------------------
replication_lag = "mysql.slave_status.seconds_behind_master";
lag_rateofchange = "(( mysql.slave_status.seconds_behind_master @0 - mysql.slave_status.seconds_behind_master @1 ))";
lag_warning=60;
lag_critical=3600;

$replication_lag >= $lag_critical
    -> shell "$send_nagios -S MySQL_Replication -s 1 Slave %v seconds behind master\n";

$replication_lag >= $lag_warning &&
$replication_lag <= $lag_critical
    -> shell "$send_nagios -S MySQL_Replication -s 2 Slave %v seconds behind master\n";

$replication_lag < $lag_warning
    -> shell "$send_nagios -S MySQL_Replication -s 0 Slave %v seconds behind master\n";                                                                                                                                                                  &n bsp;  ;           
                                                                                                                                                                      &nb sp;                                                                                                
//----------------------------------------------------------------------------------------------                                                                                                                                                      &nb sp;                
                                                                                                                                                                      &nb sp;                                                                                                
                                                                                                                                                                      &nb sp;                                                                                                
                                                                                                                                                                      &nb sp;                                                                                                
// vi: set ts=4 et tw=0:                                                        

<Prev in Thread] Current Thread [Next in Thread>