[Mon-commit] mon/mon.d http.monitor, 1.1.1.1, 1.1.1.1.4.1 snmpdiskspace.monitor, 1.1.2.1, 1.1.2.2
Brought to you by:
trockij
From: Jim T. <tr...@us...> - 2007-05-08 11:05:56
|
Update of /cvsroot/mon/mon/mon.d In directory sc8-pr-cvs16:/tmp/cvs-serv16113/mon.d Modified Files: Tag: mon-1-2-branch http.monitor snmpdiskspace.monitor Log Message: added -m to http.monitor fixed path to perl in snmpdiskspace.monitor Index: http.monitor =================================================================== RCS file: /cvsroot/mon/mon/mon.d/http.monitor,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.4.1 diff -C2 -d -r1.1.1.1 -r1.1.1.1.4.1 *** http.monitor 9 Jun 2004 05:18:05 -0000 1.1.1.1 --- http.monitor 8 May 2007 11:05:48 -0000 1.1.1.1.4.1 *************** *** 11,14 **** --- 11,15 ---- # -a agent User-Agent, default to "mon.d/http.monitor" # -o omit http headers from healthy hosts + # -m regex match regex in response (header + content) # # Jon Meek *************** *** 40,48 **** sub httpGET; ! getopts ("p:t:u:a:o"); $PORT = $opt_p || 80; $TIMEOUT = $opt_t || 30; $URL = $opt_u || "/"; $USERAGENT = $opt_a || "mon.d/http.monitor"; my %good; --- 41,50 ---- sub httpGET; ! getopts ("p:t:u:a:m:o"); $PORT = $opt_p || 80; $TIMEOUT = $opt_t || 30; $URL = $opt_u || "/"; $USERAGENT = $opt_a || "mon.d/http.monitor"; + $MATCHRE = $opt_m; my %good; *************** *** 102,106 **** my $Path = $URL; ! my $result; ############################################################### --- 104,112 ---- my $Path = $URL; ! my $result = { ! "ok" => 0, ! "error" => undef, ! "header" => undef, ! }; ############################################################### *************** *** 129,164 **** } - # HTTP/1.1 200 OK - - if ($TheContent =~ /^HTTP\/([\d\.]+)\s+(200|30[12]|401)\b/) { - $ServerOK = 1; - } else { - $ServerOK = 0; - } - close(S); alarm 0; # Cancel the alarm - }; ! my ($header) = ($TheContent =~ /^(.*?)\r?\n\r?\n/s); ! if ($EVAL_ERROR and ($EVAL_ERROR =~ /^Timeout Alarm/)) { ! return { ! "ok" => 0, ! "error" => "timeout after $TIMEOUT seconds", ! "header" => $header, ! }; } ! if ($result->{"error"} ne "") { ! return $result; } ! return { ! "ok" => $ServerOK, ! "header" => $header, ! "error" => undef, ! }; } --- 135,166 ---- } close(S); alarm 0; # Cancel the alarm }; ! ($result->{"header"}) = ($TheContent =~ /^(.*?)\r?\n\r?\n/s); ! if ($TheContent =~ /^HTTP\/([\d\.]+)\s+(200|30[12]|401)\b/) { ! $result->{"ok"} = 1; ! } else { ! $result->{"ok"} = 0; ! $result->{"error"} = "HTTP response code failure"; } ! if ($MATCHRE ne "") { ! if ($TheContent =~ /$MATCHRE/s) { ! $result->{"ok"} = 1; ! } else { ! $result->{"ok"} = 0; ! $result->{"error"} = $error = "Regex match failed"; ! } } ! if ($EVAL_ERROR and ($EVAL_ERROR =~ /^Timeout Alarm/)) { ! $result->{"ok"} = 0; ! $result->{"error"} = "timeout after $TIMEOUT seconds"; ! } ! ! return $result; } Index: snmpdiskspace.monitor =================================================================== RCS file: /cvsroot/mon/mon/mon.d/snmpdiskspace.monitor,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** snmpdiskspace.monitor 2 May 2007 23:25:07 -0000 1.1.2.1 --- snmpdiskspace.monitor 8 May 2007 11:05:49 -0000 1.1.2.2 *************** *** 1,3 **** ! #!/usr/local/bin/perl # # NAME --- 1,3 ---- ! #!/usr/bin/perl # # NAME |