File: munin_graph.in

package info (click to toggle)
munin 1.2.3-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,940 kB
  • ctags: 98
  • sloc: sh: 4,215; makefile: 452; perl: 135
file content (70 lines) | stat: -rwxr-xr-x 1,647 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
#
# Script to monitor munin-graph
#
# Parameters understood:
#
# 	config   (required)
# 	autoconf (optional - used by munin-config)
#
# $Log$
# Revision 1.3  2004/12/09 18:39:01  jimmyo
# Added more sensible autoconf to generic/munin_graph,munin_update,sybase_space.
#
# Revision 1.2  2004/01/29 19:39:00  jimmyo
# Generic plugins now use printf instead of echo -n, as this is more portable (SF#885564)
#
# Revision 1.1  2004/01/02 18:50:00  jimmyo
# Renamed occurrances of lrrd -> munin
#
# Revision 1.1.1.1  2004/01/02 15:18:07  jimmyo
# Import of LRRD CVS tree after renaming to Munin
#
# Revision 1.6  2003/11/10 18:13:46  jimmyo
# Revert changes done in 1.5
#
# Revision 1.5  2003/11/07 17:43:16  jimmyo
# Cleanups and log entries
#
#
#
# Magic markers (optional - used by munin-config and installation
# scripts):
#
#%# family=manual
#%# capabilities=autoconf

if [ ! "$GRAPH_STATSFILE" ] ; then
	GRAPH_STATSFILE=@@DBDIR@@/munin-graph.stats
fi

if [ "$1" = "autoconf" ]; then
	if [ -f $GRAPH_STATSFILE ]; then
	    echo "yes"
	    exit 0
	fi
	echo "no (statefile not found)"
	exit 1
fi

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

	echo 'graph_title Munin-graph'
	echo 'graph_vlabel seconds'
	[ -f $GRAPH_STATSFILE ] || exit 0
	cat $GRAPH_STATSFILE | grep "GD" | while read i; do
		name=`echo $i | cut -d"|" -f2 |tr  '.-' '__'`
		printf "$name.label "
		echo $i | cut -d"|" -f2
		echo "$name.warning 100"
		echo "$name.critical 179"
	done
	exit 0
fi

[ -f $GRAPH_STATSFILE ] || exit 0
cat $GRAPH_STATSFILE | grep "GD" | while read i; do
        name=`echo $i | cut -d"|" -f2 | tr  '.-' '__'`
	printf "$name.value "
	echo $i | cut -d"|" -f3
done