Lawrence Giam lawrenceg at globalitcreations.com
Mon Mar 1 00:55:07 PST 2010
Hi All,
 
I am trying to setup a monitoring system using nagios to monitor the
Slony replication. I did some changes to the psql_replication_check.pl
script but I am not getting the correct response back from the script.
The script is suppose to check the threshold but after shutting down the
slon daemon on the slave, the result return is still positive.
 
I hereby include the part of the script that I have changed.
 
my $query = 'SELECT * FROM _abc.sl_status' ;
 
# Get the results
## Update to use sl_status
## tuple[0] : st_origin
## tuple[1] : st_received
## tuple[2] : st_last_event
## tuple[3] : st_last_event_ts
## tuple[4] : st_last_received
## tuple[5] : st_last_received_ts
## tuple[6] : st_last_received_event_ts
## tuple[7] : st_lag_num_events
## tuple[8] : st_lag_time
@tuple = $res->fetchrow;
 
# Debugging
# Uncomment the below to swap the minute for seconds.  This is to
simulate
# crazy replication times for when replication is not falling behind.
#$rep_time[1] = $rep_time[2]
 
# Check for a warning
if ($tuple[8] >= $threshold_warning and $tuple[8] < $threshold_critical)
{
       print("WARNING: ST_Origin $tuple[0], ST_Received $tuple[1],
Behind $tuple[8] minutes\n");
       exit(1);
}
# Or for a critical
elsif ($tuple[8] >= $threshold_critical)
{
       print("CRITICAL: ST_Origin $tuple[0], ST_Received $tuple[1],
Behind $tuple[8] minutes\n");
       exit(2);
}
# Otherwise, everything is ok
else
{
        printf("OK: ST_Origin $tuple[0], ST_Received $tuple[1], Behind
$tuple[8] minute%s\n",$tuple[8] == 1 ? "" : "s" );
        exit(0);
}
 
I am trying to use the sl_status st_lag_time to check the lag difference
but somehow the script is not right. Can anyone help me change the
script?
 

Regards,

........................................................................
..........................
Lawrence Giam | Global IT Creations Pte Ltd |  Network Administrator  
website: http://www.globalitcreations.com
<http://www.globalitcreations.com/> 
phone: +65 6836 4768 ext 115| fax: + 65 6836 4736 | mobile: + 65 9758
7448 

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.slony.info/pipermail/slony1-general/attachments/20100301/ea262fe7/attachment.htm 


More information about the Slony1-general mailing list