+

Fix plugin name

Benjamin Renard [2015-06-30 14:48:45]
Fix plugin name
Filename
check-apt-cacher-ng
check_apt_cacher_ng
diff --git a/check-apt-cacher-ng b/check-apt-cacher-ng
deleted file mode 100755
index 3a0bd57..0000000
--- a/check-apt-cacher-ng
+++ /dev/null
@@ -1,108 +0,0 @@
-#!/bin/bash
-
-HOST=127.0.0.1
-PORT=3142
-DO_PERFDATA=0
-DEBUG=0
-
-function usage() {
-cat << EOF
-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)
-  -P			Include performance data
-  -d			Enable debug mode
-  -h			Show this help message
-EOF
-}
-
-while getopts "H:p:Pdh" OPTION
-do
-	case $OPTION in
-		H)
-			HOST=$OPTARG
-		;;
-		p)
-			PORT=$OPTARG
-		;;
-		P)
-			DO_PERFDATA=1
-		;;
-		d)
-			DEBUG=1
-		;;
-		h)
-			usage
-			exit 0
-		;;
-		\?)
-			echo "Invalid option: -$OPTARG" >&2
-			usage
-			exit 1
-		;;
-		:)
-			echo "Option -$OPTARG requires an argument." >&2
-			usage
-			exit 1
-		;;
-	esac
-done
-
-function debug() {
-	[ $DEBUG -eq 1 ] && echo "[DEBUG] $1"
-}
-
-html2text -version > /dev/null 2>&1
-if [ $? -ne 0 ]
-then
-	echo "UNKNOWN : html2text command not found"
-	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 )
-
-if [ $? -ne 0 ]
-then
-	echo "CRITICAL : Fail to connect to apt-cacher-ng"
-	exit 2
-fi
-
-stats_line=$( echo -e "$stats"|html2text -width 300|grep '^ *Period' -A 2|tail -n 1 )
-if [ -z "$stats_line" ]
-then
-	echo "WARNING : Fail to parse apt-cacher-ng stats page"
-	exit 1
-fi
-
-if [ $DO_PERFDATA -eq 1 ]
-then
-	cache_req_hits_count=$( echo -e "$stats_line"|awk '{print $6}'|sed 's/^[^0-9]*//' )
-	cache_req_hits_per=$( echo -e "$stats_line"|cut -d '(' -f 2|cut -d')' -f 1|sed 's/^[^0-9]*//' )
-	cache_req_misses_count=$( echo -e "$stats_line"|awk '{print $8}'|sed 's/^[^0-9]*//' )
-	cache_req_misses_per=$( echo -e "$stats_line"|cut -d '(' -f 3|cut -d')' -f 1|sed 's/^[^0-9]*//' )
-	cache_req_total_count=$( echo -e "$stats_line"|awk '{print $10}'|sed 's/^[^0-9]*//' )
-
-	cache_data_hits_count=$( echo -e "$stats_line"|awk '{print $11$12}'|sed 's/^[^0-9]*//' )
-	cache_data_hits_per=$( echo -e "$stats_line"|cut -d '(' -f 4|cut -d')' -f 1|sed 's/^[^0-9]*//' )
-	cache_data_misses_count=$( echo -e "$stats_line"|awk '{print $14$15}'|sed 's/^[^0-9]*//' )
-	cache_data_misses_per=$( echo -e "$stats_line"|cut -d '(' -f 4|cut -d')' -f 1|sed 's/^[^0-9]*//' )
-	cache_data_total_count=$( echo -e "$stats_line"|awk '{print $17$18}'|sed 's/^[^0-9]*//' )
-
-	PERF_DATA="|cache_req_hits_count=$cache_req_hits_count"
-	PERF_DATA="$PERF_DATA,cache_req_hits_per=$cache_req_hits_per"
-	PERF_DATA="$PERF_DATA,cache_req_misses_count=$cache_req_misses_count"
-	PERF_DATA="$PERF_DATA,cache_req_misses_per=$cache_req_misses_per"
-	PERF_DATA="$PERF_DATA,cache_req_total_count=$cache_req_total_count"
-	PERF_DATA="$PERF_DATA,cache_data_hits_count=$cache_data_hits_count"
-	PERF_DATA="$PERF_DATA,cache_data_hits_per=$cache_data_hits_per"
-	PERF_DATA="$PERF_DATA,cache_data_misses_count=$cache_data_misses_count"
-	PERF_DATA="$PERF_DATA,cache_data_misses_per=$cache_data_misses_per"
-	PERF_DATA="$PERF_DATA,cache_data_total_count=$cache_data_total_count"
-else
-	PERF_DATA=""
-fi
-
-echo "OK - Apt-cacher-ng is running$PERF_DATA"
-exit 0
diff --git a/check_apt_cacher_ng b/check_apt_cacher_ng
new file mode 100755
index 0000000..3a0bd57
--- /dev/null
+++ b/check_apt_cacher_ng
@@ -0,0 +1,108 @@
+#!/bin/bash
+
+HOST=127.0.0.1
+PORT=3142
+DO_PERFDATA=0
+DEBUG=0
+
+function usage() {
+cat << EOF
+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)
+  -P			Include performance data
+  -d			Enable debug mode
+  -h			Show this help message
+EOF
+}
+
+while getopts "H:p:Pdh" OPTION
+do
+	case $OPTION in
+		H)
+			HOST=$OPTARG
+		;;
+		p)
+			PORT=$OPTARG
+		;;
+		P)
+			DO_PERFDATA=1
+		;;
+		d)
+			DEBUG=1
+		;;
+		h)
+			usage
+			exit 0
+		;;
+		\?)
+			echo "Invalid option: -$OPTARG" >&2
+			usage
+			exit 1
+		;;
+		:)
+			echo "Option -$OPTARG requires an argument." >&2
+			usage
+			exit 1
+		;;
+	esac
+done
+
+function debug() {
+	[ $DEBUG -eq 1 ] && echo "[DEBUG] $1"
+}
+
+html2text -version > /dev/null 2>&1
+if [ $? -ne 0 ]
+then
+	echo "UNKNOWN : html2text command not found"
+	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 )
+
+if [ $? -ne 0 ]
+then
+	echo "CRITICAL : Fail to connect to apt-cacher-ng"
+	exit 2
+fi
+
+stats_line=$( echo -e "$stats"|html2text -width 300|grep '^ *Period' -A 2|tail -n 1 )
+if [ -z "$stats_line" ]
+then
+	echo "WARNING : Fail to parse apt-cacher-ng stats page"
+	exit 1
+fi
+
+if [ $DO_PERFDATA -eq 1 ]
+then
+	cache_req_hits_count=$( echo -e "$stats_line"|awk '{print $6}'|sed 's/^[^0-9]*//' )
+	cache_req_hits_per=$( echo -e "$stats_line"|cut -d '(' -f 2|cut -d')' -f 1|sed 's/^[^0-9]*//' )
+	cache_req_misses_count=$( echo -e "$stats_line"|awk '{print $8}'|sed 's/^[^0-9]*//' )
+	cache_req_misses_per=$( echo -e "$stats_line"|cut -d '(' -f 3|cut -d')' -f 1|sed 's/^[^0-9]*//' )
+	cache_req_total_count=$( echo -e "$stats_line"|awk '{print $10}'|sed 's/^[^0-9]*//' )
+
+	cache_data_hits_count=$( echo -e "$stats_line"|awk '{print $11$12}'|sed 's/^[^0-9]*//' )
+	cache_data_hits_per=$( echo -e "$stats_line"|cut -d '(' -f 4|cut -d')' -f 1|sed 's/^[^0-9]*//' )
+	cache_data_misses_count=$( echo -e "$stats_line"|awk '{print $14$15}'|sed 's/^[^0-9]*//' )
+	cache_data_misses_per=$( echo -e "$stats_line"|cut -d '(' -f 4|cut -d')' -f 1|sed 's/^[^0-9]*//' )
+	cache_data_total_count=$( echo -e "$stats_line"|awk '{print $17$18}'|sed 's/^[^0-9]*//' )
+
+	PERF_DATA="|cache_req_hits_count=$cache_req_hits_count"
+	PERF_DATA="$PERF_DATA,cache_req_hits_per=$cache_req_hits_per"
+	PERF_DATA="$PERF_DATA,cache_req_misses_count=$cache_req_misses_count"
+	PERF_DATA="$PERF_DATA,cache_req_misses_per=$cache_req_misses_per"
+	PERF_DATA="$PERF_DATA,cache_req_total_count=$cache_req_total_count"
+	PERF_DATA="$PERF_DATA,cache_data_hits_count=$cache_data_hits_count"
+	PERF_DATA="$PERF_DATA,cache_data_hits_per=$cache_data_hits_per"
+	PERF_DATA="$PERF_DATA,cache_data_misses_count=$cache_data_misses_count"
+	PERF_DATA="$PERF_DATA,cache_data_misses_per=$cache_data_misses_per"
+	PERF_DATA="$PERF_DATA,cache_data_total_count=$cache_data_total_count"
+else
+	PERF_DATA=""
+fi
+
+echo "OK - Apt-cacher-ng is running$PERF_DATA"
+exit 0
ViewGit