mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Add support for Prometheus pushgateway basic auth (#16230)
Co-authored-by: Joe Clarke <jclarke@cisco.com>
This commit is contained in:
@@ -51,6 +51,12 @@ class Prometheus extends BaseDatastore
|
||||
|
||||
$this->client = Http::client()->baseUrl($this->base_uri);
|
||||
|
||||
$user = Config::get('prometheus.user', '');
|
||||
$passwd = Config::get('prometheus.password', '');
|
||||
if ($user && $passwd) {
|
||||
$this->client = $this->client->withBasicAuth($user, $passwd);
|
||||
}
|
||||
|
||||
$this->prefix = Config::get('prometheus.prefix', '');
|
||||
if ($this->prefix) {
|
||||
$this->prefix = "$this->prefix" . '_';
|
||||
|
@@ -35,6 +35,14 @@ continue to function as normal.
|
||||
lnms config:set prometheus.prefix 'librenms'
|
||||
```
|
||||
|
||||
If your pushgateway uses basic authentication, configure the following:
|
||||
|
||||
!!! setting "poller/prometheus"
|
||||
```bash
|
||||
lnms config:set prometheus.user username
|
||||
lnms config:set prometheus.password password
|
||||
```
|
||||
|
||||
## Prefix
|
||||
|
||||
Setting the 'prefix' option will cause all metric names to begin with
|
||||
|
@@ -5524,6 +5524,20 @@
|
||||
"section": "prometheus",
|
||||
"order": 4
|
||||
},
|
||||
"prometheus.user": {
|
||||
"default": "",
|
||||
"type": "text",
|
||||
"group": "poller",
|
||||
"section": "prometheus",
|
||||
"order": 5
|
||||
},
|
||||
"prometheus.password": {
|
||||
"default": "",
|
||||
"type": "text",
|
||||
"group": "poller",
|
||||
"section": "prometheus",
|
||||
"order": 6
|
||||
},
|
||||
"public_status": {
|
||||
"default": false,
|
||||
"group": "auth",
|
||||
|
Reference in New Issue
Block a user