#!/bin/bash
#
# Nagios plugin to check Apt-cacher-ng status
#
# This plugin check apt-cacher-ng status by asking report page.
# It's able to parse result to retreive performance data.
#
# Copyright (c) 2015 Benjamin Renard <brenard@zionetrix.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
HOST=127.0.0.1
PORT=3142
REPORTPAGE=acng-report.html
AUTHINFO=""
USER=""
PASS=""
DO_PERFDATA=0
DEBUG=0
function usage() {
cat << EOF
Usage : check_apt_cacher_ng [-H hostaddress] [-p port] [-r reportpage] [-a user:pass] [-Pdh]
-H hostaddress Specify apt-cacher-ng host address (default=127.0.0.1)
-p post Specify apt-cacher-ng TCP port (default=3142)
-r reportpage Specify apt-cacher-ng ReportPage parameter value (default=acng-report.html)
-a user:pass Specify authentication informations with format 'user:pass'
-P Include performance data
-d Enable debug mode
-h Show this help message
EOF
}
while getopts "H:p:r:a:Pdh" OPTION
do
case $OPTION in
H)
HOST=$OPTARG