Using Exec command with Nagios data format and metrics

Hi everyone,

i make some test with nagios check script used on telegraf Exec Input Plugin. My executed script returne :

There is a way to have nagios state (OK/WARNING/CRITICAL) and metrics value (load 5 / 10 /15) ? Or nagios data format scrap only the state ?

Now i have “2” value on my influxDB.



My value on influxDB:

There is a Nagios parser available for Telegraf. You’ll need to add data_format = "nagios" to your Telegraf configuration.

You can find more information in the Telegraf data formats documentation.

Hi !
Here is my configuration

i already use Nagios data format but the returned metric value on influxDB is “2” .:crazy_face:

Your graph above shows nagios_state_centreonplugins.mean_state

I believe there should be other fields in that measurement with the values you are looking for.

It’s the right one,“nagios_state” is automatically added before the “name_suffix” parameter.


no one use Nagios data format ? I need feeback aout it please :slight_smile:

Hi Everyone,
someone can confirme if “nagios Data Format” scrap result status (ok/warning/crital) AND metrics after the pipe ? I’m stuck…

I can take a look at it, can you send me your input data?

1 Like

Hi @daniel , thanks a lot.

I use Telegraf agent 1.5.1

This is a copy/paste of the check from CLI, you have the output (it’s a nagios format) on the second line:

[root@XXXXX centreon-plugins]# perl --plugin=os::linux::snmp::plugin --mode=load --hostname= --snmp-version='2c' --snmp-community='public'  --warning='4,3,2' --critical='6,5,4'
OK: Load average: 0.00, 0.01, 0.05 | 'load1'=0.00;0:4;0:6;0; 'load5'=0.01;0:3;0:5;0; 'load15'=0.05;0:2;0:4;0;

And how i use IT on telegraf.conf :

  ## Commands array
  commands = [" perl --plugin=os::linux::snmp::plugin --mode=load --hostname= --snmp-version='2c' --snmp-community='public'"]
  ## measurement name suffix (for separating different commands)
  name_suffix = "_centreonplugins"
  ## Data format to consume.
  ## Each data format has its own unique set of configuration options, read
  ## more about them here:
  data_format = "nagios"

And the returned metrics :slightly_smiling_face:

Here are the results I get:

$ telegraf --input-filter exec --test
> nagios_state_centreonplugins state=0i 1525116499000000000
> 'load1'_centreonplugins min=0,value=0 1525116499000000000
> 'load5'_centreonplugins min=0,value=0.01 1525116499000000000
> 'load15'_centreonplugins min=0,value=0.05 1525116499000000000

It looks like the Telegraf parser does not support ranges in the warning and critical fields as specified in this performance data. I opened an issue.

This quoting of the labels variables also seems undesirable, this also seems like a bug. We should strip the outer quotes, but also since strictly speaking this would be a breaking change maybe we should update the format completely. I opened a second issue.

Can you take a look at the new issues and let me know what you think about the changes I proposed?


Thanks @daniel it looks good, for me the most important think on “nagios DATA” are metrics.