File: foldingathome_wu.in

package info (click to toggle)
munin 2.0.76-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,068 kB
  • sloc: perl: 11,684; java: 1,924; sh: 1,632; makefile: 636; javascript: 365; python: 267
file content (55 lines) | stat: -rw-r--r-- 966 bytes parent folder | download | duplicates (6)
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
#!@@GOODSH@@
# -*- sh -*-

: <<EOF

=head1 NAME

foldingathome_wu - Plugin to graph the number of working units
submitted to folding@home

=head1 CONFIGURATION

No configuration

=head1 AUTHORS

Unknown author

=head1 LICENSE

GPLv2

=head1 BUGS

Plugin has capabilities "autoconf", but "autoconf" seems broken.

=head1 MAGIC MARKERS

 #%# family=contrib

=cut

EOF

statefile=$MUNIN_PLUGSTATE/plugin-fah_wu.state

if [ "$1" = "config" ]; then
    echo 'graph_title Folding@Home Working Units submited'
    echo 'graph_args -l 0 --base 1000'
    echo 'graph_vlabel WU done'
    echo 'wu.label WU'
    echo 'wu.type GAUGE'
    exit 0
fi

wu=$(wget "http://vspx27.stanford.edu/cgi-bin/main.py?qtype=userpage&username=8d" -q -t 1 -T 5 -O - | grep -E -A 2 "<TD> WU</TD>" | grep "<b>" | sed 's/.*<b> \([0-9]*\) .*/\1/')

if [ -z "$wu" ]; then
	if [ -f "$statefile" ]; then
		echo "wu.value $(cat "$statefile")"
	fi
else
	echo "$wu" > "$statefile"
	echo "wu.value $wu"
fi