Projet

Général

Profil

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

root / plugins / tv / hdhomerun_ @ 28db7a12

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

1
#!/bin/bash
2
#
3
# HDHomeRun Signal grapher
4
# David Muench - davemuench at gmail
5
#
6
# Version 1 - 1/19/11 - Initial release
7
#
8
# Munin plugin to graph the signal strength/quality for a HDHomeRun TV tuner.
9
# Developed and tested against a HDHR US Dual model.
10
#
11
# Requires the hdhomerun_config binary. It can be obtained from
12
# http://www.silicondust.com/support/hdhomerun/downloads/linux/
13
# Or if you are running Debian/Ubuntu:
14
# apt-get install hdhomerun-config
15
#
16
# Place the hdhomerun_ script in your munin plugins directory (usually
17
# /usr/share/munin/plugins) and create symlinks of the format
18
# "hdhomerun_<deviceid>_tuner<number>", such as hdhomerun_123456_tuner0.
19
# The deviceid can be obtained by running "hdhomerun_config discover".
20
# Alternatively, the script supports the suggest option which will
21
# scan for all HDHomeRun devices on the network and set up the symlinks.
22
# To do this, run:
23
#
24
# munin-node-configure --shell | grep hdhomerun | bash
25
#
26
# Note: It will assume you have a dual tuner model and set up links
27
# for tuner0 and tuner1. If you have a single tuner model, just delete
28
# the tuner1 link.
29
#
30
#%# family=auto
31
#%# capabilities=autoconf suggest
32

    
33
CONFIGPROG="/usr/bin/hdhomerun_config"
34

    
35
DEVID="`echo $0 | cut -d _ -f 2`"
36
TUNER="`echo $0 | cut -d _ -f 3`"
37

    
38

    
39
if [ "$1" = "autoconf" ] ; then
40
        if [ -x "$CONFIGPROG" ] ; then
41
                echo "yes"
42
        else
43
                echo "no ($CONFIGPROG Does not exist or isn't executable!)."
44
        fi
45
        exit
46
fi
47

    
48
if [ "$1" = "config" ] ; then
49
	echo "graph_title HDHomeRun $DEVID $TUNER Signal Strength"
50
	echo "graph_args --upper-limit 100 -l 0"
51
	echo "graph_vlabel %"
52
	echo "graph_scale no"
53
	echo "graph_category tv"
54
	echo "ss.label Signal Strength"
55
	echo "snq.label Signal Quality"
56
	echo "seq.label Symbol Quality"
57
	exit
58
fi
59

    
60
if [ "$1" = "suggest" ] ; then
61
	for i in "`$CONFIGPROG discover`"; do
62
		echo "`echo $i | awk '{print $3}'`_tuner0"
63
		echo "`echo $i | awk '{print $3}'`_tuner1"
64
	done
65
	exit
66
fi
67

    
68
OUTPUT="`$CONFIGPROG $DEVID get /$TUNER/status`"
69

    
70
# Signal Strength
71
echo "ss.value `echo $OUTPUT | sed -e 's/^.*ss=//' -e 's/d* .*$//'`"
72
# Signal Quality
73
echo "snq.value `echo $OUTPUT | sed -e 's/^.*snq=//' -e 's/d* .*$//'`"
74
# Symbol Quality
75
echo "seq.value `echo $OUTPUT | sed -e 's/^.*seq=//' -e 's/d* .*$//'`"