CMK version: Checkmk Raw Edition 2.2.0p17
OS version: : RHEL 9.4
Hello,
I’m quiet new to the whole checkmk environment.
I have a small local check on some servers : /lib/check_mk_agent/local/300/check_radius_auth
> #!/bin/bash
>
> source /etc/check_mk/check_radius_auth.cfg
>
> if [[ -z $PORT ]] ; then
> PORT=1812
> fi
>
> SERVICE_NAME="Radius Auth"
>
> if [[ -z $PASSWORD ]] ; then
> CHECK=$(echo "User-Name=$USER" | radclient -r 1 $HOST:$PORT auth $SECRET 2>&1)
> else
> CHECK=$(echo "User-Name=$USER,User-Password=$PASSWORD" | radclient -r 1 $HOST:$PORT auth $SECRET 2>&1)
> fi
>
> if [[ $? -eq 0 ]] ; then
> if ( echo $CHECK | grep -q "Received Access-Accept" ) ; then
> echo "0 \"$SERVICE_NAME\" - OK (Received Access-Accept)"
> else
> echo "0 \"$SERVICE_NAME\" - OK (But maybe not ?)"
> fi
> exit 0
> else
> if ( echo $CHECK | grep -q "Shared secret is incorrect" ) ; then
> echo "1 \"$SERVICE_NAME\" - ERROR (Shared secret is incorrect)"
> elif ( echo $CHECK | grep -q "Expected Access-Accept got Access-Reject" ) ; then
> echo "1 \"$SERVICE_NAME\" - ERROR (got Access-Reject)"
> else
> echo "1 \"$SERVICE_NAME\" - ERROR (Unknown)"
> fi
> exit 1
> fi
It basically check if a radius connection is accepted or not. The script is working as expected for all kinds of situations.
When the connection is OK it’s also OK in checkmk webui :
# /lib/check_mk_agent/local/300/check_radius_auth
0 "Radius Auth" - OK (Received Access-Accept)
When the connection is rejected, the check goes unknown with “Item not found in monitoring data” in the summary instead of going in Warning state.
# /lib/check_mk_agent/local/300/check_radius_auth
1 "Radius Auth" - ERROR (got Access-Reject)
When the connection is OK again, the check come back up as before
What did I do wrong ?
Regards,
Johan
