OPNSense Prometheus exporter
Project description
OPNSense Prometheus exporter
I've configures OPNSense with High Availability settings using 2 servers.
So I've 2 servers: MAIN and BACKUP, in normal situation MAIN server
is expected to be active
and the BACKUP server to be in hot_standby
state.
The initial needs was to be able to make sure that BACKUP server is ready (hot standby)
to get the main server role with the active
state at any time.
Unfortunately I've not found a proper configuration to call OPNSense HTTP API over opnvpn on backup server using blackbox configuratoin. That why I've started to develop this exporter install on a server on the LAN to be able to resquest both OPNSense servers.
Metrics
This exporter gives following metrics, all metrics received following labels:
instance
: by default this is set with the hostname where is running this exporter servicehost
: the host of the OPNSense
Enums
opnsense_main_ha_state
: OPNSense HA state of the MAIN serveropnsense_backup_ha_state
: OPNSense HA state of the BACKUP server
Gauges
opnsense_active_server_bytes_received
: Active OPNSense server bytes received on WAN interfaceopnsense_active_server_bytes_transmitted
: Active OPNSense server bytes transmitted on WAN interface
Usage
Note: Most updated documentation from command line !
opnsense-exporter --help
usage: opnsense-exporter [-h] [--check-frequency-seconds FREQUENCY]
[--main-host MAIN] [--backup-host BACKUP]
[--opnsense-user USER]
[--opnsense-password PASSWORD]
[--prometheus-instance PROM_INSTANCE]
OPNSense prometheus exporter
optional arguments:
-h, --help show this help message and exit
--check-frequency-seconds FREQUENCY, -c FREQUENCY
How often (in seconds) this server requests
OPNSense servers (default: 2)
--main-host MAIN, -m MAIN
MAIN OPNsense server that should be in `active`
state in normal configuration.
--backup-host BACKUP, -b BACKUP
BACKUP OPNsense server that should be
`hot_standby` state in normal configuration.
--opnsense-user USER, -u USER
OPNsense user. Expect to be the same on MAIN and
BACKUP servers
--opnsense-password PASSWORD, -p PASSWORD
OPNsense password. Expect to be the same on MAIN
and BACKUP servers
--prometheus-instance PROM_INSTANCE
Exporter Instance name, default value computed
with hostname where the server is running. Use to
You can setup env through .env
file or environment variables with defined as default values
(so command line will get the precedent):
- CHECK_FREQUENCY_SECONDS: default value for
--check-frequency-seconds
param - OPNSENSE_MAIN_HOST: default value for
--main-host
param - OPNSENSE_BACKUP_HOST: default value for
--backup-host
param - OPNSENSE_USERNAME: default value for
--opnsense-user
param - OPNSENSE_PASSWORD: default value for
--opnsense-password
param
Roadmap
- allow to change the listening port (today it force using
8000
)
Changelog
Version 0.2.0
Setup automatic release from gitlab while pushing new tag
Version 0.1.0
Initial version
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for opnsense-prom-exporter-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d1a6d97b0c53d96cfb562f8b7fa181421ed7f414b6d4fcdfb4939dd071f6cea |
|
MD5 | 48d9b43b297d4b82c7b16d56cd2a3d0c |
|
BLAKE2b-256 | 20e7684018b60d327ec89089833dcc4c957347a5760b79ffc9e2fa9fa6575dca |
Hashes for opnsense_prom_exporter-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a408324b185f475d1da39d49b469fcc1786bfda202760a0f25826c7a04c0270 |
|
MD5 | bded9276d56764f1041681b716de09d5 |
|
BLAKE2b-256 | fca1204c981bc0a8dedc4c394fcda3661b6ca5effaf575f882eb4d40ad9ac8fb |