Commit graph

59 commits

Author SHA1 Message Date
Silvan Mosberger 0a377f11a5 nixos/treewide: Remove usages of deprecated types.string 2021-05-05 03:31:41 +02:00
Matthew Bauer c168e05c7e
Merge pull request #86239 from tathougies/patch-2
[nixos/prometheus] promTypes.filter.value -> promTypes.filter.values
2021-02-26 19:28:18 -06:00
Phillip Cloud cbe4de90af nixos/prometheus: remove unnecessary whitespace 2021-01-10 13:09:47 -05:00
Phillip Cloud 53796fd70f nixos/prometheus: improve the tag_separator description 2021-01-10 13:08:48 -05:00
Phillip Cloud de96ffeb1c nixos/prometheus: use types.port for metrics port type 2021-01-10 13:08:48 -05:00
Phillip Cloud cad83fc596 nixos/prometheus: add cloud to refresh_interval description 2021-01-10 13:08:48 -05:00
Phillip Cloud 7958dbb8a7 nixos/prometheus: add gce_sd_configs scrapeConfig option 2021-01-10 13:08:47 -05:00
Phillip Cloud 287939e2ed nixos/prometheus: update relabel_action list 2021-01-03 11:01:30 -05:00
0x4A6F 06414886f1
nixos/prometheus: fix remote_{read,write} options
Fix and reorder options and use mkOpt for optional parameters,
according to official documentation.
2021-01-01 14:43:51 +00:00
0x4A6F c53a0c16e4
nixos/prometheus: remote_{read,write}
- add [remote_write](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write) and [remote_read](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_read) support

Co-authored-by: Yorick van Pelt <yorickvanpelt@gmail.com>
2020-12-29 14:48:57 +00:00
Philipp Kern ec6b0950ef
nixos/prometheus: Support environmentFile (#97933)
For the same reason Alertmanager supports environmentFile to pass
secrets along, it is useful to support the same for Prometheus'
configuration to store bearer tokens outside the Nix store.
2020-10-31 20:52:13 +01:00
Andreas Rammhold bb33cdd44b
Merge pull request #98738 from mayflower/prometheus-retention
nixos/prometheus: add retentionTime
2020-09-25 17:11:27 +02:00
Robin Gloster 5c0a2e8c60 nixos/prometheus: add retentionTime 2020-09-25 13:44:13 +02:00
Kirill Elagin a4afd525cb prometheus: Unbreak IPv6 listenAddress
The format of the listenAddress option was recently changed to separate
the address and the port parts. There is now a legacy check that
tells users to update to the new format. This legacy check produces
a false positive on IPv6 addresses, since they contain colons.

Fix the regex to make it not match colons within IPv6 addresses.
2020-09-21 07:53:47 +02:00
Kirill Elagin e1d80de838 prometheus: Add assert for legacy listenAddress 2020-07-23 18:16:13 -04:00
Kirill Elagin 5d2a465add prometheus: Use types.port for port 2020-07-23 18:15:57 -04:00
Christian Höppner ba3c3de8a6
prometheus: Split options listenAddress and port
Accessing the configured port of a service is quite useful, for example
when configuring virtual hosts for a service. The prometheus module did
not expose the configured por separately, making it unnecessarily
cumbersome to consume.

This is a breaking change only if you were setting `listenAddress` to
a non-standard value. If you were, you should now set `listenAddress`
and `port` separately.
2020-05-19 11:48:44 +01:00
Travis Athougies 8389fb8f16
[nixos/prometheus] promTypes.filter.value -> promTypes.filter.values
The new configuration name for this is plural. Currently, attempting to enable ec2 SD results in a `promtool check config` error
2020-04-28 10:22:03 -07:00
Robin Gloster 0e040d16e8
prometheus: use runCommandNoCCLocal for config gen 2020-04-12 20:13:23 +02:00
Andrew Childs 01f03f30db nixos/prometheus: add checkConfig
Workaround for https://github.com/prometheus/prometheus/issues/5222
2020-03-14 04:40:55 +00:00
Silvan Mosberger 4ee3e8b21d
nixos/treewide: Move rename.nix imports to their respective modules
A centralized list for these renames is not good because:
- It breaks disabledModules for modules that have a rename defined
- Adding/removing renames for a module means having to find them in the
central file
- Merge conflicts due to multiple people editing the central file
2019-12-10 02:51:19 +01:00
WilliButz bb62066225
nixos/prometheus: remove prometheus1 module, rename prometheus2
Prometheus 1 is no longer supported, instead 'services.prometheus'
now configures the Prometheus 2 service.
2019-09-06 21:55:23 +02:00
WilliButz 543f219b30
nixos/prometheus: replace 'alertmanagerURL' options for prometheus2
Prometheus2 does no longer support the command-line flag to specify
an alertmanager. Instead it now supports both service discovery and
configuration of alertmanagers in the alerting config section.

Simply mapping the previous option to an entry in the new alertmanagers
section is not enough to allow for complete configurations of an
alertmanager.

Therefore the option alertmanagerURL is no longer used and instead
a full alertmanager configuration is expected.
2019-08-12 10:42:28 +02:00
Bas van Dijk cdd82681b3 nixos/prometheus: add more missing options 2019-04-18 12:53:13 +02:00
Bas van Dijk 285fd3c05a nixos/prometheus: abstract over optional option creation 2019-04-18 11:55:43 +02:00
Bas van Dijk 55ef5d4246 nixos/prometheus: set optional attributes to type types.nullOr
This makes sure that when a user hasn't set a Prometheus option it
won't show up in the prometheus.yml configuration file. This results
in smaller and easier to understand configuration files.
2019-04-17 14:49:09 +02:00
Bas van Dijk 57e5b75f9c nixos/prometheus: filter out the _module attr in a central place
We previously filtered out the `_module` attribute in a NixOS
configuration by filtering it using the option's `apply` function.

This meant that every option that had a submodule type needed to have
this apply function. Adding this function is easy to forget thus this
mechanism is error prone.

We now recursively filter out the `_module` attributes at the place we
construct the Prometheus configuration file. Since we now do the filtering
centrally we don't have to do it per option making it less prone to errors.
2019-04-17 14:08:16 +02:00
Bas van Dijk a913d0891c nixos/prometheus: filter out empty srcape_configs attributes
This results in a smaller prometheus.yml config file.

It also allows us to use the same options for both prometheus-1 and
prometheus-2 since the new options for prometheus-2 default to null
and will be filtered out if they are not set.
2019-04-16 16:06:11 +02:00
Bas van Dijk a23db5db08 nixos/prometheus: add new ec2_sd_config options for prometheus2 2019-04-16 16:04:33 +02:00
Andrew Childs ad7e232f88 nixos/prometheus: add ec2_sd_configs section to scrape_configs 2019-04-16 13:43:52 +02:00
Enno Lohmeier da7aeb1b7d prometheus: add tls_config 2019-04-11 20:34:31 +02:00
Bas van Dijk c95179b52f nixos/prometheus: add back the option services.prometheus.dataDir
This is to ensure more backwards compatibility. Note this is not 100%
backwards compatible because we now require dataDir to begin with /var/lib/.
2019-04-09 13:13:34 +02:00
Bas van Dijk eed84d1f8d nixos/prometheus: fix indentation and unnecessary parenthesis 2019-04-08 19:14:42 +02:00
Bas van Dijk 7cf27feb2f
nixos/prometheus: get rid of empty arguments
Previously the prometheus.service file looked like:

  ExecStart=/nix/store/wjkhfw3xgkmavz1akkqir99w4lbqhak7-prometheus-1.8.2-bin/bin/prometheus -storage.local.path=/var/lib/prometheus/metrics \
    -config.file=/nix/store/zsnvzw51mk3n1cxjd0351bj39k1j6j27-prometheus.yml-check-config-checked \
    -web.listen-address=0.0.0.0:9090 \
    -alertmanager.notification-queue-capacity=10000 \
    -alertmanager.timeout=10s \
     \

  Restart=always

Now it's:

  ExecStart=/nix/store/wjkhfw3xgkmavz1akkqir99w4lbqhak7-prometheus-1.8.2-bin/bin/prometheus \
    -storage.local.path=/var/lib/prometheus/metrics \
    -config.file=/nix/store/zsnvzw51mk3n1cxjd0351bj39k1j6j27-prometheus.yml-check-config-checked \
    -web.listen-address=0.0.0.0:9090 \
    -alertmanager.notification-queue-capacity=10000 \
    -alertmanager.timeout=10s
  Restart=always
2019-04-08 14:59:12 +02:00
Bas van Dijk a59c92903e
nixos/prometheus: use ExecStart instead of a shell script
This uses fewer lines of code and one less process.
2019-04-08 14:59:12 +02:00
Jean-Baptiste Giraudeau 0333d877c2
Use same user for both prometheus 1 and 2. Use StateDirectory. 2019-03-25 14:49:22 +01:00
Jean-Baptiste Giraudeau 5ae25922b5
Prometheus2: --web.external-url need two dash. 2019-03-25 14:36:48 +01:00
Jean-Baptiste Giraudeau bfbae97cfa
Rollback versionning of services.prometheus.{exporters, alertmanager}. 2019-03-25 14:36:46 +01:00
Alberto Berti 1b6ce80c2b
Make it pass a minimal test 2019-03-25 14:36:44 +01:00
Alberto Berti 11b89720b7
Add prometheus2 configuration to the prometheus modules
As the configuration for the exporters and alertmanager is unchanged
between the two major versions this patch tries to minimize
duplication while at the same time as there's no upgrade path from 1.x
to 2.x, it allows running the two services in parallel. See also #56037
2019-03-25 14:36:44 +01:00
Symphorien Gibol a915b33315 nixos: add preferLocalBuild=true; on derivations for config files 2019-02-22 20:11:27 +01:00
Maximilian Bosch 003132c2dd
nixos/prometheus: make source_labels optional
It's possible to skip `source_labels` entirely, an example for this is
the blackbox exporter configuration:

https://github.com/prometheus/blackbox_exporter#prometheus-configuration
2019-01-16 14:01:43 +01:00
Andreas Rammhold 6795bdd58c nixos/prometheus: check configuration before starting service
With `promtool` we can check the validity of a configuration before
deploying it. This avoids situations where you would end up with a
broken monitoring system without noticing it - since the monitoring
broke down. :-)
2018-11-04 15:08:44 +01:00
Andreas Rammhold 0de150e0f2 nixos/prometheus: add package option
With a package option we can let the user decide what package to use for
prometheus without requiring an overlay.
2018-11-04 15:08:44 +01:00
Pierre Bourdon cf58856d90 nixos/prometheus: add webExternalUrl option
Similar to the prometheus.alertmanager.webExternalUrl option, but for
Prometheus itself.
2018-10-20 13:45:55 +02:00
Florian Klink fff5923686 nixos/modules: users.(extraUsers|extraGroup->users|group) 2018-06-30 03:02:58 +02:00
Oliver Charles 560400773c nixos/prometheus: Correct documentation for external_labels
As description is literal XML, I need to escape < and > by hand.
2017-11-17 11:06:03 +00:00
Oliver Charles acb7f43db9 nixos/prometheus: add external_labels option 2017-11-17 10:16:21 +00:00
Oliver Charles f0334c0336 nixos/prometheus: add scrape_configs.honor_labels 2017-11-17 10:15:37 +00:00
Franz Pletz 271d3f7a43
prometheus service: globalConfig.labels is obsolete
Due to the version bump in e60c958811.
2017-06-27 01:53:03 +02:00