On Sun, Mar 16, 2014 at 3:37 PM, <[email protected]> wrote: > On the web server, when priming begins, have > http://web.server/status.html > return the string "priming". When priming is > complete, return the string "operational".
This is where I'd start, too. There are a bunch of conditions that you could watch for, here: * Error/hard down - socket fails to respond to connections entirely. Page the cavalry, posthaste! - the daemon is probably dead. * Warning - accepts connections, maybe the healthcheck returns something, but the site does not function - but it says that it should be operational - or any other unexpected state. Depending on how critical the service is, this might or might not be page-worthy. The unexpected states will be the things that need monitoring next. ;-) * Informational - healthcheck returns 'priming'. Probably just wait. * Green light - healthcheck returns 'operational' - if it's not always working from this state, your monitoring is still insufficient. :) Any site with 'priming' in the healthcheck should be expected to be redirected to an explanatory custom 503 page that explains that the site is in maintenance state... probably at the layer where a load balancer is managing the traffic and can make those decisions. best, --e > This could be extended to give a status of each site by name (whether it is > priming or not), and use that to drive whether Nagios checks the site or not. > => > => > => On Sun, Mar 16, 2014 at 11:07 AM, Murphy-Olson, Daniel E. < > => [email protected]> wrote: > => > => > > > => > > Ideally I guess I'm looking for some sort of system wherein I can a) > => > pull URIs from a database, b) monitor up/downtime, and c) introduce some > => > sort of priming logic after maintenance. > => > > > => > > Is there a commercial product out there that would do this, or are we > => > going to have to roll our own? > > Write your own shell script to do the web status checks, called as a > Nagios plugin*, returning Nagios-compatible status results (and more > human-readable results, depending on the command line flags). For example: > > ########################################################## > #! /bad/pseudo-code > statusURL=http://web.server/status.html > URLlist=/file/with/list/of/URLS/to/test # in the form: > # http://url.to.check expected string > returntype=nagios > > if [ "X$1" = "X-h" ] ; then > # return human-readable results > returntype=human > fi > > status=`curl $statusURL` > > case $status in > priming) > returnval=0 > returntxt="WARNING: priming web data" > if [ $returntype = "human" ] ; then > returntxt="$statusURL contains the text 'priming'" > fi > echo $returntxt > exit $returnval > ;; > > operational) > while read line > do > URL=`echo $line | cut -d" " -f1` > teststring=`echo $line | cut -d" " -f2-` > status=`curl $URL` > echo $status | grep -qw "$teststring" > if [ $? = 0 ] ; then > # OK > returntxt="${returntxt}<BR>OK: $URL" > else > returntxt="${returntxt}<BR>CRITICAL: $URL" > returnval=2 > fi > done < $URLlist > if [ $returnval = 0 ] ; then > echo "OK: all web sites<BR>$returntxt" > else > echo "CRITICAL: $returntxt" > fi > exit $returnval > ;; > > *) > returnval=2 > returntxt="CRITICAL: could not determine webserver status > from $statusURL" > echo $returntxt > exit $returnval > ;; > esac > ########################################################## > > * Please follow the Nagios plugin specs: > https://nagios-plugins.org/doc/guidelines.html > > Thanks, > > Mark > > > -- > Mark Bergman Biker, Rock Climber, Unix mechanic, IATSE #1 Stagehand > '94 Yamaha GTS1000A^2 > [email protected] > > http://wwwkeys.pgp.net:11371/pks/lookup?op=get&search=bergman%40panix.com > > I want a newsgroup with a infinite S/N ratio! Now taking CFV on: > rec.motorcycles.stagehands.pet-bird-owners.pinballers.unix-supporters > 15+ So Far--Want to join? Check out: http://www.panix.com/~bergman > _______________________________________________ > Discuss mailing list > [email protected] > https://lists.lopsa.org/cgi-bin/mailman/listinfo/discuss > This list provided by the League of Professional System Administrators > http://lopsa.org/ _______________________________________________ Discuss mailing list [email protected] https://lists.lopsa.org/cgi-bin/mailman/listinfo/discuss This list provided by the League of Professional System Administrators http://lopsa.org/
