Skip to content

Commit 433d445

Browse files
committed
Add docs for prometheus credentials
1 parent e919743 commit 433d445

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

doc/03-Configuration.md

+11-7
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ Defined in the `notifications` section of the configuration file.
4848

4949
Connection configuration for a Prometheus instance that collects metrics from your Kubernetes cluster,
5050
from which Icinga for Kubernetes [synchronizes predefined metrics](01-About.md#metric-sync) to display charts in the UI.
51-
Defined in the `prometheus` section of the configuration file.
51+
Defined in the `prometheus` section of the configuration file. If one of username or password is set, both must be set.
5252

53-
| Option | Description |
54-
|--------|--------------------------------------------------------------------------------------|
55-
| url | **Optional.** Prometheus server URL. If not set, metric synchronization is disabled. |
53+
| Option | Description |
54+
|----------|--------------------------------------------------------------------------------------|
55+
| url | **Optional.** Prometheus server URL. If not set, metric synchronization is disabled. |
56+
| username | **Optional.** Prometheus username. |
57+
| password | **Optional.** Prometheus password. |
5658

5759
# Configuration via Environment Variables
5860

@@ -90,6 +92,8 @@ The configurations set by environment variables override the ones set by YAML.
9092

9193
## Prometheus Configuration
9294

93-
| Env | Description |
94-
|----------------|--------------------------------------------------------------------------------------|
95-
| PROMETHEUS_URL | **Optional.** Prometheus server URL. If not set, metric synchronization is disabled. |
95+
| Env | Description |
96+
|---------------------|--------------------------------------------------------------------------------------|
97+
| PROMETHEUS_URL | **Optional.** Prometheus server URL. If not set, metric synchronization is disabled. |
98+
| PROMETHEUS_USERNAME | **Optional.** Prometheus username. |
99+
| PROMETHEUS_PASSWORD | **Optional.** Prometheus password. |

pkg/metrics/config.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
// PrometheusConfig defines Prometheus configuration.
88
type PrometheusConfig struct {
99
Url string `yaml:"url" env:"URL"`
10-
Username string `yaml:"username"`
11-
Password string `yaml:"password"`
10+
Username string `yaml:"username" env:"USERNAME"`
11+
Password string `yaml:"password" env:"PASSWORD"`
1212
}
1313

1414
// Validate checks constraints in the supplied Prometheus configuration and returns an error if they are violated.

0 commit comments

Comments
 (0)