Projet

Général

Profil

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

root / plugins / condor / condor_states_ @ 84c28707

Historique | Voir | Annoter | Télécharger (2,86 ko)

1
#!/bin/bash
2
#
3
# Wildard-plugin to monitor node "states" in Condor pool.
4
#
5
# Author: Šarūnas Burdulis, sarunas(a)mail.saabnet.com, 2008
6
#
7
# Runs 'condor_status' and gets totals of nodes
8
# ("slots") for different Condor "states".
9
#
10
# Parameters understood:
11
#
12
#	config   (required)
13
# 	autoconf (optional - used by munin-config)
14
#	suggest  (optional - used by munin-config)
15
#
16
# Configurable variables:
17
#
18
# 	env.condor_status - Path to condor_status executable,
19
#		defaults to /usr/local/condor/bin/condor_status
20
# 	env.constraint - Condor ClassAds constraint(s), as they are
21
#		specified on the condor_status command line. For example, 
22
#		to monitor 64-bit Linux nodes only, set:
23
#		env.constraint 'arch=="x86_64" && opsys=="linux"'
24
#
25
# Magic markers - optional - used by installation scripts and
26
# munin-config:
27
#
28
#%# family=contrib
29
#%# capabilities=autoconf
30

    
31
# optional tag
32
TAG=`basename $0 | sed 's/^condor_states_//g'`
33
if [ -z "$TAG" ]; then
34
    GRAPHTITLE="States"
35
else
36
    GRAPHTITLE="States (${TAG})"
37
fi
38

    
39
# env.condor_status
40
if [ ! -z "$condor_status" ]; then
41
    CS="$condor_status"
42
else
43
    CS="/usr/local/condor/bin/condor_status"
44
fi
45

    
46
# env.constraint
47
if [ ! -z "$constraint" ]; then
48
    CONS="-constraint ${constraint}"
49
else
50
    CONS=
51
fi
52
 
53
if [ "$1" = "autoconf" ]; then
54
    echo "no"
55
    exit 1
56
fi
57

    
58
if [ "$1" = "suggest" ]; then
59
    echo "For example: condor_states_Linux-x86_64."
60
    exit 0
61
fi
62

    
63
if [ "$1" = "config" ]; then
64
	echo "graph_title "$GRAPHTITLE""
65
	echo "graph_order Preempting Claimed Matched Unclaimed Owner"
66
	echo "graph_args --lower-limit 0 "
67
	echo 'graph_vlabel VMs'
68
	echo 'graph_scale no'
69
	echo 'graph_info Shows Condor slot states from condor_status.'
70
	echo 'graph_category htc'
71
	echo 'graph_period second'
72
	echo 'Preempting.label Preempting'
73
	echo 'Preempting.draw AREA'
74
	echo 'Preempting.type GAUGE'
75
	echo "Preempting.info Slots in Preempting state" 
76
	echo 'Claimed.label Claimed'
77
	echo 'Claimed.draw STACK'
78
	echo 'Claimed.type GAUGE'
79
	echo 'Claimed.info Slots in Claimed state'
80
	echo 'Matched.label Matched'
81
	echo 'Matched.draw STACK'
82
	echo 'Matched.type GAUGE'
83
	echo 'Matched.info Slots in Matched state'
84
	echo 'Unclaimed.label Unclaimed'
85
	echo 'Unclaimed.draw STACK'
86
	echo 'Unclaimed.type GAUGE'
87
	echo 'Unclaimed.info Slots in Unclaimed state'
88
	echo 'Owner.label Owner'
89
	echo 'Owner.draw STACK'
90
	echo 'Owner.type GAUGE'
91
	echo 'Owner.info Slots in Owner state'
92
	exit 0
93
fi
94

    
95
# condor_status -cons 'arch=="x86_64" && opsys=="linux"' -total
96
#                Total Owner Claimed Unclaimed Matched Preempting Backfill
97
#   X86_64/LINUX    22     1      18         3       0          0        0
98
#   x86_64/LINUX     8     0       8         0       0          0        0
99
#          Total    30     1      26         3       0          0        0
100
eval $CS $CONS -total | awk '/Total   / {print "Preempting.value " $7 "\nClaimed.value " $4 "\nMatched.value " $6 "\nUnclaimed.value " $5 "\nOwner.value " $3 }'