1
0
Fork 0

nagios/netstat: sort perfdata

This commit is contained in:
Chl 2024-02-02 23:10:43 +01:00
parent 11fed2215c
commit e48cc16b01

View file

@ -153,8 +153,8 @@ while getopts hw:c:p: f; do
esac
# mémo : 'label'=value[UOM];[warn];[crit];[min];[max]
OUTPUT_PERFDATA=$( printf "%s'%s'=%d;%s;%s;0;" \
"$( test -n "$OUTPUT_PERFDATA" && echo "$OUTPUT_PERFDATA " )" \
OUTPUT_PERFDATA=$( printf "%s\n'%s'=%d;%s;%s;0;" \
"$OUTPUT_PERFDATA" \
"$LABEL" \
"$CPT" \
"$RANGE_WARNING" \
@ -193,6 +193,7 @@ case "$OUTPUT_EXIT_STATUS" in
;;
esac
printf "|%s\n" "$OUTPUT_PERFDATA"
# We sort the entries to avoid mismatch with poor implementations of pnp4nagios
printf "|%s\n" "$( printf "%s" "$OUTPUT_PERFDATA" | grep -v "^$" | sort | tr "\n" " " )"
# on supprime les retours à la ligne
exit $OUTPUT_EXIT_STATUS