diff --git a/nagios/check_netstat_connectioncount.sh b/nagios/check_netstat_connectioncount.sh index 896e41f..b1c3c1a 100755 --- a/nagios/check_netstat_connectioncount.sh +++ b/nagios/check_netstat_connectioncount.sh @@ -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