https://github.com/criteo/ocserv-exporter
ocserv exporter for Prometheus
https://github.com/criteo/ocserv-exporter
metrics monitoring ocserv prometheus prometheus-exporter
Last synced: 3 months ago
JSON representation
ocserv exporter for Prometheus
- Host: GitHub
- URL: https://github.com/criteo/ocserv-exporter
- Owner: criteo
- License: apache-2.0
- Created: 2023-08-02T07:47:58.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-09-29T10:46:17.000Z (over 2 years ago)
- Last Synced: 2025-04-06T06:07:16.764Z (about 1 year ago)
- Topics: metrics, monitoring, ocserv, prometheus, prometheus-exporter
- Language: Go
- Homepage:
- Size: 42 KB
- Stars: 15
- Watchers: 11
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/criteo/ocserv-exporter/releases)
[](https://github.com/criteo/ocserv-exporter)
[](https://github.com/criteo/ocserv-exporter/actions/workflows/ci.yml)
[](https://github.com/criteo/ocserv-exporter/blob/main/LICENSE)
# Prometheus ocserv exporter
This exporter allows to expose statistics from `ocserv` in Prometheus format.
It simply parses the output of `occtl` tool to gather VPN server and user statistics.
# Usage
## Installation
Binaries can be download from the [Github releases](https://github.com/criteo/ocserv-exporter/releases) page.
## Running
Start `ocserv-exporter` as a daemon or from CLI on the same host running `ocserv` (`use-occtl = true` must be set in ocserv configuration):
```sh
$ ./ocserv-exporter
```
```sh
$ curl -s http://127.0.0.1:8000/metrics
occtl_status_scrape_error_total 0
occtl_users_scrape_error_total 0
vpn_active_sessions 29
vpn_authentication_failures 32
vpn_average_auth_time_seconds 0
vpn_average_session_time_seconds 9960
vpn_closed_error_sessions 0
vpn_handled_sessions 589
vpn_ips_banned 0
vpn_max_auth_time_seconds 46
vpn_max_session_time_seconds 43200
vpn_rx_bytes 2.4823e+07
vpn_sessions_handled 139
vpn_timed_out_idle_sessions 0
vpn_timed_out_sessions 0
vpn_total_authentication_failures 171
vpn_tx_bytes 2.84913e+08
vpn_user_rx_bytes{device="vpns0",mtu="1434",remote_ip="203.0.113.0",username="j.doe",vpn_ipv4="10.0.0.1",vpn_ipv6=""} 962053
vpn_user_rx_bytes{device="vpns1",mtu="1434",remote_ip="203.0.113.1",username="a.bob",vpn_ipv4="10.0.0.2",vpn_ipv6=""} 532733
vpn_user_tx_bytes{device="vpns0",mtu="1434",remote_ip="203.0.113.0",username="j.doe",vpn_ipv4="10.0.0.1",vpn_ipv6=""} 3.474418e+06
vpn_user_tx_bytes{device="vpns1",mtu="1434",remote_ip="203.0.113.1",username="a.bob",vpn_ipv4="10.0.0.2",vpn_ipv6=""} 200146
```
## Command line flags
| Name | Description |
|----------|---------------------------------------------------------------|
| interval | Delay between occtl scrape (default 30s) |
| listen | Prometheus HTTP listen IP and port (default "127.0.01:8000") |
## Prometheus Configuration
Example config:
```yaml
scrape_configs:
- job_name: 'ocserv-exporter'
scrape_interval: 30s
static_configs:
- targets:
- 127.0.0.1:8000 # The ocserv exporter's real ip:port
metrics_path: /metrics
```
# Contributing
Contributions are welcome! Before starting work on significant changes, please create an issue first.
## Commit message
Use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/#summary).
Conventional commit messages is enforced by the CI.