Show
Ignore:
Timestamp:
03/01/10 23:36:34 (4 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1267486594 +0000
git-parent:

[3df07255b700b6e5b6e3a371254ce2ee165af251]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1267486594 +0000
Message:

body matched should show up as metrics too

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/modules-lua/noit/module/http.lua

    rcc06538 r54c26d5  
    207207    local starttime = noit.timeval.now() 
    208208    local method = check.config.method or "GET" 
     209    local max_len = 80 
    209210 
    210211    -- expect the worst 
     
    342343    if check.config.body ~= nil then 
    343344      local bodyre = noit.pcre(check.config.body) 
    344       if bodyre ~= nil and bodyre(output) then 
     345      local rv, m, m1 = bodyre(output or '') 
     346      if rv then 
     347        m = m1 or m or output 
     348        if string.len(m) > max_len then 
     349          m = string.sub(m,1,max_len) 
     350        end 
    345351        status = status .. ',body=matched' 
     352        check.metric_string('body_match', m) 
    346353      else 
    347354        status = status .. ',body=failed' 
     355        check.metric_string('body_match', nil) 
    348356        good = false 
    349357      end