Fix various issues with PVC Munin plugin
This commit is contained in:
parent
70ba364f1d
commit
5ae836f1c5
|
@ -28,6 +28,8 @@ GPLv3
|
|||
|
||||
. "$MUNIN_LIBDIR/plugins/plugin.sh"
|
||||
|
||||
is_multigraph
|
||||
|
||||
warning=1
|
||||
critical=2
|
||||
|
||||
|
@ -36,6 +38,7 @@ PVC_CMD="/usr/bin/pvc --quiet --cluster local status --format json-pretty"
|
|||
JQ_CMD="/usr/bin/jq"
|
||||
|
||||
output_usage() {
|
||||
echo "This plugin outputs information about a PVC cluster and node"
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
@ -57,33 +60,58 @@ output_autoconf() {
|
|||
}
|
||||
|
||||
output_config() {
|
||||
echo 'graph_title PVC CHealth'
|
||||
echo 'graph_args --base 100'
|
||||
echo 'graph_vlabel Count'
|
||||
echo 'multigraph pvc_cluster_health'
|
||||
echo 'graph_title PVC Cluster Health'
|
||||
echo 'graph_args --base 1000'
|
||||
echo 'graph_vlabel Health%'
|
||||
echo 'graph_category pvc'
|
||||
echo 'graph_period second'
|
||||
echo 'graph_info These graphs show the health of the PVC cluster and specific node.'
|
||||
echo 'graph_info Health of the PVC cluster'
|
||||
|
||||
echo 'pvc_cluster.label Cluster Health'
|
||||
echo 'pvc_cluster.type GAUGE'
|
||||
echo 'pvc_cluster.max 100'
|
||||
echo 'pvc_cluster.info Health of the PVC cluster in %.'
|
||||
echo 'pvc_cluster_health.label Cluster Health'
|
||||
echo 'pvc_cluster_health.type GAUGE'
|
||||
echo 'pvc_cluster_health.max 100'
|
||||
echo 'pvc_cluster_health.min 0'
|
||||
echo 'pvc_cluster_health.info Health of the PVC cluster in %'
|
||||
|
||||
echo 'multigraph pvc_cluster_alert'
|
||||
echo 'graph_title PVC Cluster Alerting'
|
||||
echo 'graph_args --base 1000'
|
||||
echo 'graph_vlabel State'
|
||||
echo 'graph_category pvc'
|
||||
echo 'graph_info Alerting state of the PVC cluster health'
|
||||
|
||||
echo 'pvc_cluster_alert.label Cluster Health State'
|
||||
echo 'pvc_cluster_alert.type GAUGE'
|
||||
echo 'pvc_cluster_alert.max 2',
|
||||
echo 'pvc_cluster_alert.max 2'
|
||||
echo 'pvc_cluster_alert.min 0'
|
||||
echo 'pvc_cluster_alert.info Alerting state of the PVC cluster health'
|
||||
print_warning pvc_cluster_alert
|
||||
print_critical pvc_cluster_alert
|
||||
|
||||
echo 'pvc_node.label Node Health'
|
||||
echo 'pvc_node.type GAUGE'
|
||||
echo 'pvc_node.max 100'
|
||||
echo 'pvc_node.info Health of the PVC node in %.'
|
||||
echo 'multigraph pvc_node_health'
|
||||
echo 'graph_title PVC Node Health'
|
||||
echo 'graph_args --base 1000'
|
||||
echo 'graph_vlabel Health%'
|
||||
echo 'graph_category pvc'
|
||||
echo 'graph_info Health of the PVC node'
|
||||
|
||||
echo 'pvc_node_health.label Node Health'
|
||||
echo 'pvc_node_health.type GAUGE'
|
||||
echo 'pvc_node_health.max 100'
|
||||
echo 'pvc_node_health.min 0'
|
||||
echo 'pvc_node_health.info Health of the PVC node in %'
|
||||
|
||||
echo 'multigraph pvc_node_alert'
|
||||
echo 'graph_title PVC Node Alerting'
|
||||
echo 'graph_args --base 1000'
|
||||
echo 'graph_vlabel State'
|
||||
echo 'graph_category pvc'
|
||||
echo 'graph_info Alerting state of the PVC node health'
|
||||
|
||||
echo 'pvc_node_alert.label Node Health State'
|
||||
echo 'pvc_node_alert.type GAUGE'
|
||||
echo 'pvc_node_alert.max 2',
|
||||
echo 'pvc_node_alert.max 2'
|
||||
echo 'pvc_node_alert.min 0'
|
||||
echo 'pvc_node_alert.info Alerting state of the PVC node health'
|
||||
print_warning pvc_node_alert
|
||||
print_critical pvc_node_alert
|
||||
|
@ -99,8 +127,9 @@ output_values() {
|
|||
|
||||
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' )"
|
||||
echo "pvc_cluster.value ${cluster_health}"
|
||||
echo "pvc_cluster.extinfo ${cluster_health_messages}"
|
||||
echo 'multigraph pvc_cluster_health'
|
||||
echo "pvc_cluster_health.value ${cluster_health}"
|
||||
echo "pvc_cluster_health.extinfo ${cluster_health_messages}"
|
||||
|
||||
if [[ ${cluster_health} -le 50 && ${is_maintenance} == "false" ]]; then
|
||||
cluster_health_alert=2
|
||||
|
@ -109,12 +138,14 @@ output_values() {
|
|||
else
|
||||
cluster_health_alert=0
|
||||
fi
|
||||
echo 'multigraph pvc_cluster_alert'
|
||||
echo "pvc_cluster_alert.value ${cluster_health_alert}"
|
||||
|
||||
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' )"
|
||||
echo "pvc_node.value ${node_health}"
|
||||
echo "pvc_node.extinfo ${node_health_messages}"
|
||||
echo 'multigraph pvc_node_health'
|
||||
echo "pvc_node_health.value ${node_health}"
|
||||
echo "pvc_node_health.extinfo ${node_health_messages}"
|
||||
|
||||
if [[ ${node_health} -le 50 && ${is_maintenance} == "false" ]]; then
|
||||
node_health_alert=2
|
||||
|
@ -123,6 +154,7 @@ output_values() {
|
|||
else
|
||||
node_health_alert=0
|
||||
fi
|
||||
echo 'multigraph pvc_node_alert'
|
||||
echo "pvc_node_alert.value ${node_health_alert}"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue