Fix bugs with Munin plugin

This commit is contained in:
Joshua Boniface 2024-10-30 12:53:29 -04:00
parent 49a34acd14
commit ae26a071c7
1 changed files with 3 additions and 3 deletions

View File

@ -34,7 +34,7 @@ warning=0.99
critical=1.99 critical=1.99
export PVC_CLIENT_DIR="/run/shm/munin-pvc" export PVC_CLIENT_DIR="/run/shm/munin-pvc"
PVC_CMD="/usr/bin/pvc --quiet --cluster local status --format json-pretty" PVC_CMD="/usr/bin/sudo /usr/bin/pvc --quiet cluster status --format json-pretty"
JQ_CMD="/usr/bin/jq" JQ_CMD="/usr/bin/jq"
output_usage() { output_usage() {
@ -126,7 +126,7 @@ output_values() {
is_maintenance="$( $JQ_CMD ".maintenance" <<<"${PVC_OUTPUT}" | tr -d '"' )" is_maintenance="$( $JQ_CMD ".maintenance" <<<"${PVC_OUTPUT}" | tr -d '"' )"
cluster_health="$( $JQ_CMD ".cluster_health.health" <<<"${PVC_OUTPUT}" | tr -d '"' )" cluster_health="$( $JQ_CMD ".cluster_health.health" <<<"${PVC_OUTPUT}" | tr -d '"' )"
cluster_health_messages="$( $JQ_CMD -r ".cluster_health.messages | @csv" <<<"${PVC_OUTPUT}" | tr -d '"' | sed 's/,/, /g' )" cluster_health_messages="$( $JQ_CMD -r ".cluster_health.messages | map(.text) | join(\", \")" <<<"${PVC_OUTPUT}" )"
echo 'multigraph pvc_cluster_health' echo 'multigraph pvc_cluster_health'
echo "pvc_cluster_health.value ${cluster_health}" echo "pvc_cluster_health.value ${cluster_health}"
echo "pvc_cluster_health.extinfo ${cluster_health_messages}" echo "pvc_cluster_health.extinfo ${cluster_health_messages}"
@ -142,7 +142,7 @@ output_values() {
echo "pvc_cluster_alert.value ${cluster_health_alert}" echo "pvc_cluster_alert.value ${cluster_health_alert}"
node_health="$( $JQ_CMD ".node_health.${HOST}.health" <<<"${PVC_OUTPUT}" | tr -d '"' )" node_health="$( $JQ_CMD ".node_health.${HOST}.health" <<<"${PVC_OUTPUT}" | tr -d '"' )"
node_health_messages="$( $JQ_CMD -r ".node_health.${HOST}.messages | @csv" <<<"${PVC_OUTPUT}" | tr -d '"' | sed 's/,/, /g' )" node_health_messages="$( $JQ_CMD -r ".node_health.${HOST}.messages | join(\", \")" <<<"${PVC_OUTPUT}" )"
echo 'multigraph pvc_node_health' echo 'multigraph pvc_node_health'
echo "pvc_node_health.value ${node_health}" echo "pvc_node_health.value ${node_health}"
echo "pvc_node_health.extinfo ${node_health_messages}" echo "pvc_node_health.extinfo ${node_health_messages}"