<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16981" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=633254608-01032010><FONT face=Arial size=2>Hi
All,</FONT></SPAN></DIV>
<DIV><SPAN class=633254608-01032010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=633254608-01032010><FONT face=Arial size=2>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.</FONT></SPAN></DIV>
<DIV><SPAN class=633254608-01032010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=633254608-01032010><FONT face=Arial size=2>I hereby include the
part of the script that I have changed.</FONT></SPAN></DIV>
<DIV><SPAN class=633254608-01032010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=633254608-01032010><FONT face=Arial size=2>my $query = 'SELECT
* FROM _abc.sl_status' ;</FONT></SPAN></DIV>
<DIV><SPAN class=633254608-01032010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=633254608-01032010><FONT face=Arial size=2># Get the
results<BR>## Update to use sl_status<BR>## tuple[0] : st_origin<BR>## tuple[1]
: st_received<BR>## tuple[2] : st_last_event<BR>## tuple[3] :
st_last_event_ts<BR>## tuple[4] : st_last_received<BR>## tuple[5] :
st_last_received_ts<BR>## tuple[6] : st_last_received_event_ts<BR>## tuple[7] :
st_lag_num_events<BR>## tuple[8] : st_lag_time<BR>@tuple =
$res->fetchrow;</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><SPAN class=633254608-01032010><FONT face=Arial size=2># Debugging<BR>#
Uncomment the below to swap the minute for seconds. This is to
simulate<BR># crazy replication times for when replication is not falling
behind.<BR>#$rep_time[1] = $rep_time[2]</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><SPAN class=633254608-01032010><FONT face=Arial size=2># Check for a
warning<BR>if ($tuple[8] >= $threshold_warning and $tuple[8] <
$threshold_critical)<BR>{<BR>
print("WARNING: ST_Origin $tuple[0], ST_Received $tuple[1], Behind $tuple[8]
minutes\n");<BR>
exit(1);<BR>}</FONT></SPAN></DIV>
<DIV><SPAN class=633254608-01032010><FONT face=Arial size=2># Or for a
critical<BR>elsif ($tuple[8] >=
$threshold_critical)<BR>{<BR>
print("CRITICAL: ST_Origin $tuple[0], ST_Received $tuple[1], Behind $tuple[8]
minutes\n");<BR>
exit(2);<BR>}</FONT></SPAN></DIV>
<DIV><SPAN class=633254608-01032010><FONT face=Arial size=2># Otherwise,
everything is ok<BR>else<BR>{<BR>
printf("OK: ST_Origin $tuple[0], ST_Received $tuple[1], Behind $tuple[8]
minute%s\n",$tuple[8] == 1 ? "" : "s"
);<BR>
exit(0);<BR>}</FONT></SPAN></DIV>
<DIV><SPAN class=633254608-01032010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=633254608-01032010><FONT face=Arial size=2>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?</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<P class=MsoNormal align=left><FONT face=Arial size=1><SPAN
style="mso-no-proof: yes"><STRONG>Regards,</STRONG></SPAN></FONT></P>
<P class=MsoNormal align=left><FONT face="Times New Roman" color=navy><SPAN
style="FONT-SIZE: 12pt; COLOR: navy; mso-no-proof: yes">..................................................................................................</SPAN><SPAN
style="FONT-SIZE: 12pt; COLOR: navy; mso-no-proof: yes"><BR></SPAN></FONT><?xml:namespace
prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags"
/><st1:PersonName><FONT face="Century Gothic" color=#607388 size=1><SPAN
style="FONT-SIZE: 7.5pt; COLOR: #607388; FONT-FAMILY: 'Century Gothic'; mso-no-proof: yes">Lawrence
Giam</SPAN></FONT></st1:PersonName><FONT face="Century Gothic" color=#607388
size=1><SPAN
style="FONT-SIZE: 7.5pt; COLOR: #607388; FONT-FAMILY: 'Century Gothic'; mso-no-proof: yes"> |
Global IT Creations Pte Ltd | Network Administrator <BR>website: <A
href="http://www.globalitcreations.com/">http://www.globalitcreations.com</A><BR></SPAN></FONT><FONT
face="Century Gothic" color=#607388 size=1><SPAN
style="FONT-SIZE: 7.5pt; COLOR: #607388; FONT-FAMILY: 'Century Gothic'; mso-no-proof: yes">phone:
+65 6836 4768 ext 115| fax: + 65 6836 4736 </SPAN><SPAN
style="FONT-SIZE: 7.5pt; COLOR: #607388; FONT-FAMILY: 'Century Gothic'; mso-no-proof: yes">|
mobile: + 65 9758 7448 </SPAN></FONT></P>
<DIV> </DIV></BODY></HTML>