diff --git a/global/overlay/usr/lib/nagios/plugins/check_eidastest_prod.sh b/global/overlay/usr/lib/nagios/plugins/check_eidastest_prod.sh index 5e448b95..c11e67d1 100755 --- a/global/overlay/usr/lib/nagios/plugins/check_eidastest_prod.sh +++ b/global/overlay/usr/lib/nagios/plugins/check_eidastest_prod.sh @@ -23,6 +23,8 @@ calculate_time() { echo $diff } +###Check if the exection is too old + exec_time=$(echo "$exec_status" | jq --raw-output '."last execution result".executiontimestamp') exec_time_result=$? @@ -38,6 +40,9 @@ if [ "$diff_exec_time" -gt "$day" ]; then fi + +###Check how many lands are not executed, exit critical if it is more than two + raw_not_executed_test=$(echo "$exec_status" | jq --raw-output '."last execution result".notExecutedTests[2]') declare -a not_executed_test=($(echo "$raw_not_executed_test" | tr "\n" " ")) @@ -48,6 +53,22 @@ then exit $STATE_CRITICAL fi + +###Exit critical if no tests have passed + +raw_passed_tests=$(echo "$exec_status" | jq --raw-output '."last execution result".passed[0].result') + +declare -a passed_tests=($(echo "$raw_passed_tests" | tr "\n" " ")) + +if [ "$passed_tests" == null ] +then + echo "No tests have passed" + exit $STATE_CRITICAL +fi + + +###Check which tests have failed, warn if it has been failing for 12 hours, be critical if it has been failing for more than a day + raw_lands=$(echo "$exec_status" | jq --raw-output '."last execution result".failed[].result') raw_lands_result=$? diff --git a/global/overlay/usr/lib/nagios/plugins/check_eidastest_qa.sh b/global/overlay/usr/lib/nagios/plugins/check_eidastest_qa.sh index 07d70683..ae1f2911 100755 --- a/global/overlay/usr/lib/nagios/plugins/check_eidastest_qa.sh +++ b/global/overlay/usr/lib/nagios/plugins/check_eidastest_qa.sh @@ -23,6 +23,9 @@ calculate_time() { echo $diff } + +###Check if the exection is too old + exec_time=$(echo "$exec_status" | jq --raw-output '."last execution result".executiontimestamp') exec_time_result=$? @@ -38,6 +41,8 @@ if [ "$diff_exec_time" -gt "$day" ]; then fi +###Check if XA, XB are not executed + raw_not_executed_test=$(echo "$exec_status" | jq --raw-output '."last execution result".notExecutedTests[]') declare -a not_executed_test=($(echo "$raw_not_executed_test" | tr "\n" " ")) @@ -48,6 +53,21 @@ then exit $STATE_CRITICAL fi +###Exit critical if no tests have passed + +raw_passed_tests=$(echo "$exec_status" | jq --raw-output '."last execution result".passed[0].result') + +declare -a passed_tests=($(echo "$raw_passed_tests" | tr "\n" " ")) + +echo $passed_tests + +if [ "$passed_tests" == null ] +then + echo "No tests have passed" + exit $STATE_CRITICAL +fi + +#Check if any of the failed tests are XA, XB raw_lands=$(curl -s https://api.swedenconnect.se/testid/qa/execution-status | jq --raw-output '."last execution result".failed[].result')