2019-07-18 21:25:53 -05:00
|
|
|
# Enabling support for Prometheus
|
2018-04-13 10:46:19 -04:00
|
|
|
|
2019-07-18 21:25:53 -05:00
|
|
|
Please be aware Prometheus support is alpha at best, It hasn't been
|
|
|
|
|
extensively tested and is still in development All it provides is the
|
|
|
|
|
sending of data to a a Prometheus PushGateway. Please be careful when
|
|
|
|
|
enabling this support you use it at your own risk!
|
2018-04-13 10:46:19 -04:00
|
|
|
|
2021-07-10 03:34:01 +08:00
|
|
|
## Requirements (Older versions may work but haven't been tested
|
2018-04-13 10:46:19 -04:00
|
|
|
|
2019-07-18 21:25:53 -05:00
|
|
|
- Prometheus >= 2.0
|
|
|
|
|
- PushGateway >= 0.4.0
|
|
|
|
|
- Grafana
|
|
|
|
|
- PHP-CURL
|
2018-04-13 10:46:19 -04:00
|
|
|
|
2019-07-18 21:25:53 -05:00
|
|
|
The setup of the above is completely out of scope here and we aren't
|
|
|
|
|
really able to provide any help with this side of things.
|
|
|
|
|
|
2021-07-10 03:34:01 +08:00
|
|
|
## What you don't get
|
2019-07-18 21:25:53 -05:00
|
|
|
|
|
|
|
|
- Pretty graphs, this is why at present you need Grafana. You need to
|
|
|
|
|
build your own graphs within Grafana.
|
|
|
|
|
- Support for Prometheus or Grafana, we would highly recommend that
|
|
|
|
|
you have some level of experience with these.
|
|
|
|
|
|
|
|
|
|
RRD will continue to function as normal so LibreNMS itself should
|
|
|
|
|
continue to function as normal.
|
|
|
|
|
|
2021-07-10 03:34:01 +08:00
|
|
|
## Configuration
|
2018-04-13 10:46:19 -04:00
|
|
|
|
|
|
|
|
```php
|
|
|
|
|
$config['prometheus']['enable'] = true;
|
|
|
|
|
$config['prometheus']['url'] = 'http://127.0.0.1:9091';
|
|
|
|
|
$config['prometheus']['job'] = 'librenms'; # Optional
|
2021-09-29 01:30:28 +01:00
|
|
|
$config['prometheus']['prefix'] = 'librenms'; # Optional
|
2018-04-13 10:46:19 -04:00
|
|
|
```
|
|
|
|
|
|
2021-09-29 01:30:28 +01:00
|
|
|
## Prefix
|
|
|
|
|
|
|
|
|
|
Setting the 'prefix' option will cause all metric names to begin with
|
|
|
|
|
the configured value.
|
|
|
|
|
|
|
|
|
|
For instance without setting this option metric names will be something
|
|
|
|
|
like this:
|
|
|
|
|
|
2021-09-29 09:04:23 +01:00
|
|
|
```
|
2021-09-29 01:30:28 +01:00
|
|
|
OUTUCASTPKTS
|
|
|
|
|
ifOutUcastPkts_rate
|
|
|
|
|
INOCTETS
|
|
|
|
|
ifInErrors_rate
|
2021-09-29 09:04:23 +01:00
|
|
|
```
|
2021-09-29 01:30:28 +01:00
|
|
|
|
|
|
|
|
Configuring a prefix name, for example 'librenms', instead caused those
|
|
|
|
|
metrics to be exposed with the following names:
|
|
|
|
|
|
2021-09-29 09:04:23 +01:00
|
|
|
```
|
2021-09-29 01:30:28 +01:00
|
|
|
librenms_OUTUCASTPKTS
|
|
|
|
|
librenms_ifOutUcastPkts_rate
|
|
|
|
|
librenms_INOCTETS
|
|
|
|
|
librenms_ifInErrors_rate
|
2021-09-29 09:04:23 +01:00
|
|
|
```
|
2021-09-29 01:30:28 +01:00
|
|
|
|
2021-07-10 03:34:01 +08:00
|
|
|
## Sample Prometheus Scrape Config (for scraping the Push Gateway)
|
2018-04-13 10:46:19 -04:00
|
|
|
|
|
|
|
|
```yml
|
|
|
|
|
- job_name: pushgateway
|
|
|
|
|
scrape_interval: 300s
|
|
|
|
|
honor_labels: true
|
|
|
|
|
static_configs:
|
|
|
|
|
- targets: ['127.0.0.1:9091']
|
|
|
|
|
```
|
|
|
|
|
|
2019-07-18 21:25:53 -05:00
|
|
|
The same data then stored within rrd will be sent to Prometheus and
|
|
|
|
|
recorded. You can then create graphs within Grafana to display the
|
|
|
|
|
information you need.
|