OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • Archive »
  • 20.1 Legacy Series »
  • Get metrics from unbound via telegraf
« previous next »
  • Print
Pages: [1]

Author Topic: Get metrics from unbound via telegraf  (Read 7107 times)

Maltech

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
Get metrics from unbound via telegraf
« on: May 04, 2020, 10:19:37 am »
I'm trying to get statistics from unbound with telegraph. So far I have these lines added to the telegraf config:

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

But I get the following error:

Code: [Select]
E! [inputs.unbound] Error in plugin: error gathering metrics: error running unbound-control: exit status 1 (/usr/local/sbin/unbound-control [stats_noreset])
When I execute the command on the shell I also get an error but without the square brackets it works.
Code: [Select]
/usr/local/sbin/unbound-control stats_noreset
But how can I remove these brackets from the telegraf?
Logged

andrema2

  • Jr. Member
  • **
  • Posts: 86
  • Karma: 3
    • View Profile
Re: Get metrics from unbound via telegraf
« Reply #1 on: July 06, 2020, 04:38:57 pm »
Hi

Have you figure it out ?
Logged

andrema2

  • Jr. Member
  • **
  • Posts: 86
  • Karma: 3
    • View Profile
Re: Get metrics from unbound via telegraf
« Reply #2 on: July 07, 2020, 06:56:25 pm »
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.
Logged

Martink

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Re: Get metrics from unbound via telegraf
« Reply #3 on: March 11, 2021, 08:56:49 pm »
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 :-)
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • Archive »
  • 20.1 Legacy Series »
  • Get metrics from unbound via telegraf
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2023 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2