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

Benjamin Renard commited on 2015-06-30 15:00:09
Showing 2 changed files, with 10 additions and 3 deletions.

... ...
@@ -20,6 +20,7 @@ Requirements
20 20
  - egrep
21 21
  - tail
22 22
  - awk
23
+ - wget
23 24
 
24 25
 Copyright
25 26
 ---------
... ...
@@ -2,6 +2,7 @@
2 2
 
3 3
 HOST=127.0.0.1
4 4
 PORT=3142
5
+REPORTPAGE=acng-report.html
5 6
 DO_PERFDATA=0
6 7
 DEBUG=0
7 8
 
... ...
@@ -11,13 +12,14 @@ Usage : check_apt_cacher_ng [-H hostaddress] [-p port] [-Pdh]
11 12
 
12 13
   -H hostaddress	Specify apt-cacher-ng host address (default=127.0.0.1)
13 14
   -p post		Specify apt-cacher-ng TCP port (default=3142)
15
+  -r reportpage		Specify apt-cacher-ng ReportPage parameter value (default=acng-report.html)
14 16
   -P			Include performance data
15 17
   -d			Enable debug mode
16 18
   -h			Show this help message
17 19
 EOF
18 20
 }
19 21
 
20
-while getopts "H:p:Pdh" OPTION
22
+while getopts "H:p:r:Pdh" OPTION
21 23
 do
22 24
 	case $OPTION in
23 25
 		H)
... ...
@@ -26,6 +28,9 @@ do
26 28
 		p)
27 29
 			PORT=$OPTARG
28 30
 		;;
31
+		r)
32
+			REPORTPAGE=$OPTARG
33
+		;;
29 34
 		P)
30 35
 			DO_PERFDATA=1
31 36
 		;;
... ...
@@ -60,8 +65,9 @@ then
60 65
 	exit 3
61 66
 fi
62 67
 
63
-debug "Get apt-cacher-ng stats from $HOST:$PORT"
64
-stats=$( wget -q -O - http://$HOST:$PORT/acng-report.html?doCount=Count+Data#top )
68
+stats_url="http://$HOST:$PORT/$REPORTPAGE?doCount=Count+Data#top"
69
+debug "Get apt-cacher-ng stats from $HOST:$PORT (URL : $stats_url)"
70
+stats=$( wget -q -O - $stats_url )
65 71
 
66 72
 if [ $? -ne 0 ]
67 73
 then
68 74