|
1 |
| -The Traefik mixin is a set of configurable, reusable, and extensible dashboards based on the metrics exported by Traefik itself. It also creates suitable dashboard descriptions for Grafana. |
| 1 | +# traefik-mixin |
| 2 | + |
| 3 | +The Traefik mixin is a set of configurable, reusable, and extensible dashboards based on the metrics exported by Traefik itself. It also creates suitable dashboard descriptions for Grafana. Lastly, some alerts are also included. |
2 | 4 |
|
3 | 5 | To use them, you need to have mixtool and jsonnetfmt installed. If you have a working Go development environment, it's easiest to run the following:
|
4 | 6 |
|
5 |
| -$ go get github.com/monitoring-mixins/mixtool/cmd/mixtool |
6 |
| -$ go get github.com/google/go-jsonnet/cmd/jsonnetfmt |
7 |
| -You can then build the Prometheus rules files alerts.yaml and rules.yaml and a directory dashboard_out with the JSON dashboard files for Grafana: |
| 7 | +```shell |
| 8 | +go get github.com/monitoring-mixins/mixtool/cmd/mixtool |
| 9 | +go get github.com/google/go-jsonnet/cmd/jsonnetfmt |
| 10 | +``` |
| 11 | + |
| 12 | +You can then build the Prometheus rules files and dashboards for Grafana: |
| 13 | + |
| 14 | +```shell |
| 15 | +make build |
| 16 | +``` |
| 17 | + |
| 18 | +This will generate: |
| 19 | + |
| 20 | +- Prometheus alerts in `prometheus_rules_out/prometheus_alerts.yaml` |
| 21 | +- Prometheus rules in `prometheus_rules_out/prometheus_rules.yaml` (if you have rules defined) |
| 22 | +- Grafana dashboards in `dashboards_out/` |
| 23 | + |
| 24 | +## Included Alerts |
| 25 | + |
| 26 | +The following Prometheus alerts are included: |
| 27 | + |
| 28 | +- **TraefikConfigReloadFailuresIncreasing**: Fires if Traefik is failing to reload its config. |
| 29 | +- **TraefikTLSCertificatesExpiring**: Fires if Traefik is serving certificates that will expire very soon (critical, threshold configurable). |
| 30 | +- **TraefikTLSCertificatesExpiringSoon**: Fires if Traefik is serving certificates that will expire soon (warning, threshold configurable, only fires if the expiry is less than the warning threshold but greater than the critical threshold). |
| 31 | + |
| 32 | +## Configuration |
| 33 | + |
| 34 | +You can configure alert thresholds, selectors, and labels in `config.libsonnet`: |
| 35 | + |
| 36 | +```jsonnet |
| 37 | +{ |
| 38 | + _config+:: { |
| 39 | + traefik_tls_expiry_days_critical: 7, // critical threshold (days) |
| 40 | + traefik_tls_expiry_days_warning: 14, // warning threshold (days) |
| 41 | + filteringSelector: '', // optional metric label selector for all alerts |
| 42 | + // Example: |
| 43 | + // filteringSelector: "component=\"traefik\",environment=\"production\"", |
| 44 | + groupLabels: 'job, environment', |
| 45 | + instanceLabels: 'instance', |
| 46 | +
|
| 47 | + alertLabels: {}, // optional alert labels |
| 48 | + // Example: |
| 49 | + // alertLabels: { |
| 50 | + // environment: 'production', |
| 51 | + // component: 'traefik', |
| 52 | + // }, |
| 53 | + alertAnnotations: {}, // optional alert annotations |
| 54 | + // Example: |
| 55 | + // alertAnnotations: { |
| 56 | + // runbook: 'https://runbooks.example.com/traefik-tls', |
| 57 | + // grafana: 'https://grafana.example.com/d/traefik', |
| 58 | + // }, |
| 59 | + }, |
| 60 | +} |
| 61 | +``` |
8 | 62 |
|
9 |
| -$ make build |
10 |
| -For more advanced uses of mixins, see https://github.com/monitoring-mixins/docs. |
| 63 | +For more advanced uses of mixins, see [monitoring-mixins/docs](https://github.com/monitoring-mixins/docs). |
0 commit comments