plugins icon indicating copy to clipboard operation
plugins copied to clipboard

net-mgmt/telegraf: Telegraf plugin sets `--quiet` in the rc script, overriding the UI and config file

Open g-a-c opened this issue 3 years ago • 1 comments

Important notices Before you add a new report, we ask you kindly to acknowledge the following:

  • [x] I have read the contributing guide lines at https://github.com/opnsense/plugins/blob/master/CONTRIBUTING.md
  • [x] I have searched the existing issues, open and closed, and I'm convinced that mine is new.
  • [x] The title contains the plugin to which this issue belongs

Describe the bug The Telegraf plugin UI page has two checkboxes labelled

  • quiet mode
  • debug mode

However, it doesn't matter how these are set because the rc.d startup script always sets --quiet as a command line flag, and this overrides anything that's in the config file

Tip: to validate your setup was working with the previous version, use opnsense-revert (https://docs.opnsense.org/manual/opnsense_tools.html#opnsense-revert)

To Reproduce Steps to reproduce the behavior:

  • Install the Telegraf plugin
  • Configure the UI with
    • quiet = unchecked
    • debug = checked
  • Restart the Telegraf service from the UI
  • Check the /var/log/telegraf/latest.log log file

Expected behavior An INFO level message is shown, showing that Telegraf started:

2022-09-22T21:17:30Z I! Starting Telegraf 1.23.4

Screenshots If applicable, add screenshots to help explain your problem.

Relevant log files /var/log/telegraf/latest.log

Additional context This bug also appears to be in FreeBSD upstream (link), however since FreeBSD permits/encourages the use of rc.conf, it's very easy for an end user to remove this. But in OPNsense, this would be a "hack" and might be more appropriate to simply modify the rc.d script allowing the settings in the UI to be effective out of the box.

Environment Software version used and hardware type if relevant. e.g.:

OPNsense 22.7.4

g-a-c avatar Sep 22 '22 21:09 g-a-c

~~Actually, this is an easy fix...the variable can simply be emptied when writing the file into /etc/rc.conf.d~~

I was wrong; this can't be overridden with an empty value - I forgot to clear the log file so I had an INFO message from a previous startup and thought this was taking effect. But because of the way the rc.d script is written, the config is loaded with load_rc_config and then the --quiet is appended to whatever the telegraf_flags was to start with. So this is still a valid bug and I don't see an obvious way to fix it without a modification to the actual startup script which feels like it should be an upstream FreeBSD bug to me.

g-a-c avatar Sep 22 '22 21:09 g-a-c

This issue has been automatically timed-out (after 180 days of inactivity).

For more information about the policies for this repository, please read https://github.com/opnsense/plugins/blob/master/CONTRIBUTING.md for further details.

If someone wants to step up and work on this issue, just let us know, so we can reopen the issue and assign an owner to it.

OPNsense-bot avatar Mar 21 '23 21:03 OPNsense-bot