Improve Munin check with extinfo

This commit is contained in:
Joshua Boniface 2020-10-19 11:01:00 -04:00
parent ffaa4c033f
commit 7cc33451b9
1 changed files with 12 additions and 0 deletions

View File

@ -112,6 +112,7 @@ output_values() {
PVC_OUTPUT="$( $PVC_CMD )" PVC_OUTPUT="$( $PVC_CMD )"
cluster_health="$( $JQ_CMD '.health' <<<"${PVC_OUTPUT}" | tr -d '"' )" cluster_health="$( $JQ_CMD '.health' <<<"${PVC_OUTPUT}" | tr -d '"' )"
cluster_failed_reason="$( $JQ_CMD -r '.health_msg | @csv' <<<"${PVC_OUTPUT}" | tr -d '"' | sed 's/,/, /g' )"
case $cluster_health in case $cluster_health in
"Optimal") "Optimal")
cluster_value="0" cluster_value="0"
@ -124,6 +125,7 @@ output_values() {
esac esac
storage_health="$( $JQ_CMD '.storage_health' <<<"${PVC_OUTPUT}" | tr -d '"' )" storage_health="$( $JQ_CMD '.storage_health' <<<"${PVC_OUTPUT}" | tr -d '"' )"
storage_failed_reason="$( $JQ_CMD -r '.storage_health_msg | @csv' <<<"${PVC_OUTPUT}" | tr -d '"' | sed 's/,/, /g' )"
case $storage_health in case $storage_health in
"Optimal") "Optimal")
storage_value="0" storage_value="0"
@ -137,7 +139,17 @@ output_values() {
echo "pvc_cluster.value $cluster_value" echo "pvc_cluster.value $cluster_value"
if [[ $cluster_value -eq 1 ]]; then
echo "pvc_cluster.extinfo Cluster in maintenance mode"
elif [[ $cluster_value -eq 2 ]]; then
echo "pvc_cluster.extinfo ${cluster_failed_reason}"
fi
echo "pvc_storage.value $storage_value" echo "pvc_storage.value $storage_value"
if [[ $storage_value -eq 1 ]]; then
echo "pvc_storage.extinfo Cluster in maintenance mode"
elif [[ $storage_value -eq 2 ]]; then
echo "pvc_storage.extinfo ${storage_failed_reason}"
fi
} }
case $# in case $# in