In the message dated: Sun, 16 Mar 2014 13:31:42 -0500,
The pithy ruminations from Chase Hoffman on 
<Re: [lopsa-discuss] Site Monitoring Conundrum> were:
=> Ah, if only the application could be load balanced.  I wish.  Nope, because
=> of the way the data is cached on the app server, it's not currently load
=> balanceable.
=> 
=> My concern with Nagios is that I don't want it to rerun - I want to figure
=> out how to have it NOT hit all sites simultaneously (but in staggered
=> sequence) during a certain window, and then monitor all sites the rest of
=> the time.

This sounds like you need some kind of a web-accessible 'flag', to indicate to
Nagios whether the app is priming or not. In this case, you wouldn't use the
native web tests w/in Nagios, but you'd call a local app to check each site.

For example:

        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 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/

Reply via email to