https://github.com/stdevel/check_ovpn_users
A Nagios / Icinga plugin for checking the amount of connected OpenVPN users
https://github.com/stdevel/check_ovpn_users
icinga icinga-plugin icinga2 icinga2-plugin ipfire nagios nagios-plugins openvpn openvpn-client openvpn-server
Last synced: 6 months ago
JSON representation
A Nagios / Icinga plugin for checking the amount of connected OpenVPN users
- Host: GitHub
- URL: https://github.com/stdevel/check_ovpn_users
- Owner: stdevel
- License: gpl-3.0
- Created: 2018-01-05T09:10:53.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T10:53:11.000Z (almost 2 years ago)
- Last Synced: 2025-04-18T08:39:30.916Z (6 months ago)
- Topics: icinga, icinga-plugin, icinga2, icinga2-plugin, ipfire, nagios, nagios-plugins, openvpn, openvpn-client, openvpn-server
- Language: Python
- Homepage:
- Size: 19.5 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
``check_ovpn_users`` is a Nagios/Icinga plugin for checking the amount of logged in OpenVPN users.
# Requirements
The plugin requires an installed OpenVPN server and the ``logging`` Python module.# Usage
By default, the script checks the current amount of connected OpenVPN users by reading the log file. It is possible to control this behaviour by specifying additional parameters (*see below*).
The script also support performance data for data visualization.The following parameters can be specified:
| Parameter | Description |
|:----------|:------------|
| `-d` / `--debug` | enable debugging outputs (*default: no*) |
| `-h` / `--help` | shows help and quits |
| `-P` / `--show-perfdata` | enables performance data (*default: no*) |
| `-f` / `--log-file` | defines the OpenVPN server log file (*default: /var/run/ovpnserver.log*) |
| `-w` / `--users-warning` | defines the user warning threshold (*default: 5*) |
| `-c` / `--users-critical` | defines the user critical threshold (*default: 10*) |
| `--version` | prints programm version and quits |## Examples
Check with default thresholds and parameters:
```
$ ./check_ovpn_users.py
OK: OpenVPN users OK (2) |
```Check with customized thresholds:
```
$ ./check_ovpn_users.py -w 1 -c 3
OK: OpenVPN users WARNING (2) |
```Check also reporting performance data:
```
$ ./check_ovpn_users.py -P
OK: OpenVPN users OK (2) | 'ovpn_users'=2;5;10
```# Installation
To install the plugin, move the Python script into the appropriate directory and create an appropriate **NRPE** or **Icinga2** configuration - check-out the examples in this repository. There is also a spec file for creating a RPM file.# Configuration
Inside Nagios / Icinga you will need to configure a check, e.g. for Icinga2:
```
apply Service "DIAG: OpenVPN users" {
import "generic-service"
check_command = "check_ovpn_users"
vars.openvpn_perfdata = true
assign where host.vars.os == "Linux" && host.vars.app == "router"
ignore where host.vars.noagent
}
```For agentless systems (*e.g. IPFire/IPCop*), utilize the ``check_by_ssh`` command:
```
apply Service "DIAG: OpenVPN users" {
import "generic-service"
check_command = "by_ssh"
vars.by_ssh_command = [ "/opt/check_ovpn_users.py", "-P" ]
vars.by_ssh_port = host.vars.ssh_port
vars.by_ssh_logname = "icinga"
assign where host.vars.os == "Linux" && host.vars.app == "router"
}
```