hobbit/bb 403 is green?

Lisa Kachold lisakachold at obnosis.com
Mon Nov 2 12:36:37 MST 2009


On Mon, Nov 2, 2009 at 8:58 AM, der.hans <PLUGd at lufthans.com> wrote:

> moin moin,
>
> added monitoring for a borken web server to hobbit last night and a 403
> forbidden is giving a green status. Seems foolish that a hard error would
> be marked as OK.
>
> How do I get hobbit to correctly mark a 403 as being down?
>
> I don't see anything about this in the bb-hosts man page :(.
>

This is a possible but only through a source code change (and rebuild):



in bbnet/httpresult.c there's this : in bbnet / httpresult.c there's this:

switch(status) { switch (status) (
case 000: /* transportlayer reports error */ case 000: / * transportlayer
reports error * /
result = (h->dialup ? COL_CLEAR : COL_RED); result = (h-> dialup? COL_CLEAR:
COL_RED);
break; break;
case 100: /* Continue - should be ok */ case 100: / * Continue - should be
ok * /
case 200: case 201: case 202: case 203: case 204: case 205: case 206: case
200: case 201: case 202: case 203: case 204: case 205: case 206:
case 301: case 302: case 303: case 307: case 301: case 302: case 303: case
307:
case 401: case 403: /* Is "Forbidden" an OK status ? */ case 401: case 403:
/ * Is "Forbidden" an OK status? * /
result = COL_GREEN; result = COL_GREEN;
break; break;
case 400: case 404: case 405: case 406: case 400: case 404: case 405: case
406:
result = COL_RED; /* Trouble getting page */ result = COL_RED; / * Trouble
getting page * /
break; break;
case 500: case 500:
case 501: case 501:
case 502: /* Proxy error */ case 502: / * Proxy error * /
case 503: case 503:
case 504: case 504:
case 505: case 505:
result = COL_RED; /* Server error */ result = COL_RED; / * Server error * /
break; break;


You can modify it and rebuild your Hobbit server. You can modify it and
rebuild your Hobbit server.


-- --

■/hobbit-4.2.0/bbnet/httpresult.c ■ / hobbit-4.2.0/bbnet/httpresult.c

: :
static char rcsid[] = "$Id: httpresult.c,v 1.25 2006/07/20 16:06:41 henrik
Rel $"; static char rcsid [] = "$ Id: httpresult.c, v 1.25 2006/07/20
16:06:41 henrik Rel $";

#include # include
#include # include
#include # include
#include # include
#include # include
#include # include
#include # include

#include "libbbgen.h" # include "libbbgen.h"

#include "bbtest-net.h" # include "bbtest-net.h"
#include "contest.h" # include "contest.h"
#include "httpresult.h" # include "httpresult.h"

static int statuscolor(testedhost_t *h, long status) static int statuscolor
(testedhost_t * h, long status)
{ (
int result; int result;

switch(status) { switch (status) (
case 000: /* transportlayer reports error */ case 000: / * transportlayer
reports error * /
result = (h->dialup ? COL_CLEAR : COL_RED); result = (h-> dialup? COL_CLEAR:
COL_RED);
break; break;
case 100: /* Continue - should be ok */ case 100: / * Continue - should be
ok * /
case 200: case 201: case 202: case 203: case 204: case 205: case 206: case
200: case 201: case 202: case 203: case 204: case 205: case 206:
case 301: case 302: case 303: case 307: case 301: case 302: case 303: case
307:
case 401: case 403: /* Is "Forbidden" an OK status ? */ case 401: case 403:
/ * Is "Forbidden" an OK status? * /
result = COL_GREEN; result = COL_GREEN;
break; break;
case 400: case 404: case 405: case 406: case 400: case 404: case 405: case
406:
result = COL_RED; /* Trouble getting page */ result = COL_RED; / * Trouble
getting page * /
break; break;
case 500: case 500:
case 501: case 501:
case 502: /* Proxy error */ case 502: / * Proxy error * /
case 503: case 503:
case 504: case 504:
case 505: case 505:
result = COL_RED; /* Server error */ result = COL_RED; / * Server error * /
break; break;
case STATUS_CONTENTMATCH_FAILED: case STATUS_CONTENTMATCH_FAILED:
result = COL_RED; /* Pseudo status: content match fails */ result = COL_RED;
/ * Pseudo status: content match fails * /
break; break;
case STATUS_CONTENTMATCH_BADREGEX: /* Pseudo status: bad regex to match
against */ case STATUS_CONTENTMATCH_BADREGEX: / * Pseudo status: bad regex
to match against * /
case STATUS_CONTENTMATCH_NOFILE: /* Pseudo status: content match requested,
but no match-file */ case STATUS_CONTENTMATCH_NOFILE: / * Pseudo status:
content match requested, but no match-file * /
result = COL_YELLOW; result = COL_YELLOW;
break; break;
default: default:
result = COL_YELLOW; /* Unknown status */ result = COL_YELLOW; / * Unknown
status * /
break; break;
} )

return result; return result;
} )

: :
: :
: :

Reference:  http://fungk.exblog.jp/i3

You can modify it and rebuild source. Get the source code and lock the
package in your distro, like we do for custom (Server Tokens) Apache2, or
LAMP builds.

ciao,
>
> der.hans
> --
> #  http://www.LuftHans.com/        http://www.ABLEconf.com/
> #  Director of Engineering, FonWallet Transaction Solutions, Inc.
> #  Intelligence without compassion is a waste.  -- der.hans
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>



-- 
Skype: (623)239-3392
AT&T: (503)754-4452
www.obnosis.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20091102/0b408b08/attachment.htm 


More information about the PLUG-discuss mailing list