Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

heck for dependencies between check_source and failing services #73

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Unable to talk to NTP daemon. Is it running?
26 changes: 24 additions & 2 deletions icinga-diagnostics.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ echo ""

## Static variables ##

OPTSTR="fhtzg"
OPTSTR="fhtzgs"

TIMESTAMP=$(date +%Y%m%d)
UNAME_S=$(uname -s)
Expand Down Expand Up @@ -78,6 +78,7 @@ show_help() {
-t create a tarball instead of just printing the output
-z list all zones in standard output (ignored in "full" mode)
-g provide gdb output for debugging
-s list all servicies which are not okay. You should give first the zones names, on which the service have to be checkecd.
"
exit 0
}
Expand Down Expand Up @@ -208,7 +209,27 @@ doc_icinga2() {
echo "GDB mode requested but gdb not found"
fi
fi

# Checking not okay servicies on the given zones
if [ "${SERVICES}" = true ];
then
echo "please give the Zones, on which the not okay services will be checked. When you are finish press 0"
while :
do
read input
if [ "${input}" != "0" ]
then
zones+=("${input}")
else break
fi
done
for zone in "${zones[@]}"
do
SERVICESFILTER=$(curl -k -s -u root:icinga -H 'Accept: application/json' -H 'X-HTTP-Method-Override: GET' -X POST "https://127.0.0.1:5665/v1/objects/services?filter=service.last_check_result.check_source%3D%3D%22$zone%22%26%26service.state%3E0" -d '{ "pretty": true }' | awk ' /__name/ { match($0, ": \"([^\"]+)\"", m); print m[1] }')
SERVICENUMBER=$(curl -k -s -u root:icinga -H 'Accept: application/json' -H 'X-HTTP-Method-Override: GET' -X POST "https://127.0.0.1:5665/v1/objects/services?filter=service.last_check_result.check_source%3D%3D%22$zone%22%26%26service.state%3E0" -d '{ "pretty": true }' | awk ' /__name/ { match($0, ": \"([^\"]+)\"", m); print m[1] }' | wc -l)
echo "********************** Not okay services on $zone are $SERVICENUMBER **********************"
echo "${SERVICESFILTER}"
done
fi
}

doc_icingaweb2() {
Expand Down Expand Up @@ -488,6 +509,7 @@ do
t) create_tarball;;
z) ZONES=true;;
g) GDB=true;;
s) SERVICES=true;;
esac
done

Expand Down