Bacula-users

Re: [Bacula-users] Nagios plugin for regression testing

2010-11-17 18:51:03
Subject: Re: [Bacula-users] Nagios plugin for regression testing
From: ganiuszka <ganiuszka AT gmail DOT com>
To: bacula-users AT lists.sourceforge DOT net
Date: Thu, 18 Nov 2010 00:48:03 +0100
W dniu 16.11.2010 03:50, Dan Langille pisze:
> Here is my nagios script for verifying that my regression tests are
> showing up on the server.  Feel free to use it or modify it.  Keep the
> copyright notice please.

Hi,

Thanks for the script. I made a few changes. The following code should 
work on GNU/Linux and FreeBSD also (requires wget). There is extra file 
in which you can update the expected number of tests.

To configure a user name and file location of the expected number of tests.

Best regards.
gani


#!/bin/sh

# Copyright 2010 - Dan Langille <dan AT langille DOT org>
# modify by gani

# Exit codes for Nagios:
# 0 - OK - tests match
# 1 - WARNING - tests count does not match
# 2 - CRITICAL - expected tests count file does not exists

# Expected tests for user
USER='langille'

# Expected tests count file. It content is number of tests expected 
today. (for example 15).
EXPECTED_TESTS_COUNT_FILE='/home/gani/tests/expected_tests_count'

WGET=`which wget`
GREP=`which grep`
HEAD=`which head`

# output returns to stdout, quiet mode
WGET_PARAMS='-O - -q'

TODAY=`date "+%Y-%m-%d"`
URL="http://regress.bacula.org/index.php?project=bacula&date=${TODAY}";

if [ -e ${EXPECTED_TESTS_COUNT_FILE} ]
then
        EXPECTED_TESTS_COUNT=`${HEAD} -n 1 ${EXPECTED_TESTS_COUNT_FILE}`
        TESTS_COUNT=`${WGET} ${WGET_PARAMS} ${URL} | ${GREP} -c ${USER}`

        if [ ${TESTS_COUNT} -eq ${EXPECTED_TESTS_COUNT} ]
        then
                echo "Regression OK for ${TODAY}: Actual count = 
${TESTS_COUNT}. 
Expected count = ${EXPECTED_TESTS_COUNT}"
                EXIT=0
                else
        echo "Missing data for ${TODAY}: Actual count = ${TESTS_COUNT}. 
Expected count = ${EXPECTED_TESTS_COUNT}"
                EXIT=1
        fi
else
        echo "Expected tests count file ${EXPECTED_TESTS_COUNT_FILE} does not 
exists!"
        EXIT=2
fi

exit ${EXIT}

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users

<Prev in Thread] Current Thread [Next in Thread>