It’s definitely not being parsed properly. If you check the Sensu agent logs (journalctl -u sensu-agent.service
) you will probably find something like this in it:
"error":"unable to extract metric from check output","level":"error","metric":0,"msg":"invalid nagios perfdata metric: \"hop=1,addr=10.0.2.2,rtt=0.285ms;\\nhop=2,addr=10.16.4.1,rtt=1.729ms;\\nhop=3,addr=203.219.198.39,rtt=6.255ms;\\nhop=4,addr=203.29.134.61,rtt=5.674ms;\\nhop=5,addr=209.85.149.84,rtt=6.333ms;\\nhop=6,addr=108.170.247.65,rtt=5.799ms;\\nhop=7,addr=209.85.254.119,rtt=5.88ms;\\nhop=8,addr=8.8.8.8,rtt=6.695ms;\""
In reviewing the code for parsing nagios_perfdata, it does not appear to support multi-line output. Secondly it expects, as specified in the guidelines for the perf data to be space separated. Finally, it appears you are attempting to possibly be using tags with the generated metrics. For example I would assume that for hop=1,addr=10.0.2.2,rtt=0.285ms
you are wanting to capture the ‘rtt’ as the metric with the ‘hop’ and ‘addr’ being metadata (tag) for that metric. Is that correct? If so then nagios_perfdata format will not work as it doesn’t support tagging.
Might I inquire as to the purpose of this check? Are you actually doing a check for certain limits being crossed? Or is this solely for metrics collection? If it is solely for metrics collection, I would suggest creating your output in InfluxDB Line or OpenTSDB Line format. Both are supported by Sensu and support metric tagging. You could still rely on the exit value of the check creating events while you capture the metrics.