Overview

Request 1166242 declined

Bundle sysconfig file to allow for custom arguments


Johannes Kastl's avatar

Looks correct to me (as it is already used in the systemd service), let's have the other maintainers have a look.



Georg Pfuetzenreuter's avatar

The majority of Prometheus components in this devel project ship a sysconfig file with a standardized ARGS parameter. If you do not like it, I suggest to change the standard for all components instead declining bringing a component to the standard. In a systemd override you need to overwrite the whole command line, you cannot append arguments. Also it requires you to reload the systemd daemon (at least when managing the files programmatically and not interactively through "systemctl edit").

Also note configuration management tools like the Salt formula for Prometheus are built around having this sysconfig file.


Johannes Kastl's avatar

@witekbydek Actually I think Georg has a point here. Having an ARGS variable is a usual way. And we already respect that file (there are no changes in this SR regarding the systemd unit, it already uses the file), we just do not ship it.


Witek Bedyk's avatar

The majority of Prometheus components in this devel project ship a sysconfig file with a standardized ARGS parameter.

I reckon this is the consequence of changing the standard. Please compare this thread:
https://serverfault.com/questions/413397/how-to-set-environment-variable-in-systemd-service

In a systemd override you need to overwrite the whole command line, you cannot append arguments.

Creating the drop-in file with the following content does the trick. How would you append arguments in the sysconfig file?

[Service]
EnvironmentFile=
Environment="ARGS=--cluster.listen-address=''"

Also note configuration management tools like the Salt formula for Prometheus are built around having this sysconfig file.

Could you give the reference? I know of two formulas which do not use sysconfig.

Your change does not provide any useful and meaningful configuration to the package. It just sets the empty ARGS environment variable in a way which is not recommended anymore. And I agree with you, we should remove the reference to the missing sysconfig file from the systemd configuration.


Georg Pfuetzenreuter's avatar

I reckon this is the consequence of changing the standard.

Where is the standard changed in this project? All the exporter components and the Prometheus package itself in this project use the sysconfig file with ARGS: https://build.opensuse.org/projects/server:monitoring/packages/golang-github-prometheus-prometheus/files/prometheus.sysconfig. Hence to me, the standard in this project and hence in openSUSE is to use a sysconfig file with ARGS. I don't see how a thread on serverfault.com is of any value in determining a standard in openSUSE.

Creating the drop-in file with the following content does the trick.

If done through "systemctl edit", yes. If done by placing the file directly (for example through some script), you need to "systemctl daemon-reload" for it to apply.

How would you append arguments in the sysconfig file?

I simply write my additional argument into the "ARGS" line. For example if I want to temporarily add a debug flag.

As you demonstrate, your systemd override file requires three lines and needs to be loaded into the systemd daemon to apply. To remove it again, I need to delete the override directory and again run "systemctl daemon-reload".

Could you give the reference?

systemd.ini is not used for packaged installations, instead https://github.com/saltstack-formulas/prometheus-formula/blob/master/prometheus/files/default/environ.sh.jinja is written based on https://github.com/saltstack-formulas/prometheus-formula/blob/master/prometheus/defaults.yaml#L49.

Request History
Georg Pfuetzenreuter's avatar

crameleon created request

Bundle sysconfig file to allow for custom arguments


Witek Bedyk's avatar

witekbedyk declined request

This is not the recommended way of customizing _systemd_ services. We should use drop-in files instead:

* https://doc.opensuse.org/documentation/leap/reference/html/book-reference/cha-systemd.html#sec-boot-systemd-custom
* https://en.opensuse.org/openSUSE:Systemd_packaging_guidelines#Unit_files

openSUSE Build Service is sponsored by