forked from prometheus/nagios_plugins
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
63 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Avoid locale complications: | ||
export LC_ALL=C |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
function usage() { | ||
|
||
cat <<'EoL' | ||
check_prometheus_metric.sh - Nagios plugin wrapper for checking Prometheus | ||
metrics. Requires curl and jq to be in $PATH. | ||
Usage: | ||
check_prometheus_metric.sh -H HOST -q QUERY -w FLOAT[:FLOAT] -c FLOAT[:FLOAT] -n NAME [-m METHOD] [-O] [-i] [-p] [-t QUERY_TYPE] | ||
Options: | ||
-H HOST URL of Prometheus host to query. | ||
-q QUERY Prometheus query, in single quotes, that returns by default a float or int (see -t). | ||
-w FLOAT[:FLOAT] Warning level value (must be a float or nagios-interval). | ||
-c FLOAT[:FLOAT] Critical level value (must be a float or nagios-interval). | ||
-n NAME A name for the metric being checked. | ||
-m METHOD Comparison method, one of gt, ge, lt, le, eq, ne. | ||
(Defaults to ge unless otherwise specified.) | ||
-C CURL_OPTS Additional flags to pass to curl. | ||
Can be passed multiple times. Options and option values must be passed separately. | ||
e.g. -C --conect-timetout -C 10 -C --cacert -C /path/to/ca.crt | ||
-O Accept NaN as an "OK" result . | ||
-i Print the extra metric information into the Nagios message. | ||
-p Add perfdata to check output. | ||
Examples: | ||
check_prometheus_metric -q 'up{job=\"job_name\"}' :1 -c :1 # Check that job is up. | ||
check_prometheus_metric -q 'node_load1' -w :0.05 -c :0.1 # Check load is OK. | ||
# Aka. that load is below 0.05 and 0.1 respectively. | ||
check_prometheus_metric -q 'go_threads' -w 15:25 -c : # Check thread count is OK. | ||
# Aka. OK if we have 15-25 threads, outside of this; warning, never critical. | ||
EoL | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env bats | ||
|
||
load ../parse | ||
load ../src/parse | ||
|
||
@test "--- ${BATS_TEST_FILENAME} ---" { | ||
true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env bats | ||
|
||
load ../parse | ||
load ../src/parse | ||
|
||
@test "--- ${BATS_TEST_FILENAME} ---" { | ||
true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/usr/bin/env bats | ||
|
||
load ../parse | ||
load ../src/parse | ||
|
||
@test "--- ${BATS_TEST_FILENAME} ---" { | ||
true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
PLUGIN_SCRIPT=check_prometheus_metric.sh | ||
PLUGIN_SCRIPT=build/output.sh | ||
PROMETHEUS_PORT=8090 | ||
PUSHGATEWAY_PORT=8091 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters