prometheus-node-exporter: Support extra options.

There are plenty of options supported that the Guix configuration record
doesn't help you with, so add this field to allow users to do their own thing.

* gnu/services/monitoring.scm (<prometheus-node-exporter-configuration>): Add
extra-options field.
(prometheus-node-exporter-shepherd-service): Handle the extra options.
* doc/guix.texi (Prometheus Node Exporter Service): Document this.
This commit is contained in:
Christopher Baines 2020-11-28 11:03:19 +00:00
parent fd14385581
commit 92f7c11af2
No known key found for this signature in database
GPG key ID: 5E28A33B0B84F577
2 changed files with 9 additions and 3 deletions

View file

@ -22043,6 +22043,9 @@ This directory can be used to export metrics specific to this machine.
Files containing metrics in the text format, with the filename ending in
@code{.prom} should be placed in this directory.
@item @code{extra-options} (default: @code{'()})
Extra options to pass to the Prometheus node exporter.
@end table
@end deftp

View file

@ -128,7 +128,9 @@ (define-record-type* <prometheus-node-exporter-configuration>
(web-listen-address prometheus-node-exporter-web-listen-address
(default ":9100"))
(textfile-directory prometheus-node-exporter-textfile-directory
(default "/var/lib/prometheus/node-exporter")))
(default "/var/lib/prometheus/node-exporter"))
(extra-options prometheus-node-exporter-extra-options
(default '())))
(define %prometheus-node-exporter-accounts
(list (user-account
@ -145,7 +147,7 @@ (define %prometheus-node-exporter-accounts
(define prometheus-node-exporter-shepherd-service
(match-lambda
(( $ <prometheus-node-exporter-configuration>
package web-listen-address textfile-directory)
package web-listen-address textfile-directory extra-options)
(list
(shepherd-service
(documentation "Prometheus node exporter.")
@ -157,7 +159,8 @@ (define prometheus-node-exporter-shepherd-service
#$@(if textfile-directory
(list "--collector.textfile.directory"
textfile-directory)
'()))
'())
#$@extra-options)
#:user "prometheus-node-exporter"
#:group "prometheus-node-exporter"
#:log-file "/var/log/prometheus-node-exporter.log"))