SOURCES: cacti-addons-snmpdiskio-0.9.6.patch (NEW) - update to 0.9.6 from t...

glen glen at pld-linux.org
Sun Oct 5 15:05:04 CEST 2008


Author: glen                         Date: Sun Oct  5 13:05:04 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- update to 0.9.6 from this post: http://forums.cacti.net/viewtopic.php?p=124793#124793

---- Files affected:
SOURCES:
   cacti-addons-snmpdiskio-0.9.6.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/cacti-addons-snmpdiskio-0.9.6.patch
diff -u /dev/null SOURCES/cacti-addons-snmpdiskio-0.9.6.patch:1.1
--- /dev/null	Sun Oct  5 15:05:05 2008
+++ SOURCES/cacti-addons-snmpdiskio-0.9.6.patch	Sun Oct  5 15:04:59 2008
@@ -0,0 +1,61 @@
+--- ./snmpdiskio	2008-10-05 16:00:39.870799390 +0300
++++ 0.9.6/snmpdiskio 	2008-10-05 16:01:46.636993902 +0300
+@@ -1,7 +1,21 @@
+-#!/bin/sh
+-# $Id$
++#!/bin/bash
++# $Id$
++# snmpdiskio v0.9.6 (c) 2008 Dieter Verlaeckt <dieter.verlaeckt at gmail.com>
++# snmpdiskio v0.9.5 (c) 2007 Pablo Destefanis <pdestefanis at gmail.com>
+ # snmpdiskio v0.9.4 (c) 2006 Mikael Fridh <mikael at meanstreak.se>
+ 
++# Fields in /proc/partitions (kernel 2.4)
++# major minor #blocks name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq
++
++# Fields in /proc/diskstats (kernel 2.6) for disks (i.e. hda)
++# major minor name rio rmerge rsect ruse wio wmerge wsect wuse running use aveq
++
++# Fields in /proc/diskstats (kernel 2.6) for partitions (i.e. hda1)
++# major minor name rio rsect wio wsect
++
++# InBlocks = sectors written to disk
++# OutBlocks = sectors read from disk
++
+ # Set default procfile for kernel 2.4
+ PROCFILE="/proc/partitions"
+ MODE="linux24"
+@@ -32,19 +46,27 @@
+ 	fi
+ }
+ 
+-hdInBlocks()
++hdInBlocks()
+ {
+-	awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && $10 ~ /[0-9]+/ { printf "%.0f\n", $10 * 512 }
+-	      $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && $10 !~ /[0-9]+/ { printf "%.0f\n", $5 * 512 } ' $PROCFILE
++        if [ "$MODE" = "linux26" ]; then
++                awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 7 { printf "%.0f\n", $7 * 512 }
++                      $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 14 { printf "%.0f\n", $10 * 512 } ' $PROCFILE
++        else
++                awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 15 { printf "%.0f\n", $11 * 512 } ' $PROCFILE
++        fi
+ }
+ 
+-hdOutBlocks()
++hdOutBlocks()
+ {
+-	awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && $8 ~ /[0-9]+/ { printf "%.0f\n", $8 * 512 }
+-	      $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && $8 !~ /[0-9]+/ { printf "%.0f\n", $7 * 512 } ' $PROCFILE
++        if [ "$MODE" = "linux26" ]; then
++                awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 7 { printf "%.0f\n", $5 * 512 }
++                      $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 14 { printf "%.0f\n", $6 * 512 } ' $PROCFILE
++        else
++                awk ' $1 ~ /[0-9]+/ && $2 ~ /[0-9]+/ && NF == 15 { printf "%.0f\n", $7 * 512 } ' $PROCFILE
++        fi
+ }
+ 
+-usage()
++usage()
+ {
+ 	cat <<-EOUSAGE
+ Usage: $0 <hdNum|hdIndex|hdDescr|hdInBlocks|hdOutBlocks>
================================================================


More information about the pld-cvs-commit mailing list