forked from bdossantos/nagios-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_influxdb.sh
More file actions
executable file
·47 lines (44 loc) · 890 Bytes
/
Copy pathcheck_influxdb.sh
File metadata and controls
executable file
·47 lines (44 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env bash
#
# Check InfluxDB plugin for Nagios
#
# Usage: check_influxdb.sh [-H host] [-P port]
# -H, --host Hostname
# -P, --port Port, eg: 8086
# -h, --help Display this screen
#
# (c) 2014, Benjamin Dos Santos <benjamin.dossantos@gmail.com>
# https://github.com/bdossantos/nagios-plugins
#
while [[ -n "$1" ]]; do
case "$1" in
--hostname | -H)
hostname=$2
shift
;;
--port | -P)
port=$2
shift
;;
--help | -h)
sed -n '2,9p' "$0" | tr -d '#'
exit 3
;;
*)
echo "Unknown argument: $1"
exec "$0" --help
exit 3
;;
esac
shift
done
hostname=${hostname:=127.0.0.1}
port=${port:=8086}
url="http://${hostname}:${port}/ping?wait_for_leader=1s"
if curl -s -I "$url" >/dev/null; then
echo "OK - InfluxDB is up & running"
exit 0
else
echo "CRITICAL - InfluxDB is KO"
exit 2
fi