-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added basic monitoring scripts for midPoint
- Loading branch information
root
committed
Jul 16, 2024
1 parent
553a5f2
commit c4bed91
Showing
3 changed files
with
115 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#/bin/bash | ||
|
||
###config settings### | ||
#mp_username='administrator' | ||
#mp_userpass='5ecr3t' | ||
mp_username='banderson' | ||
mp_userpass='Password1' | ||
#################### | ||
|
||
###declarations### | ||
declare -A KeyResources | ||
|
||
###functions### | ||
function getResourceStatus() { | ||
|
||
KeyResources=( ["Grouper"]="fb0bbf07-e33f-4ddd-85a1-16a7edc237f2" ["COmanage"]="edb9e47b-e8ad-48b7-9127-ae7b8911a8f2" ["LDAP"]="0a37121f-d515-4a23-9b6d-554c5ef61272" ) | ||
mp_baseUrl='https://localhost:10443/midpoint/ws/rest' | ||
|
||
for resourcename in "${!KeyResources[@]}"; do | ||
if [ "$resourcename" = "$1" ]; then | ||
thisResourceOid=${KeyResources[$resourcename]} | ||
thisResourceName=$resourcename | ||
fi | ||
done | ||
|
||
url=$mp_baseUrl/resources/$thisResourceOid/test | ||
rawVal=$(curl -s -k --user $mp_username:$mp_userpass -H "Accept: application/json" -X POST $url) | ||
if [ $? -ne 0 ]; then | ||
echo "ERROR: Problem connecting to host. Exiting..." | ||
echo "" | ||
exit 1 | ||
fi | ||
|
||
resourceStatus=$(echo $rawVal | jq -r '.object.status') | ||
echo "Resource Name: $thisResourceName" | ||
#echo "Resource OID: $thisResourceOid" | ||
if [ "$resourceStatus" != "success" ]; then | ||
echo "*** resource has problems (status=$resourceStatus) ***" | ||
else | ||
echo "resource is healthy" | ||
fi | ||
|
||
echo "" | ||
} | ||
|
||
### Main ### | ||
echo "midPoint Resource Health Check" | ||
echo "" | ||
getResourceStatus "Grouper" | ||
getResourceStatus "COmanage" | ||
getResourceStatus "LDAP" | ||
echo "" | ||
echo "" | ||
|
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,61 @@ | ||
#/bin/bash | ||
|
||
###config settings### | ||
#mp_username='administrator' | ||
#mp_userpass='5ecr3t' | ||
mp_username='banderson' | ||
mp_userpass='Password1' | ||
#################### | ||
|
||
###declarations### | ||
declare -A KeyTasks | ||
|
||
###functions### | ||
function getTaskStatus() { | ||
KeyTasks=( ["Grouper Livesync"]="552112fc-9546-4e63-a170-339d99a3455e" ["COmanage Livesync"]="5a821505-7318-4364-9a2f-501b8bf30b44" \ | ||
["COmanage Import"]="ec605247-fcb3-42f7-a241-3b1aaa96cea4" ["Grouper reconcile groups"]="22625b6c-e9a7-4151-88f8-013abb1cc158" \ | ||
["Grouper reconcile subjects"]="95539396-14ce-4787-aaa8-c93e2aacfbc0" ["Recompute all users"]="f71bd7ce-2329-42da-a71e-b7c45ebed549" ) | ||
mp_baseUrl='https://localhost:10443/midpoint/ws/rest' | ||
|
||
for taskname in "${!KeyTasks[@]}"; do | ||
if [ "$taskname" = "$1" ]; then | ||
thisTaskOid=${KeyTasks[$taskname]} | ||
thisTaskName=$taskname | ||
fi | ||
done | ||
|
||
url=$mp_baseUrl/tasks/$thisTaskOid | ||
#echo "URL is: $url" | ||
rawVal=$(curl -s -k --user $mp_username:$mp_userpass -H "Accept: application/json" -X GET $url) | ||
if [ $? -ne 0 ]; then | ||
echo "ERROR: Problem connecting to host. Exiting..." | ||
echo "" | ||
exit 1 | ||
fi | ||
|
||
taskStatus=$(echo $rawVal | jq -r '.task.executionState') | ||
echo "Task Name: $thisTaskName" | ||
#echo "Task OID: $thisTaskOid" | ||
if [ "$taskStatus" = "running" ]; then | ||
echo "task is running" | ||
elif [ "$taskStatus" = "runnable" ]; then | ||
echo "task is runnable" | ||
else | ||
echo "*** task has failed (status=$taskStatus) ***" | ||
fi | ||
|
||
echo "" | ||
} | ||
|
||
### Main ### | ||
echo "midPoint Critical Task Status Check" | ||
echo "" | ||
getTaskStatus "Grouper Livesync" | ||
getTaskStatus "COmanage Livesync" | ||
getTaskStatus "COmanage Import" | ||
getTaskStatus "Grouper reconcile groups" | ||
getTaskStatus "Grouper reconcile subjects" | ||
getTaskStatus "Recompute all users" | ||
echo "" | ||
echo "" | ||
|
This file was deleted.
Oops, something went wrong.