-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor config and get rid of some dependencies
- Loading branch information
1 parent
32e9b7e
commit aa54ee5
Showing
9 changed files
with
118 additions
and
351 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,48 @@ | ||
# IPsec Prometheus Exporter | ||
# IPSec Prometheus Exporter | ||
|
||
_The IPsec Prometheus exporter subscribes to the strongSwan via Vici API and exposes [Security Associations](https://github.com/strongswan/strongswan/blob/master/src/libcharon/plugins/vici/README.md#list-sa) (SAs) metrics._ | ||
_The IPSec Prometheus exporter subscribes to the strongSwan via Vici API and exposes [Security Associations](https://github.com/strongswan/strongswan/blob/master/src/libcharon/plugins/vici/README.md#list-sa) (SAs) metrics._ | ||
|
||
Collected metrics (together with application metrics) are exposed on `/metrics` endpoint. Prometheus target is then configured with this endpoint and port e.g. `http://localhost:8079/metrics`. | ||
|
||
## Configuration | ||
|
||
IPsec Prometheus exporter configuration yaml file is optional. If not provided, the default values are used. | ||
IPSec Prometheus exporter is configured via command-line arguments. If not provided, the default values are used. | ||
|
||
### Config file | ||
### Command-line arguments | ||
|
||
If the default value match with your choice you can omit it. | ||
|
||
```yaml | ||
# Logger configuration | ||
logging: | ||
# logging level - default: INFO | ||
level: DEBUG | ||
|
||
# HTTP server configuration | ||
server: | ||
# server port - default: 8079 | ||
port: 8080 | ||
|
||
# Vici configuration | ||
vici: | ||
# Vici network scheme - default: tcp | ||
network: "udp" | ||
# Vici host is the ip-address or hostname. | ||
# Default values for hostname is "localhost". | ||
# IPv6 is supported. Use host in format of "[fd12:3456:789a::1]". | ||
host: "127.0.0.1" | ||
# Vici port - default: 4502 | ||
port: 30123 | ||
``` | ||
Options and default values: | ||
--server-port=8079 Application port where the collected metrics are available | ||
--log-level=info Logging level (debug, info, warn, error) | ||
--vici-network=tcp Vici network scheme (tcp, udp, unix) | ||
--vici-address=localhost:4502 IP address or hostname with a port or unix socket path | ||
IPv6 is supported. Use address in format of "[fd12:3456:789a::1]:4502" | ||
``` | ||
|
||
## Value Definition | ||
|
||
| Metric | Value | Description | | ||
|--------|-------|-------------| | ||
| strongswan_*_status | 0 | The tunnel is installed and is up and running. | | ||
| strongswan_*_status | 1 | The connection is established. | | ||
| strongswan_*_status | 2 | The tunnel or connection is down. | | ||
| strongswan_*_status | 3 | The tunnel or connection status is not recognized. | | ||
| Metric | Value | Description | | ||
|---------------------|-------|----------------------------------------------------| | ||
| strongswan_*_status | 0 | The tunnel is installed and is up and running. | | ||
| strongswan_*_status | 1 | The connection is established. | | ||
| strongswan_*_status | 2 | The tunnel or connection is down. | | ||
| strongswan_*_status | 3 | The tunnel or connection status is not recognized. | | ||
|
||
## Build & Run | ||
To build the binary run: | ||
```bash | ||
make build | ||
``` | ||
|
||
Run the binary with optional `config` parameter provided: | ||
Run the binary with optional arguments provided: | ||
```bash | ||
./ipsec-prometheus-exporter [--config=<path to yaml config file>] | ||
./ipsec-prometheus-exporter [--server-port=8079] [--log-level=info] [--vici-network=tcp] [--vici-address=localhost:4502] | ||
``` | ||
|
||
## Docker image | ||
Public docker image is available for multiple platforms: https://hub.docker.com/r/torilabs/ipsec-prometheus-exporter | ||
``` | ||
docker run -it -p 8079:8079 -v $(pwd)/my-config.yaml:/config.yaml --rm torilabs/ipsec-prometheus-exporter:latest | ||
docker run -it -p 8079:8079 --rm torilabs/ipsec-prometheus-exporter:latest --server-port=8079 | ||
``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.