signalfx-agent icon indicating copy to clipboard operation
signalfx-agent copied to clipboard

Remote config syntax broken through tools writing correct yaml

Open hhenkel opened this issue 4 years ago • 3 comments

We're currently rolling out signalfx on some hundred machines throughout the company via ansible. We have our own ansible role for applying host specific configurations, more or less the same way as you do in your own ansible signalfx role.

We face an issue, where the monitoring team decided to use the remote config feature of signalfx and from a quick look at your ansible role, you seem to experience the same issue.

With a config containing something like:

- type: telegraf/snmp
  community: {"#from": "/etc/signalfx/community/prod"}  

and you apply something like to_nice_yaml in ansible. You will end up with something like this, which does "break" or not behave as intended.

- type: telegraf/snmp
  community:
        '#from': /etc/signalfx/community/prod

Do you have any solution for this issue or are there plans to provide this functionality in a different way?

hhenkel avatar Jun 17 '21 10:06 hhenkel

@hhenkel What is the behavior you are seeing with to_nice_yaml applied? The two YAML snippets you show should be parsed identically but there might be some parsing issue going on. In YAML # is a comment indicator but since it is quoted it shouldn't be interpreted as such.

keitwb avatar Jun 17 '21 12:06 keitwb

@keitwb the behavior is to my understanding, that I end up with a different configuration then intended. I currently see no way, to provide config data in a yaml format to ansible for the "remote config feature" of signalfx, as will be reformated to something, that the signalfx-agent is not able to interpret.

The main issue here is to my understanding, that you decided to use the form of an YAML Array ( curly braces ), with a key that starts with a YAML comment char (hashtag) to define a signalfx-specific construct (remote config). As soon as one defines data like that in a playbook and filtes it with to_nice_yaml you will end up with a file in the form of my second example, which is not handled correctly /as intended.

Does that help to clear up the issue I'm seeing?

hhenkel avatar Jun 18 '21 10:06 hhenkel

I tested the two different forms of the config and both work the same, at least with the latest version of the agent (the yaml parsing stuff hasn't changed in a while though so I'd be surprised if it were a version-specific issue).

The format is not a YAML array, but a YAML mapping structure. They are just two different forms of it: flow style (with the curly braces, and block style where it is on a separate line with indentation (the ansible to_nice_yaml format). See https://yaml.org/spec/1.2/spec.html#id2798057.

If you run the signalfx-agent status config while the agent is running in the background it will show you the final rendered config for the monitor so you can confirm directly whether the remote config is being applied or not.

keitwb avatar Jun 18 '21 14:06 keitwb

Closing this issue as inactive. Please reopen if this issue is still occurring.

atoulme avatar Sep 22 '22 04:09 atoulme