Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Custom Template - OpenVPN for Zabbix
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>2.0</version>
<date>2014-06-29T06:40:14Z</date>
<groups>
<group>
<name>Custom Templates</name>
</group>
<group>
<name>OpenVPN clients</name>
</group>
</groups>
<templates>
<template>
<template>Custom Template - OpenVPN clients</template>
<name>Custom Template - OpenVPN clients</name>
<groups>
<group>
<name>Custom Templates</name>
</group>
</groups>
<applications>
<application>
<name>OpenVPN Service</name>
</application>
</applications>
<items>
<item>
<name>OpenVPN client health check (ping)</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>system.run[&quot;ping -c 3 -W 1 $( echo {HOST.HOST} | cut -d_ -f2 ) &gt; /dev/null;echo $?&quot;]</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>OpenVPN Service</name>
</application>
</applications>
<valuemap>
<name>Simple Ping status</name>
</valuemap>
</item>
<item>
<name>OpenVPN client incomming traffic (bps)</name>
<type>2</type>
<snmp_community/>
<multiplier>1</multiplier>
<snmp_oid/>
<key>script.openvpn_client_stats.incomming</key>
<delay>0</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units>bps</units>
<delta>1</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>8</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>OpenVPN Service</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>OpenVPN client outbound traffic (bps)</name>
<type>2</type>
<snmp_community/>
<multiplier>1</multiplier>
<snmp_oid/>
<key>script.openvpn_client_stats.outbound</key>
<delay>0</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units>bps</units>
<delta>1</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>8</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>OpenVPN Service</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>OpenVPN client tunnel status</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>script.openvpn_client_stats[127.0.0.1,7505,/etc/openvpn/password,3,{HOST.HOST}]</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>1</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>OpenVPN Service</name>
</application>
</applications>
<valuemap/>
</item>
</items>
<discovery_rules/>
<macros/>
<templates/>
<screens/>
</template>
<template>
<template>Custom Template - OpenVPN server</template>
<name>Custom Template - OpenVPN server</name>
<groups>
<group>
<name>Custom Templates</name>
</group>
</groups>
<applications>
<application>
<name>OpenVPN Service</name>
</application>
</applications>
<items>
<item>
<name>OpenVPN active connections</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>script.openvpn_stats.nclients</key>
<delay>0</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>OpenVPN Service</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>OpenVPN health check</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>script.openvpn_stats[127.0.0.1,7505,/etc/openvpn/password,3]</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>4</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>OpenVPN Service</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>OpenVPN incomming traffic (bps)</name>
<type>2</type>
<snmp_community/>
<multiplier>1</multiplier>
<snmp_oid/>
<key>script.openvpn_stats.incomming</key>
<delay>0</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units>bps</units>
<delta>1</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>8</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>OpenVPN Service</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>OpenVPN log</name>
<type>7</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>logrt[&quot;/var/log/openvpn\.(log|log-[0-9]{8})$&quot;,@Exclude rules for OpenVPN log]</key>
<delay>1</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>2</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>OpenVPN Service</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>OpenVPN outbound traffic (bps)</name>
<type>2</type>
<snmp_community/>
<multiplier>1</multiplier>
<snmp_oid/>
<key>script.openvpn_stats.outbound</key>
<delay>0</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units>bps</units>
<delta>1</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>8</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>OpenVPN Service</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>OpenVPN proc num</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>proc.num[openvpn]</key>
<delay>30</delay>
<history>7</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>OpenVPN Service</name>
</application>
</applications>
<valuemap/>
</item>
</items>
<discovery_rules>
<discovery_rule>
<name>Discovery rule to find OpenVPN clients</name>
<type>0</type>
<snmp_community/>
<snmp_oid/>
<key>script.openvpn_client_discovery[/etc/openvpn/client-ipconfig]</key>
<delay>3600</delay>
<status>0</status>
<allowed_hosts/>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<delay_flex/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<filter>:</filter>
<lifetime>1</lifetime>
<description>Discovery rule to find OpenVPN clients.</description>
<item_prototypes/>
<trigger_prototypes/>
<graph_prototypes/>
<host_prototypes>
<host_prototype>
<host>{#VPN_SERVER}_{#CLIENT_VPN_IP}_{#CLIENT_CN}</host>
<name>(VPN client) {#CLIENT_CN} on {#VPN_SERVER}</name>
<status>0</status>
<group_links>
<group_link>
<group>
<name>OpenVPN clients</name>
</group>
</group_link>
</group_links>
<group_prototypes>
<group_prototype>
<name>OpenVPN-{#VPN_SERVER}</name>
</group_prototype>
</group_prototypes>
<templates>
<template>
<name>Custom Template - OpenVPN clients</name>
</template>
</templates>
</host_prototype>
</host_prototypes>
</discovery_rule>
</discovery_rules>
<macros/>
<templates/>
<screens>
<screen>
<name>OpenVPN Statistics</name>
<hsize>1</hsize>
<vsize>2</vsize>
<screen_items>
<screen_item>
<resourcetype>0</resourcetype>
<width>500</width>
<height>100</height>
<x>0</x>
<y>0</y>
<colspan>1</colspan>
<rowspan>1</rowspan>
<elements>0</elements>
<valign>0</valign>
<halign>0</halign>
<style>0</style>
<url/>
<dynamic>0</dynamic>
<sort_triggers>0</sort_triggers>
<resource>
<name>OpenVPN Traffic (in/out)</name>
<host>Custom Template - OpenVPN server</host>
</resource>
<application/>
</screen_item>
<screen_item>
<resourcetype>0</resourcetype>
<width>500</width>
<height>100</height>
<x>0</x>
<y>1</y>
<colspan>1</colspan>
<rowspan>1</rowspan>
<elements>0</elements>
<valign>0</valign>
<halign>0</halign>
<style>0</style>
<url/>
<dynamic>0</dynamic>
<sort_triggers>0</sort_triggers>
<resource>
<name>OpenVPN active connections</name>
<host>Custom Template - OpenVPN server</host>
</resource>
<application/>
</screen_item>
</screen_items>
</screen>
</screens>
</template>
</templates>
<triggers>
<trigger>
<expression>{Custom Template - OpenVPN server:proc.num[openvpn].last()}&lt;1</expression>
<name>OpenVPN process is not runnning</name>
<url/>
<status>0</status>
<priority>4</priority>
<description/>
<type>0</type>
<dependencies/>
</trigger>
<trigger>
<expression>{Custom Template - OpenVPN server:script.openvpn_stats[127.0.0.1,7505,/etc/openvpn/password,3].regexp(&quot;Error: Could not connect to OpenVPN management interface&quot;)}=1|{Custom Template - OpenVPN server:script.openvpn_stats[127.0.0.1,7505,/etc/openvpn/password,3].nodata(600)}=1</expression>
<name>OpenVPN service is no response</name>
<url/>
<status>0</status>
<priority>4</priority>
<description/>
<type>0</type>
<dependencies/>
</trigger>
<trigger>
<expression>{Custom Template - OpenVPN clients:system.run[&quot;ping -c 3 -W 1 $( echo {HOST.HOST} | cut -d_ -f2 ) &gt; /dev/null;echo $?&quot;].last()}#0</expression>
<name>OpenVPN tunnel interface is unreachable ({HOST.HOST})</name>
<url/>
<status>0</status>
<priority>3</priority>
<description/>
<type>0</type>
<dependencies>
<dependency>
<name>OpenVPN tunnel is down ({HOST.HOST})</name>
<expression>(({Custom Template - OpenVPN clients:script.openvpn_client_stats[127.0.0.1,7505,/etc/openvpn/password,3,{HOST.HOST}].regexp(Down)})#0)</expression>
</dependency>
</dependencies>
</trigger>
<trigger>
<expression>(({Custom Template - OpenVPN clients:script.openvpn_client_stats[127.0.0.1,7505,/etc/openvpn/password,3,{HOST.HOST}].regexp(Down)})#0)</expression>
<name>OpenVPN tunnel is down ({HOST.HOST})</name>
<url/>
<status>0</status>
<priority>4</priority>
<description/>
<type>0</type>
<dependencies/>
</trigger>
<trigger>
<expression>({TRIGGER.VALUE}=0&amp;{Custom Template - OpenVPN server:logrt[&quot;/var/log/openvpn\.(log|log-[0-9]{8})$&quot;,@Exclude rules for OpenVPN log].regexp(&quot;MAN: client connection rejected after 3 failed password attempts&quot;)}=1)|({TRIGGER.VALUE}=1&amp;{Custom Template - OpenVPN server:logrt[&quot;/var/log/openvpn\.(log|log-[0-9]{8})$&quot;,@Exclude rules for OpenVPN log].regexp(&quot;MAN: client connection rejected after 3 failed password attempts&quot;,600)}=1)</expression>
<name>[OpenVPN log] Authentication failure detected on management interface</name>
<url/>
<status>0</status>
<priority>2</priority>
<description/>
<type>0</type>
<dependencies/>
</trigger>
<trigger>
<expression>({TRIGGER.VALUE}=0&amp;{Custom Template - OpenVPN server:logrt[&quot;/var/log/openvpn\.(log|log-[0-9]{8})$&quot;,@Exclude rules for OpenVPN log].regexp(&quot;Peer Connection Initiated with&quot;)}=1)|({TRIGGER.VALUE}=1&amp;{Custom Template - OpenVPN server:logrt[&quot;/var/log/openvpn\.(log|log-[0-9]{8})$&quot;,@Exclude rules for OpenVPN log].regexp(&quot;Peer Connection Initiated with&quot;,600)}=1)</expression>
<name>[OpenVPN log] VPN connection is established</name>
<url/>
<status>0</status>
<priority>1</priority>
<description/>
<type>0</type>
<dependencies/>
</trigger>
<trigger>
<expression>({TRIGGER.VALUE}=0&amp;{Custom Template - OpenVPN server:logrt[&quot;/var/log/openvpn\.(log|log-[0-9]{8})$&quot;,@Exclude rules for OpenVPN log].regexp(&quot;Inactivity timeout&quot;)}=1)|({TRIGGER.VALUE}=1&amp;{Custom Template - OpenVPN server:logrt[&quot;/var/log/openvpn\.(log|log-[0-9]{8})$&quot;,@Exclude rules for OpenVPN log].regexp(&quot;Inactivity timeout&quot;,600)}=1)</expression>
<name>[OpenVPN log] VPN inactivity timeout detected (may be disconnected)</name>
<url/>
<status>0</status>
<priority>2</priority>
<description/>
<type>0</type>
<dependencies/>
</trigger>
</triggers>
<graphs>
<graph>
<name>OpenVPN active connections</name>
<width>900</width>
<height>200</height>
<yaxismin>0.0000</yaxismin>
<yaxismax>100.0000</yaxismax>
<show_work_period>1</show_work_period>
<show_triggers>1</show_triggers>
<type>0</type>
<show_legend>1</show_legend>
<show_3d>0</show_3d>
<percent_left>0.0000</percent_left>
<percent_right>0.0000</percent_right>
<ymin_type_1>0</ymin_type_1>
<ymax_type_1>0</ymax_type_1>
<ymin_item_1>0</ymin_item_1>
<ymax_item_1>0</ymax_item_1>
<graph_items>
<graph_item>
<sortorder>0</sortorder>
<drawtype>2</drawtype>
<color>C80000</color>
<yaxisside>0</yaxisside>
<calc_fnc>4</calc_fnc>
<type>0</type>
<item>
<host>Custom Template - OpenVPN server</host>
<key>script.openvpn_stats.nclients</key>
</item>
</graph_item>
</graph_items>
</graph>
<graph>
<name>OpenVPN Client Traffic (in/out)</name>
<width>900</width>
<height>200</height>
<yaxismin>0.0000</yaxismin>
<yaxismax>100.0000</yaxismax>
<show_work_period>1</show_work_period>
<show_triggers>1</show_triggers>
<type>0</type>
<show_legend>1</show_legend>
<show_3d>0</show_3d>
<percent_left>0.0000</percent_left>
<percent_right>0.0000</percent_right>
<ymin_type_1>0</ymin_type_1>
<ymax_type_1>0</ymax_type_1>
<ymin_item_1>0</ymin_item_1>
<ymax_item_1>0</ymax_item_1>
<graph_items>
<graph_item>
<sortorder>0</sortorder>
<drawtype>5</drawtype>
<color>3333FF</color>
<yaxisside>0</yaxisside>
<calc_fnc>4</calc_fnc>
<type>0</type>
<item>
<host>Custom Template - OpenVPN clients</host>
<key>script.openvpn_client_stats.incomming</key>
</item>
</graph_item>
<graph_item>
<sortorder>1</sortorder>
<drawtype>5</drawtype>
<color>00C800</color>
<yaxisside>0</yaxisside>
<calc_fnc>4</calc_fnc>
<type>0</type>
<item>
<host>Custom Template - OpenVPN clients</host>
<key>script.openvpn_client_stats.outbound</key>
</item>
</graph_item>
</graph_items>
</graph>
<graph>
<name>OpenVPN Traffic (in/out)</name>
<width>900</width>
<height>200</height>
<yaxismin>0.0000</yaxismin>
<yaxismax>100.0000</yaxismax>
<show_work_period>1</show_work_period>
<show_triggers>1</show_triggers>
<type>0</type>
<show_legend>1</show_legend>
<show_3d>0</show_3d>
<percent_left>0.0000</percent_left>
<percent_right>0.0000</percent_right>
<ymin_type_1>0</ymin_type_1>
<ymax_type_1>0</ymax_type_1>
<ymin_item_1>0</ymin_item_1>
<ymax_item_1>0</ymax_item_1>
<graph_items>
<graph_item>
<sortorder>0</sortorder>
<drawtype>5</drawtype>
<color>3333FF</color>
<yaxisside>0</yaxisside>
<calc_fnc>4</calc_fnc>
<type>0</type>
<item>
<host>Custom Template - OpenVPN server</host>
<key>script.openvpn_stats.incomming</key>
</item>
</graph_item>
<graph_item>
<sortorder>1</sortorder>
<drawtype>5</drawtype>
<color>00C800</color>
<yaxisside>0</yaxisside>
<calc_fnc>4</calc_fnc>
<type>0</type>
<item>
<host>Custom Template - OpenVPN server</host>
<key>script.openvpn_stats.outbound</key>
</item>
</graph_item>
</graph_items>
</graph>
</graphs>
</zabbix_export>
@dtnetworkbr
Copy link

dtnetworkbr commented Dec 3, 2015

Hi, i importing, receive a error:

Não foi possível localizar o mapeamento de valores "Simple Ping status" utilizado para o item "OpenVPN client health check (ping)" em "Custom Template - OpenVPN clients".

any idea?

Sorry my bad english.

Thanks

@dougti
Copy link

dougti commented Feb 24, 2016

Just a random guess after reading through the XML file, replace this bit...

<valuemap>
        <name>Simple Ping status</name>
</valuemap>

with...
<valuemap/>

...and it works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment