+

Permit to specify ReportPage apt-cacher-ng parameter value using -r parameter

Benjamin Renard [2015-06-30 15:00:09]
Permit to specify ReportPage apt-cacher-ng parameter value using -r parameter
Filename
README
check_apt_cacher_ng
diff --git a/README b/README
index e7f4d2a..ae43c36 100644
--- a/README
+++ b/README
@@ -20,6 +20,7 @@ Requirements
  - egrep
  - tail
  - awk
+ - wget

 Copyright
 ---------
diff --git a/check_apt_cacher_ng b/check_apt_cacher_ng
index 3a0bd57..b67801b 100755
--- a/check_apt_cacher_ng
+++ b/check_apt_cacher_ng
@@ -2,6 +2,7 @@

 HOST=127.0.0.1
 PORT=3142
+REPORTPAGE=acng-report.html
 DO_PERFDATA=0
 DEBUG=0

@@ -11,13 +12,14 @@ Usage : check_apt_cacher_ng [-H hostaddress] [-p port] [-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)
   -P			Include performance data
   -d			Enable debug mode
   -h			Show this help message
 EOF
 }

-while getopts "H:p:Pdh" OPTION
+while getopts "H:p:r:Pdh" OPTION
 do
 	case $OPTION in
 		H)
@@ -26,6 +28,9 @@ do
 		p)
 			PORT=$OPTARG
 		;;
+		r)
+			REPORTPAGE=$OPTARG
+		;;
 		P)
 			DO_PERFDATA=1
 		;;
@@ -60,8 +65,9 @@ then
 	exit 3
 fi

-debug "Get apt-cacher-ng stats from $HOST:$PORT"
-stats=$( wget -q -O - http://$HOST:$PORT/acng-report.html?doCount=Count+Data#top )
+stats_url="http://$HOST:$PORT/$REPORTPAGE?doCount=Count+Data#top"
+debug "Get apt-cacher-ng stats from $HOST:$PORT (URL : $stats_url)"
+stats=$( wget -q -O - $stats_url )

 if [ $? -ne 0 ]
 then
ViewGit