From 312b52dec4d2b86da07c6541280cdd3b8042c9c3 Mon Sep 17 00:00:00 2001 From: Lukas Macura Date: Thu, 14 Apr 2016 21:26:59 +0200 Subject: [PATCH 1/2] Added opencvpn plugin (from https://github.com/Grifagor/zabbix-openvpn/) --- openvpn/control.zaf | 65 ++++++++ openvpn/template.xml | 373 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 438 insertions(+) create mode 100644 openvpn/control.zaf create mode 100644 openvpn/template.xml diff --git a/openvpn/control.zaf b/openvpn/control.zaf new file mode 100644 index 0000000..1c5d0d6 --- /dev/null +++ b/openvpn/control.zaf @@ -0,0 +1,65 @@ +Plugin: openvpn +Description:: + Plugin for OpenVPN users monitoring. It shows an OpenVPN user’s status, and its uplink and downlink traffic. The “hosts” by the files certificates names are made using LLD. +:: + +Version: 0.1 +Url: https://raw.githubusercontent.com/limosek/zaf-plugins/master/psx +Web: https://github.com/Grifagor/zabbix-openvpn +Maintainer: Lukas Macura + +# Dependencies +Depends-dpkg: dash curl +Depens-opkg: busybox curl +Depends-rpm: curl +Depends-bin: curl ps + +Item discovery_users: +Parameters: ccd_dir +Description:: + Discovery of openvpn users +:: +Script:: +#!/bin/sh + +. $ZAF_LIB_DIR/zaf.lib.sh + +path="$1" +[ -z "$path" ] && zaf_error "Missing parameter path!" + +ls -F $path | sed 's/\///g' | zaf_discovery '{#VPNUSER}' +:: +/Item + +Item user_status: +Parameters: user +Description:: + User status +:: +Cmd: cat /var/log/openvpn-status.log | grep "$1" >/dev/null && echo 1 || echo 0 +/Item + +Item num_users: +Description:: + Number of users +:: +Cmd: cat /var/log/openvpn-status.log | sed -n '/Connected Since/,/ROUTING/p' | sed -e '1d' -e '$d' | wc -l +/Item + +Item user_received_bytes: +Description:: + Number of bytes received by user +:: +Parameters: user +Cmd: cat /var/log/openvpn-status.log | grep $1 | tr "," "\n" | sed -n '3p' +/Item + +Item user_sent_bytes: +Description:: + Number of bytes sent by user +:: +Parameters: user +Cmd: cat /var/log/openvpn-status.log | grep "$1" | tr "," "\n" | sed -n '4p' +/Item + + diff --git a/openvpn/template.xml b/openvpn/template.xml new file mode 100644 index 0000000..28a049a --- /dev/null +++ b/openvpn/template.xml @@ -0,0 +1,373 @@ + + + 3.0 + 2016-04-12T15:13:40Z + + + _SET_Templates + + + + + + + From dbea893673bc5dc1585e85e4ec000a7d049c0e84 Mon Sep 17 00:00:00 2001 From: Lukas Macura Date: Thu, 14 Apr 2016 21:40:18 +0200 Subject: [PATCH 2/2] Typo repair --- openvpn/control.zaf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openvpn/control.zaf b/openvpn/control.zaf index 1c5d0d6..05e37d5 100644 --- a/openvpn/control.zaf +++ b/openvpn/control.zaf @@ -1,12 +1,12 @@ Plugin: openvpn + Description:: - Plugin for OpenVPN users monitoring. It shows an OpenVPN user’s status, and its uplink and downlink traffic. The “hosts” by the files certificates names are made using LLD. + Plugin for OpenVPN users monitoring. It shows an OpenVPN user’s status, and its uplink and downlink traffic. The hosts by the files certificates names are made using LLD. :: Version: 0.1 Url: https://raw.githubusercontent.com/limosek/zaf-plugins/master/psx Web: https://github.com/Grifagor/zabbix-openvpn -Maintainer: Lukas Macura # Dependencies Depends-dpkg: dash curl