ovpnstatusd
Downloads openvpn-status.log from an OpenVPN server via
SSH and provides the number of connected clients using a certain
common name scrapable by Prometheus.
Usage
$ ovpnstatusd -help
Usage of ./ovpnstatusd:
-destination string
The hostname/IP address and port of the destination, separated by colon.
-interval int
The update interval in milliseconds (default 60000)
-password string
The password
-port int
The port ovpnstatusd listens on (default 8080)
-remote-path string
The path to openvpn-status.log at the destination (default "/etc/openvpn/openvpn-status.log")
-timeout uint
The timeout in seconds (default 5)
-user string
The usernam
When running, ovpnstatusd listens to the specified port and provides the metrics at the
/metrics
endpoint.
via Docker
docker run toolcreator/ovpnstatusd
The arguments shown above can also be passed, e.g.:
docker run toolcreator/ovpnstatusd -interval 10000 -port 12345
Using the -port
option may be particularly useful when running the container with --network=host
(i.e., when port mapping is not available).
When available, port mapping can of course be used as well, e.g.:
docker run -p 12345:8080 toolcreator/ovpnstatusd
docker-compose
ovpnstatusd:
image: toolcreator/ovpnstatusd
command:
- "-interval=10000"
ports:
- '12345:8080'
Or, with network_mode: "host"
:
ovpnstatusd:
image: toolcreator/ovpnstatusd
network_mode: "host"
command:
- "-interval=10000"
- "-port=12345"
Without Docker
- Download the source code:
git clone https://github.com/toolcreator/ovpnstatusd.git
- Enter the root directory:
cd ovpnstatusd
- Compile:
go build
- Install:
go install
- Run:
ovpnstatusd
You may also skip step 4 and use ./ovpnstatusd
to run the program instead.
Metrics
All metrics are of type gauge
and are labeled with common_name
.
Name |
Description |
ovpnstatusd_client_count |
The number of clients connected using the common name |