Archive > 20.1 Legacy Series

Get metrics from unbound via telegraf

(1/1)

Maltech:
I'm trying to get statistics from unbound with telegraph. So far I have these lines added to the telegraf config:


--- Code: ---[[inputs.unbound]]
  binary = "/usr/local/sbin/unbound-control"
  thread_as_tag = false
--- End code ---

But I get the following error:


--- Code: ---E! [inputs.unbound] Error in plugin: error gathering metrics: error running unbound-control: exit status 1 (/usr/local/sbin/unbound-control [stats_noreset])
--- End code ---

When I execute the command on the shell I also get an error but without the square brackets it works.

--- Code: ---/usr/local/sbin/unbound-control stats_noreset
--- End code ---

But how can I remove these brackets from the telegraf?

andrema2:
Hi

Have you figure it out ?

andrema2:
Hi

So, I kinda found a solution.

I change the input from unbound to exec
[[inputs.exec]]
  commands = ["sh /root/unbound-control.sh"]
  timeout = "5s"
  data_format = "logfmt"

I created a script but it can be the unbound-control command line without a problem.

You have to add telegraf to unbound group.

pw group mod unbound -m telegraf

Instead of going into unbound it is going to exec in the Influx.

The problem that I'm facing is after the restart of the OPNsense telegraf looses unbound group. If someone can help me with it, that would be great.

Martink:
Hi, before starting a new thread I wanted to bump this. I tried both approaches, but neither is working out for me.

When I leave it to the simple unbound input I still get this error.
On the CLI I can issue the telegram command and it returns the entries perfectly fine, in the log in the GUI the error, I tried multiple searching within Google but no success, open for suggestion :-)

Navigation

[0] Message Index

Go to full version