Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / vpn / openvpn_as_users @ ae4e85ab

Historique | Voir | Annoter | Télécharger (1,25 ko)

1
#!/bin/sh
2
# -*- sh -*-
3

    
4
: << =cut
5

    
6
=head1 NAME
7

    
8
openvpn_as_users -Indicate the number of users and the license limit
9

    
10
=head1 CONFIGURATION
11

    
12
[openvpn_*]
13
user root
14

    
15
=head1 AUTHOR
16

    
17
Ricardo Fraile <rfrail3@yahoo.es>
18

    
19
=head1 LICENSE
20

    
21
GPLv2
22

    
23
=head1 MAGICK MARKERS
24

    
25
 #%# family=auto
26
 #%# capabilities=autoconf
27

    
28
=cut
29

    
30
. $MUNIN_LIBDIR/plugins/plugin.sh
31

    
32

    
33

    
34

    
35
if [ "$1" = "autoconf" ]; then
36
	echo yes 
37
	exit 0
38
fi
39

    
40
# Script folder
41
D_BIN="/usr/local/openvpn_as/scripts"
42
# Number of clients
43
VAL1=`$D_BIN/sacli VPNSummary | grep clients | awk '{print $2}'`
44
# Limit of clients by license
45
VAL2=`$D_BIN/liman info | grep -o  "[0-9]*"`
46
# Warn value
47
WARN=80
48

    
49
if [ "$1" = "config" ]; then
50

    
51
	echo 'graph_title OpenVPN Users'
52
	echo 'graph_args --base 1000 -l 0 '
53
	echo 'graph_vlabel Users'
54
	echo 'graph_scale no'
55
	echo 'graph_category network'
56
	echo 'graph_info Indicate the number of vpn users and the license limit.'
57

    
58
        echo "users.label Users"
59
        echo "users.type GAUGE"
60
        echo "users.draw AREA"
61
        echo "users.min 0"
62
	
63
        echo "users.warning $((VAL2 * $WARN / 100))"	
64
        echo "users.critical $VAL2"	
65

    
66

    
67
        echo "limit.label Limit"
68
        echo "limit.type GAUGE"
69
        echo "limit.min 0"
70

    
71

    
72
	exit 0
73
fi
74

    
75

    
76

    
77
echo "users.value $VAL1"
78
echo "limit.value $VAL2"
79
	
80