[Reconnoiter-devel] [reconnoiter commit] Reconnoiter branch, master, updated. 3c4929015c7e763c1aa84c4ecf095f93e09a936f
git at labs.omniti.com
git at labs.omniti.com
Tue Sep 27 02:28:18 EDT 2011
Pushed by: jesus
The branch, master has been updated
via 3c4929015c7e763c1aa84c4ecf095f93e09a936f (commit)
via 4d67783cefed3fcbb1d0054cfd469b63262bc00c (commit)
via a751ee3a3bc1a06eae2a8ee36c8b0a1481cb33c9 (commit)
via 1d8f8ae0cbbab03f5d3e252a3cb0ff01cdf1b565 (commit)
via 48509f8af144c17f11fe6dee153726c6ca9636cf (commit)
from 559e017dc530d5467cb14742be11d9f328bf4e01 (commit)
Summary of changes:
src/modules-lua/noit/module/tcp.lua | 45 +++++++++++++++++++++++++++++++++++
1 files changed, 45 insertions(+), 0 deletions(-)
Log:
commit 3c4929015c7e763c1aa84c4ecf095f93e09a936f
Merge: 559e017 4d67783
Author: Theo Schlossnagle <jesus at omniti.com>
Date: Tue Sep 27 02:28:12 2011 -0400
Merge branch 'master' of github.com:omniti-labs/reconnoiter
commit 4d67783cefed3fcbb1d0054cfd469b63262bc00c
Merge: bc45558 a751ee3
Author: Theo Schlossnagle <jesus at lethargy.org>
Date: Mon Sep 26 23:27:38 2011 -0700
Merge pull request #20 from rphillips/features/tcp_body
Changes to tcp check for send_body and body_match
commit a751ee3a3bc1a06eae2a8ee36c8b0a1481cb33c9
Author: Ryan Phillips <ryan.phillips at rackspace.com>
Date: Thu Sep 22 11:26:31 2011 -0500
mark check bad and check for rc < 0
diff --git a/src/modules-lua/noit/module/tcp.lua b/src/modules-lua/noit/module/tcp.lua
index 74593da..40fcf03 100644
--- a/src/modules-lua/noit/module/tcp.lua
+++ b/src/modules-lua/noit/module/tcp.lua
@@ -181,8 +181,9 @@ function initiate(module, check)
end
if check.config.send_body ~= nil then
- if e:write(check.config.send_body) == -1 then
- check.status("received hangup")
+ if e:write(check.config.send_body) < 0 then
+ check.bad()
+ check.status("send_body: received hangup")
return
end
end
commit 1d8f8ae0cbbab03f5d3e252a3cb0ff01cdf1b565
Author: Ryan Phillips <ryan.phillips at rackspace.com>
Date: Wed Sep 21 22:46:44 2011 -0500
add return code check and parse for key value pairs
diff --git a/src/modules-lua/noit/module/tcp.lua b/src/modules-lua/noit/module/tcp.lua
index ec97567..74593da 100644
--- a/src/modules-lua/noit/module/tcp.lua
+++ b/src/modules-lua/noit/module/tcp.lua
@@ -181,7 +181,10 @@ function initiate(module, check)
end
if check.config.send_body ~= nil then
- e:write(check.config.send_body)
+ if e:write(check.config.send_body) == -1 then
+ check.status("received hangup")
+ return
+ end
end
-- match banner
@@ -213,26 +216,35 @@ function initiate(module, check)
-- match body
if check.config.body_match ~= nil then
- local bodybytetime = noit.timeval.now()
str = e:read(1024)
if str == nil then
check.status("bad body length " .. (str and str:len() or "0"))
return
end
+ local bodybytetime = noit.timeval.now()
elapsed(check, "tt_body", starttime, bodybytetime)
- local bodyre = noit.pcre(check.config.body_match)
- if bodyre ~= nil then
- local rv = true
- rv, m = bodyre(str)
+ local exre = noit.pcre(check.config.body_match)
+ local rv = true
+ local found = false
+ local m = nil
+ while rv and m ~= '' do
+ rv, m, key, value = exre(str or '', { limit = pcre_match_limit })
if rv then
- status = status .. ',body_match=matched'
- else
- good = false
- status = status .. ',body_match=failed'
+ found = true
+ if key ~= nil then
+ check.metric(key, value)
+ end
end
end
+ if found then
+ status = status .. ',body_match=matched'
+ else
+ good = false
+ status = status .. ',body_match=failed'
+ end
+
check.metric_string('body',str)
end
commit 48509f8af144c17f11fe6dee153726c6ca9636cf
Author: Ryan Phillips <ryan.phillips at rackspace.com>
Date: Wed Sep 21 21:29:56 2011 -0500
Changes to tcp check for send_body and body_match
Contributors: Paul Querna <pquerna at apache.org>
diff --git a/src/modules-lua/noit/module/tcp.lua b/src/modules-lua/noit/module/tcp.lua
index 5205df4..ec97567 100644
--- a/src/modules-lua/noit/module/tcp.lua
+++ b/src/modules-lua/noit/module/tcp.lua
@@ -43,6 +43,10 @@ function onload(image)
allowed="\d+">Specifies the port on which the management interface can be reached.</parameter>
<parameter name="banner_match" required="optional"
allowed=".+">This regular expression is matched against the response banner. If a match is not found, the check will be marked as bad.</parameter>
+ <parameter name="send_body" required="optional"
+ allowed=".+">Data to send on the socket once connected and optionally SSL is negotiated, but before the body match is tested.</parameter>
+ <parameter name="body_match" required="optional"
+ allowed=".+">This regular expression is matched against the body (the leftover data up to 1024 bytes) after the banner.</parameter>
<parameter name="use_ssl" required="optional" allowed="^(?:true|false|on|off)$" default="false">Upgrade TCP connection to use SSL.</parameter>
<parameter name="ca_chain"
required="optional"
@@ -176,6 +180,9 @@ function initiate(module, check)
end
end
+ if check.config.send_body ~= nil then
+ e:write(check.config.send_body)
+ end
-- match banner
if check.config.banner_match ~= nil then
@@ -204,6 +211,31 @@ function initiate(module, check)
check.metric_string('banner',str)
end
+ -- match body
+ if check.config.body_match ~= nil then
+ local bodybytetime = noit.timeval.now()
+ str = e:read(1024)
+ if str == nil then
+ check.status("bad body length " .. (str and str:len() or "0"))
+ return
+ end
+ elapsed(check, "tt_body", starttime, bodybytetime)
+
+ local bodyre = noit.pcre(check.config.body_match)
+ if bodyre ~= nil then
+ local rv = true
+ rv, m = bodyre(str)
+ if rv then
+ status = status .. ',body_match=matched'
+ else
+ good = false
+ status = status .. ',body_match=failed'
+ end
+ end
+
+ check.metric_string('body',str)
+ end
+
-- turnaround time
local endtime = noit.timeval.now()
local seconds = elapsed(check, "duration", starttime, endtime)
hooks/post-receive
--
Reconnoiter
More information about the Reconnoiter-devel
mailing list