diff --git a/examples/systemd/README.md b/examples/systemd/README.md new file mode 100644 index 0000000..ff59a3a --- /dev/null +++ b/examples/systemd/README.md @@ -0,0 +1,7 @@ +# Systemd Unit + +If you are using distribution packages you typically don't need to deal with these files. + +The unit file (`*.service`) in this directory are to be put into `/etc/systemd/system`. +It needs an optional sysconfig file in `/etc/sysconfig/puppet-agent-exporter`. +A sample file can be found in `sysconfig.puppet-agent-exporter`. \ No newline at end of file diff --git a/examples/systemd/puppet-agent-exporter.service b/examples/systemd/puppet-agent-exporter.service index 3df6b2d..3189844 100644 --- a/examples/systemd/puppet-agent-exporter.service +++ b/examples/systemd/puppet-agent-exporter.service @@ -7,7 +7,10 @@ Description=Puppet Agent Exporter After=network.target [Service] -ExecStart=/usr/bin/puppet-agent-exporter +# Fallback when environment file does not exist +Environment=OPTIONS= +EnvironmentFile=-/etc/sysconfig/puppet-agent-exporter +ExecStart=/usr/bin/puppet-agent-exporter $OPTIONS Restart=on-failure RestartSec=5s diff --git a/examples/systemd/sysconfig.puppet-agent-exporter b/examples/systemd/sysconfig.puppet-agent-exporter new file mode 100644 index 0000000..b246db1 --- /dev/null +++ b/examples/systemd/sysconfig.puppet-agent-exporter @@ -0,0 +1 @@ +OPTIONS="--puppet.config-section agent" diff --git a/go.mod b/go.mod index 5e57d6e..93324f8 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/prometheus/client_golang v1.23.2 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.1 - golang.org/x/term v0.37.0 + golang.org/x/term v0.38.0 gopkg.in/ini.v1 v1.67.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -22,6 +22,6 @@ require ( github.com/prometheus/procfs v0.16.1 // indirect github.com/xhit/go-str2duration/v2 v2.1.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect - golang.org/x/sys v0.38.0 // indirect + golang.org/x/sys v0.39.0 // indirect google.golang.org/protobuf v1.36.8 // indirect ) diff --git a/go.sum b/go.sum index 8bb0915..0df5529 100644 --- a/go.sum +++ b/go.sum @@ -47,10 +47,10 @@ go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc= go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= -golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= -golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/term v0.37.0 h1:8EGAD0qCmHYZg6J17DvsMy9/wJ7/D/4pV/wfnld5lTU= -golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254= +golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= +golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/term v0.38.0 h1:PQ5pkm/rLO6HnxFR7N2lJHOZX6Kez5Y1gDSJla6jo7Q= +golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg= google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=