Projet

Général

Profil

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

root / plugins / rabbitmq / rabbitmq-consumers @ e5ce7492

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

1
#!/bin/sh
2
#
3

    
4
#Author:  Juned Memon 
5
#www.TipsNtrapS.com
6
#mail:juned.memon@tipsntraps.com
7

    
8
# If run with the "autoconf"-parameter, give our opinion on wether we
9
# should be run on this system or not. This is optinal, and only used by
10
# munin-config. In the case of this plugin, we should most probably
11
# always be included.
12

    
13
if [ "$1" = "autoconf" ]; then
14
        echo yes
15
        exit 0
16
fi
17

    
18
# If run with the "config"-parameter, give out information on how the
19
# graphs should look.
20

    
21
VHOST="/"
22
QUEUE="ViApiQueue"
23

    
24
if [ "$1" = "config" ]; then
25

    
26
        # The title of the graph
27
        echo "graph_title RabbitMQ $VHOST consumers"
28
        # Arguments to "rrdtool graph". In this case, tell it that the
29
        # lower limit of the graph is '0', and that 1k=1000 (not 1024)
30
        echo 'graph_args --base 1000 -l 0'
31
        # The Y-axis label
32
        echo 'graph_vlabel consumers'
33
        # We want Cur/Min/Avg/Max unscaled (i.e. 0.42 load instead of
34
        # 420 milliload)
35
        #echo 'graph_scale no'
36
        echo 'graph_category RabbitMQ'
37

    
38
                echo "$QUEUE.label $QUEUE"
39
                echo "$QUEUE.warning $QUEUE_WARN"
40
                echo "$QUEUE.critical $QUEUE_CRIT"
41
                echo "$QUEUE.info Active consumers for $QUEUE"
42

    
43
        echo 'graph_info Lists active consumers for a queue.'
44
        # Last, if run with the "config"-parameter, quit here (don't
45
        # display any data)
46
        exit 0
47
fi
48
# If not run with any parameters at all (or only unknown ones), do the
49
# real work - i.e. display the data. Almost always this will be
50
# "value" subfield for every data field.
51
rabbitmqctl list_queues -p $VHOST name consumers -q | grep $QUEUE |perl -nle'($q, $s) = split; $q =~ s/[.-=]/_/g; print("$q.value $s")'