Projet

Général

Profil

Révision dbaeb025

IDdbaeb0253c54487808e0a191db1484c444bdc798
Parent 16ab1d10
Enfant f6738f41

Ajouté par Lars Kruse il y a plus de 5 ans

Plugins apache_tmemory and apache_servers: multiple changes

  • use base SI units for memory consumption
    (breaks graph values compared to older version)
  • fix quoting for regular expressions
  • use common defaults for configuration settings

Voir les différences:

plugins/apache/apache_servers
5 5

  
6 6
=head1 NAME
7 7

  
8
apache_servers -Indicate the number of apache servers running (child process)
8
apache_servers - Indicate the number of apache servers running (child process)
9 9

  
10 10
=head1 CONFIGURATION
11 11

  
12 12
[apache_*]
13
env.apuser user_runnin_apache
14
env.binname apache_binary_name
13
env.apuser user_running_apache (default: "www-data")
14
env.binname apache_binary_name (default: "apache2")
15 15

  
16 16
=head1 AUTHOR
17 17

  
......
28 28

  
29 29
=cut
30 30

  
31
. $MUNIN_LIBDIR/plugins/plugin.sh
31
. "$MUNIN_LIBDIR/plugins/plugin.sh"
32 32

  
33
USR=$apuser
34
PROCS=$binname
33
USR=${apuser:-www-data}
34
PROCS=${binname:-apache2}
35 35

  
36 36
if [ "$1" = "autoconf" ]; then
37 37
	echo yes
......
40 40

  
41 41
if [ "$1" = "config" ]; then
42 42

  
43
	echo 'graph_title Number of apache servers running.'
44
	echo 'graph_args --base 1000 -l 0 '
45
	echo 'graph_vlabel servers'
46
	echo 'graph_scale no'
47
	echo 'graph_category webserver'
48
	echo 'graph_info Indicate the number of apache servers running (child process).'
43
    echo 'graph_title Number of apache servers running'
44
    echo 'graph_args --base 1000 -l 0 '
45
    echo 'graph_vlabel servers'
46
    echo 'graph_scale no'
47
    echo 'graph_category webserver'
48
    echo 'graph_info Indicate the number of apache servers running (child process).'
49 49

  
50
    echo "servers.label servers"
51
    echo "servers.type GAUGE"
52
    echo "servers.min 0"
53
    echo "servers.info Number of apache processes"
50 54

  
51

  
52
        echo "servers.label servers"
53
        echo "servers.type GAUGE"
54
        echo "servers.min 0"
55
        echo "servers.info I/O on nfs"
56

  
57
	exit 0
55
    exit 0
58 56
fi
59 57

  
60
VAL1=`ps auxf | grep ${PROCS} | grep ^${USR} | grep -v grep | wc -l`
61

  
62
echo "servers.value $VAL1"
63

  
64

  
58
process_count=$(ps auxf | grep -- "$PROCS" | grep "^$USR" | grep -v grep | wc -l)
59
echo "servers.value $process_count"
plugins/apache/apache_tmemmory
5 5

  
6 6
=head1 NAME
7 7

  
8
apache_tmemmory -Indicate the total memory used by apache
8
apache_tmemmory - Indicate the total memory used by apache
9 9

  
10 10
=head1 CONFIGURATION
11 11

  
12 12
[apache_*]
13
env.binname apache_binary_name
13
env.apuser user_running_apache (default: "www-data")
14
env.binname apache_binary_name (default: "apache2")
14 15

  
15 16
=head1 AUTHOR
16 17

  
......
27 28

  
28 29
=cut
29 30

  
30
. $MUNIN_LIBDIR/plugins/plugin.sh
31
. "$MUNIN_LIBDIR/plugins/plugin.sh"
31 32

  
32

  
33
USR=$apuser
34
PROCS=$binname
33
USR=${apuser:-www-data}
34
PROCS=${binname:-apache2}
35 35

  
36 36

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

  
42 42
if [ "$1" = "config" ]; then
43 43

  
44
	echo 'graph_title Total memory used by apache'
45
	echo 'graph_args --base 1000 -l 0 '
46
	echo 'graph_vlabel Mb'
47
	echo 'graph_scale no'
48
	echo 'graph_category webserver'
49
	echo 'graph_info Indicate the total memory used by apache.'
44
    echo 'graph_title Total memory used by apache'
45
    echo 'graph_args --base 1024 -l 0 '
46
    echo 'graph_vlabel bytes'
47
    echo 'graph_scale no'
48
    echo 'graph_category webserver'
49
    echo 'graph_info Indicate the total memory used by apache.'
50 50

  
51
        echo "servers.label servers"
52
        echo "servers.type GAUGE"
53
        echo "servers.min 0"
51
    echo "servers.label servers"
52
    echo "servers.type GAUGE"
53
    echo "servers.min 0"
54 54

  
55
	exit 0
55
    exit 0
56 56
fi
57 57

  
58
VAL1=`ps auxf | grep ${PROCS} | grep -v grep | awk '{s+=$6} END {print s}'`
59

  
60
VAL2=`expr $VAL1 / 1024`
61

  
62
echo "servers.value $VAL2"
63

  
64

  
58
total_memory=$(ps auxf | grep -- "$PROCS" | grep "^$USR" | grep -v grep | awk '{s+=$6} END {print s * 1024}')
59
echo "servers.value $total_memory"
t/test-exception-wrapper.expected-failures
6 6
plugins/amule/amule_transfers
7 7
plugins/amule/amule_uptime
8 8
plugins/apache/apache_cache_disk_count
9
plugins/apache/apache_servers
10 9
plugins/apache/apache_threads
11
plugins/apache/apache_tmemmory
12 10
plugins/apache/apache_users
13 11
plugins/apache/page_load
14 12
plugins/apache/qpid_bytedepth

Formats disponibles : Unified diff