]> git.pld-linux.org Git - packages/cacti-template-snmpdiskio.git/blame - snmpdiskio-0.9.6.patch
- drop obsolete and outdated manual inclusion of rpm macros
[packages/cacti-template-snmpdiskio.git] / snmpdiskio-0.9.6.patch
CommitLineData
4a571d2d
ER
1--- ./snmpdiskio 2008-10-05 16:00:39.870799390 +0300
2+++ 0.9.6/snmpdiskio 2008-10-05 16:01:46.636993902 +0300
3@@ -1,7 +1,21 @@
4-#!/bin/sh
00a441a6 5-# $Id: snmpdiskio,v 1.3 2006/04/04 13:11:47 mikaelf Exp $
751a6b01 6+#!/bin/sh
00a441a6 7+#
4a571d2d
ER
8+# snmpdiskio v0.9.6 (c) 2008 Dieter Verlaeckt <dieter.verlaeckt@gmail.com>
9+# snmpdiskio v0.9.5 (c) 2007 Pablo Destefanis <pdestefanis@gmail.com>
10 # snmpdiskio v0.9.4 (c) 2006 Mikael Fridh <mikael@meanstreak.se>
11
12+# Fields in /proc/partitions (kernel 2.4)
13+# major minor #blocks name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq
14+
15+# Fields in /proc/diskstats (kernel 2.6) for disks (i.e. hda)
16+# major minor name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq
17+
18+# Fields in /proc/diskstats (kernel 2.6) for partitions (i.e. hda1)
19+# major minor name rio rsect wio wsect
20+
21+# InBlocks = sectors written to disk
22+# OutBlocks = sectors read from disk
23+
24 # Set default procfile for kernel 2.4
25 PROCFILE="/proc/partitions"
26 MODE="linux24"
27@@ -32,19 +46,27 @@
28 fi
29 }
30
31-hdInBlocks()
32+hdInBlocks()
33 {
34- awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && $10 ~ /[0-9]+/ { printf "%.0f\n", $10 * 512 }
35- $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && $10 !~ /[0-9]+/ { printf "%.0f\n", $5 * 512 } ' $PROCFILE
36+ if [ "$MODE" = "linux26" ]; then
37+ awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 7 { printf "%.0f\n", $7 * 512 }
38+ $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 14 { printf "%.0f\n", $10 * 512 } ' $PROCFILE
39+ else
40+ awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 15 { printf "%.0f\n", $11 * 512 } ' $PROCFILE
41+ fi
42 }
43
44-hdOutBlocks()
45+hdOutBlocks()
46 {
47- awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && $8 ~ /[0-9]+/ { printf "%.0f\n", $8 * 512 }
48- $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && $8 !~ /[0-9]+/ { printf "%.0f\n", $7 * 512 } ' $PROCFILE
49+ if [ "$MODE" = "linux26" ]; then
50+ awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 7 { printf "%.0f\n", $5 * 512 }
51+ $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 14 { printf "%.0f\n", $6 * 512 } ' $PROCFILE
52+ else
53+ awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 15 { printf "%.0f\n", $7 * 512 } ' $PROCFILE
54+ fi
55 }
56
57-usage()
58+usage()
59 {
60 cat <<-EOUSAGE
61 Usage: $0 <hdNum|hdIndex|hdDescr|hdInBlocks|hdOutBlocks>
This page took 0.077328 seconds and 4 git commands to generate.