impvored nagios check scripts
This commit is contained in:
parent
24404af1e3
commit
cfeed88b6e
2 changed files with 27 additions and 12 deletions
|
@ -2,16 +2,17 @@
|
|||
|
||||
. /usr/lib/nagios/plugins/utils.sh
|
||||
|
||||
check_return() {
|
||||
if [[ $1 -ne 0 ]]; then
|
||||
echo "CRITICAL - Service FAIL"
|
||||
exit $STATE_CRITICAL
|
||||
fi
|
||||
}
|
||||
|
||||
exec_status=$(curl -s https://api.swedenconnect.se/testid/prod/execution-status | jq --raw-output .)
|
||||
|
||||
exec_status_result=$?
|
||||
|
||||
|
||||
if [[ $exec_status_result -ne 0 ]]; then
|
||||
echo "CRITICAL - Service FAIL"
|
||||
exit $STATE_CRITICAL
|
||||
fi
|
||||
check_return "$exec_status_result"
|
||||
|
||||
calculate_time() {
|
||||
md_date=$(date -d "$1" +%s)
|
||||
|
@ -24,6 +25,9 @@ calculate_time() {
|
|||
|
||||
exec_time=$(echo "$exec_status" | jq --raw-output '."last execution result".executiontimestamp')
|
||||
|
||||
exec_time_result=$?
|
||||
check_return "$exec_time_result"
|
||||
|
||||
diff_exec_time=$(calculate_time "$exec_time")
|
||||
|
||||
day=$(( 24 * 3600))
|
||||
|
@ -36,6 +40,9 @@ fi
|
|||
|
||||
raw_lands=$(echo "$exec_status" | jq --raw-output '."last execution result".failed[].result')
|
||||
|
||||
raw_lands_result=$?
|
||||
check_return "$raw_lands_result"
|
||||
|
||||
declare -a lands=($(echo "$raw_lands" | tr "\n" " "))
|
||||
|
||||
exit_status_warning=0
|
||||
|
|
|
@ -2,15 +2,17 @@
|
|||
|
||||
. /usr/lib/nagios/plugins/utils.sh
|
||||
|
||||
check_return() {
|
||||
if [[ $1 -ne 0 ]]; then
|
||||
echo "CRITICAL - Service FAIL"
|
||||
exit $STATE_CRITICAL
|
||||
fi
|
||||
}
|
||||
|
||||
exec_status=$(curl -s https://api.swedenconnect.se/testid/qa/execution-status | jq --raw-output .)
|
||||
|
||||
exec_status_result=$?
|
||||
|
||||
|
||||
if [[ $exec_status_result -ne 0 ]]; then
|
||||
echo "CRITICAL - Service FAIL"
|
||||
exit $STATE_CRITICAL
|
||||
fi
|
||||
check_return "$exec_status_result"
|
||||
|
||||
calculate_time() {
|
||||
md_date=$(date -d "$1" +%s)
|
||||
|
@ -23,6 +25,9 @@ calculate_time() {
|
|||
|
||||
exec_time=$(echo "$exec_status" | jq --raw-output '."last execution result".executiontimestamp')
|
||||
|
||||
exec_time_result=$?
|
||||
check_return "$exec_time_result"
|
||||
|
||||
diff_exec_time=$(calculate_time "$exec_time")
|
||||
|
||||
day=$(( 24 * 3600))
|
||||
|
@ -36,6 +41,9 @@ fi
|
|||
|
||||
raw_lands=$(curl -s https://api.swedenconnect.se/testid/qa/execution-status | jq --raw-output '."last execution result".failed[].result')
|
||||
|
||||
raw_lands_result=$?
|
||||
check_return "$raw_lands_result"
|
||||
|
||||
declare -a lands=($(echo $raw_lands | tr "\n" " "))
|
||||
|
||||
exit_status=0
|
||||
|
|
Loading…
Add table
Reference in a new issue