Projet

Général

Profil

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

root / plugins / radiator / radiator_acct_ppm @ e5ce7492

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

1
#!/bin/sh
2
#
3
# Plugin to monitor Radiator ACCT ppm statistics
4
#
5
# Parameters:
6
#
7
# 	config   (required)
8
# 	autoconf (optional - only used by munin-config)
9
#
10
# Config variables:
11
#
12
#       statisticsdir     - Radiator ACCT statistics directory
13
#
14
# Magic markers (optional - used by munin-config and some installation
15
# scripts):
16
#%# family=auto
17
#%# capabilities=autoconf
18

    
19
STATISTICSDIR=/usr/radius/radiator/log/STATISTICS
20
if [ "$statisticsdir"  ]; then STATISTICSDIR=$statisticsdir ; fi
21

    
22

    
23
if [ "$1" = "autoconf" ]; then
24
        if [ -d ${STATISTICSDIR} ] ; then
25
                echo yes
26
                exit 0
27
        else
28
                echo no
29
                exit 1
30
        fi
31
fi
32

    
33

    
34
if [ "$1" = "config" ]; then
35
	echo 'graph_title Radiator ACCT packets'
36
	echo 'graph_period minute'
37
	echo 'graph_vlabel packets per minute'
38
	echo 'graph_args -l 0'
39
	echo 'graph_category radiator'
40
	echo 'graph_info This graph displays ACCT packets of all radiator processes combined.'
41
	#
42
	# Count all statistics files and create labels
43
	for COUNT in `ls $STATISTICSDIR/Statistics-acct* | sed -r 's/acct([1-9]{1})\.log$/acct0\1\.log/g' | sort | awk -F"acct" '{print $2}' | sed 's/\.log//g'`; do
44
		echo 'radiator'$COUNT'.label radiator_'$COUNT' '
45
		echo 'radiator'$COUNT'.type DERIVE'
46
		echo 'radiator'$COUNT'.min 0'
47
		echo 'radiator'$COUNT'.info radiator proc '$COUNT
48
	done
49
	exit 0
50
fi
51

    
52
# Print values for all statistics files
53
for FILE in `ls $STATISTICSDIR/Statistics-acct* | sed -r 's/acct([1-9]{1})\.log$/acct0\1\.log/g' | sort`; do
54
	echo -n radiator`echo $FILE | awk -F"acct" '{print $2}' | sed 's/\.log//g'`".value "
55
	grep "ServerConfig" `echo $FILE | sed -r 's/acct[0]([1-9])\.log$/acct\1\.log/g'` | tail -1 | awk -F"|" '{print $2}'
56
done