Projet

Général

Profil

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

root / plugins / node.d / freeradius_queue.in @ 31ad4788

Historique | Voir | Annoter | Télécharger (3,12 ko)

1
#!/bin/sh
2
: << =cut
3

    
4
=head1 NAME
5

    
6
freeradius_queue - Plugin to get number of waiting packets in FreeRADIUS queues
7

    
8
=head1 APPLICABLE SYSTEMS
9

    
10
FreeRADIUS 3.0.7 or later.
11

    
12
=head1 CONFIGURATION
13

    
14
This plugin uses the following configuration variables:
15

    
16
 [freeradius_queue]
17
  env.radmin     - Path to "radmin" executable.
18
  env.socketfile - Path to administration socket.
19

    
20
=head1 AUTHOR
21

    
22
Copyright (C) 2015 Arran Cudbard-Bell <a.cudbardb@freeradius.org>
23

    
24
=head1 LICENSE
25

    
26
 This program is free software; you can redistribute it and/or modify
27
 it under the terms of the GNU General Public License as published by
28
 the Free Software Foundation; either version 2 of the License, or
29
 (at your option) any later version.
30

    
31
 This program is distributed in the hope that it will be useful,
32
 but WITHOUT ANY WARRANTY; without even the implied warranty of
33
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
34
 GNU General Public License for more details.
35

    
36
 You should have received a copy of the GNU General Public License
37
 along with this program; if not, write to the Free Software
38
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
39

    
40
=head1 MAGIC MARKERS
41

    
42
 #%# family=auto
43
 #%# capabilities=autoconf
44

    
45
=cut
46

    
47
RADMIN=${radmin:-`which radmin 2>/dev/null`}
48
RADMIN=${RADMIN:-/usr/sbin/radmin}
49
SOCKETFILE=${socketfile:-/var/run/radiusd/radiusd.sock}
50

    
51
#
52
# Check we can execute radmin, and check that the stats queue
53
# command exists, and provides us with valid results.
54
#
55
# Note: Before 3.0.7 there was no separate communications channel
56
# for error codes or error messages, so radmin would always exit
57
# with 0, even on failure.
58
#
59
if [ "$1" = "autoconf" ]; then
60
    if [ -x $RADMIN ] && $RADMIN -f $SOCKETFILE -e "stats queue" 2>/dev/null | grep 'queue_len' > /dev/null; then
61
        echo yes
62
    else
63
        echo no
64
    fi
65
    exit 0
66
fi
67

    
68
if [ "$1" = "config" ]; then
69
    echo 'graph_title FreeRADIUS queued packets'
70
    echo 'graph_args --base 1000 -l 0 '
71
    echo 'graph_period second'
72
    echo 'graph_vlabel requests / ${graph_period}'
73
    echo 'graph_category Other'
74

    
75
    echo 'queue_len_internal.label Internal'
76
    echo 'queue_len_internal.info number of requests waiting in the internal queue'
77
    echo 'queue_len_internal.type DERIVE'
78
    echo 'queue_len_internal.min 0'
79

    
80
    echo 'queue_len_proxy.label Proxy'
81
    echo 'queue_len_proxy.info number of requests waiting in the proxy queue'
82
    echo 'queue_len_proxy.type DERIVE'
83
    echo 'queue_len_proxy.min 0'
84

    
85
    echo 'queue_len_auth.label Authentication'
86
    echo 'queue_len_auth.info number of requests waiting in the authentication queue'
87
    echo 'queue_len_auth.type DERIVE'
88
    echo 'queue_len_auth.min 0'
89

    
90
    echo 'queue_len_acct.label Accounting'
91
    echo 'queue_len_acct.info number of requests waiting in the accounting queue'
92
    echo 'queue_len_acct.type DERIVE'
93
    echo 'queue_len_acct.min 0'
94

    
95
    echo 'queue_len_detail.label Detail reader'
96
    echo 'queue_len_detail.info number of requests waiting in the detail queue'
97
    echo 'queue_len_detail.type DERIVE'
98
    echo 'queue_len_detail.min 0'
99

    
100
    exit 0
101
fi
102

    
103
$RADMIN -f $SOCKETFILE -e "stats queue" | grep 'queue_len*' |  awk '{print $1".value " $2}'