Projet

Général

Profil

Révision 5874ebac

ID5874ebac10e5708355d4058f3b47de4ae7329154
Parent 8ec65537
Enfant 35732520

Ajouté par Steve Mokris il y a presque 14 ans

Initial version

Voir les différences:

plugins/other/dell_5310n_pages_
1
#!/bin/bash
2
#
3
# dell_5310n_pages_ munin grabber script
4
# 2008.07 by steve@kosada.com
5

  
6
destination=`basename $0 | sed 's/^dell_5310n_pages_//g'`
7
password='Rah5xuuD'
8

  
9
tmpWeb=/tmp/`basename $0`
10
wget -q -O $tmpWeb http://root:$password@$destination/cgi-bin/dynamic/config/reports/devicestatistics.html
11

  
12
#numTrays=`grep -c Letter $tmpWeb`
13
trays=`grep '>Letter-' $tmpWeb | perl -p -e 's/^.+>Letter-([^<]+)<.+$/$1/' | perl -p -e 's/ //g'`
14

  
15

  
16
if [ "$1" = "config" ]; then
17
        echo "graph_title dell 5310n pages: $destination"
18
        echo 'graph_vlabel count'
19
	echo 'graph_args --lower-limit 0'
20
        echo 'graph_category printer'
21

  
22
	n=1
23
	for t in $trays ;
24
	do
25
		echo "tray$n.label Tray $n: $t"
26
		n=$(($n+1))
27
	done
28
	echo "total.label Total"
29
else
30
	tmpWebPage=`cat $tmpWeb | perl -p -e 's/[ \t\n\r]//g'`
31
#echo $tmpWebPage
32

  
33
	n=1
34
	for t in $trays ;
35
	do
36
		#echo tray$n.value `echo $tmpWebPage | perl -p -e 's/^.+>Letter-$t<\/p><\/td><td><p>([0-9]+)<.+$/$1/'`
37
		echo tray$n.value `echo $tmpWebPage | perl -p -e "s/^.+\>Letter-$t\<\/p\>\<\/td\>\<td\>\<p\>([0-9]+)\<.+\$/\\$1/"`
38
		n=$(($n+1))
39
	done
40
	echo total.value    `grep '40\;\">Total' $tmpWeb | perl -p -e 's/^.+<p> ([0-9]+) <\/p>.+$/$1/'`
41
fi
42

  
43

  
44
rm $tmpWeb

Formats disponibles : Unified diff