You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] pkg.component.prometheus.service.args arguments is not working #61
I trying to enable remote write receiver, and set custom listen address and port. I took example from pillar.example and fill needed values, applied changes without errors, but as result - my config is not applied.
Changes to other part of pillar, for example, scrape_interval: 16s, applied successfully.
Steps to reproduce the bug
Add to the pillar in section pkg.component.prometheus.service.args some args, eg:
Yeah prometheus can have these config options passed into the service file or the environ file. Previously it was partially implemented, but ultimately not working for either.
When the pull request is complete, this will work through the environ piller in the same format as you gave above, i.e.:
Because of the environ section, you should however see that the service file makes reference to an environment file (that's how your package repo should install it, though some OS's don't include it for some reason) and that environment file will include those args.
I tried both (server and environ) to see something as working :)
In /etc/default/prometheus I see no changes too, seems because I use use_upstream_repo: false? In Debian repo there is too old version of prometheus, so I have to install from upstream archive. So this feature will not work with use_upstream_archive mode?
I'm running into problems with this as well, specifically for the --storage.tsdb.retention.time flag.
After going through the formula for a while I noticed something interesting the in the way the ExecStart directive of the prometheus (component) unit file gets constructed:
{%- if name in ('node_exporter', 'consul_exporter') or 'config_file' not in p.pkg.component[name] %}
{%- set args = [] %}
{%- for param, value in p.pkg.component.get(name).get('service').get('args', {}).items() %}
{%- if value is not none %}
{% do args.append("--" ~ param ~ "=" ~ value ) %}
{%- else %}
{% do args.append("--" ~ param ) %}
{%- endif %}
{%- endfor %}
start:{{ p.pkg.component[name]['path'] }}/{{ name }} {{ args|join(' ') }}
{%- else %}
start:{{ p.pkg.component[name]['path'] }}/{{ name }} --config.file {{ p.pkg.component[name]['config_file'] }} # noqa 204
{%- endif %}
If I am not mistaken, omitting all args from the start variable here, we would never be able to add commandline flags to the prometheus service, but Prometheus docs seem to suggest that there are some settings that can only be configured through the commandline flags.
Admittedly, the variables will be added to the env file just fine when configured to do so, but the prometheus executable seems to start the TSDB before loading this env file, and as a result, certain flags (such as the retention time) cannot be modified. The only way to set them, is by providing the appropriate command line flags.
I ended up creating sort of a dirty fix, but I'll open a PR anyway, maybe it can end up being useful in some way.
pr: #74
Activity
B1ue-W01f commentedon Jun 29, 2021
See #59
Theres an open pull request solving this issue.
MurzNN commentedon Jun 29, 2021
Thanks, I saw that issue, but it is for environment variables, but my - for arguments, but if the solution is same - that's good!
B1ue-W01f commentedon Jun 29, 2021
Yeah prometheus can have these config options passed into the service file or the environ file. Previously it was partially implemented, but ultimately not working for either.
When the pull request is complete, this will work through the environ piller in the same format as you gave above, i.e.:
Im based off the repo my pull is from and the above pillar deploys the correct config.
MurzNN commentedon Jul 12, 2021
I updated to v5.5.1, but this still not working, here is my part of the pillar:
It applies successfully, but in
/etc/systemd/system/multi-user.target.wants/prometheus.serviceI still don't see those arguments appeared:Where can be the problem?
B1ue-W01f commentedon Jul 12, 2021
You wont see them in the service because as mentioned the formula does not handle service args - it never did.
service: args: web.listen-address: localhost:9091 enable-feature: remote-write-receiver<<Does nothing.
Because of the environ section, you should however see that the service file makes reference to an environment file (that's how your package repo should install it, though some OS's don't include it for some reason) and that environment file will include those args.
On debian it will be: /etc/default/prometheus
MurzNN commentedon Jul 12, 2021
I tried both (
serverandenviron) to see something as working :)In
/etc/default/prometheusI see no changes too, seems because I useuse_upstream_repo: false? In Debian repo there is too old version ofprometheus, so I have to install from upstream archive. So this feature will not work withuse_upstream_archivemode?B1ue-W01f commentedon Jul 12, 2021
The formula is essentially split in two based on the use of 'use_upstream_archive'.
The 'use_upstream_archive' essentially ignores all of the code I updated, so I have no idea if it should work or not.
If you look at the archive section of the formula, it looks like its supposed to, with this being the key bit:
So perhaps its looking for a different pillar again.
Ahummeling commentedon Feb 2, 2022
I'm running into problems with this as well, specifically for the
--storage.tsdb.retention.timeflag.After going through the formula for a while I noticed something interesting the in the way the
ExecStartdirective of the prometheus (component) unit file gets constructed:{%- if name in ('node_exporter', 'consul_exporter') or 'config_file' not in p.pkg.component[name] %} {%- set args = [] %} {%- for param, value in p.pkg.component.get(name).get('service').get('args', {}).items() %} {%- if value is not none %} {% do args.append("--" ~ param ~ "=" ~ value ) %} {%- else %} {% do args.append("--" ~ param ) %} {%- endif %} {%- endfor %} start: {{ p.pkg.component[name]['path'] }}/{{ name }} {{ args|join(' ') }} {%- else %} start: {{ p.pkg.component[name]['path'] }}/{{ name }} --config.file {{ p.pkg.component[name]['config_file'] }} # noqa 204 {%- endif %}If I am not mistaken, omitting all
argsfrom thestartvariable here, we would never be able to add commandline flags to the prometheus service, but Prometheus docs seem to suggest that there are some settings that can only be configured through the commandline flags.Admittedly, the variables will be added to the env file just fine when configured to do so, but the prometheus executable seems to start the TSDB before loading this env file, and as a result, certain flags (such as the retention time) cannot be modified. The only way to set them, is by providing the appropriate command line flags.
I ended up creating sort of a dirty fix, but I'll open a PR anyway, maybe it can end up being useful in some way.
pr: #74
gabrielSoudry commentedon Feb 10, 2022
Same problem as above, with the feature flag agent