[csw-devel] SF.net SVN: gar:[12530] csw/mgar/pkg/munin/trunk/files/if.in.patch

j_arndt at users.sourceforge.net j_arndt at users.sourceforge.net
Thu Jan 13 21:42:03 CET 2011


Revision: 12530
          http://gar.svn.sourceforge.net/gar/?rev=12530&view=rev
Author:   j_arndt
Date:     2011-01-13 20:42:03 +0000 (Thu, 13 Jan 2011)

Log Message:
-----------
Better fix for network plugin for Solaris 10 and later

Modified Paths:
--------------
    csw/mgar/pkg/munin/trunk/files/if.in.patch

Modified: csw/mgar/pkg/munin/trunk/files/if.in.patch
===================================================================
--- csw/mgar/pkg/munin/trunk/files/if.in.patch	2011-01-13 20:25:40 UTC (rev 12529)
+++ csw/mgar/pkg/munin/trunk/files/if.in.patch	2011-01-13 20:42:03 UTC (rev 12530)
@@ -1,75 +1,53 @@
-From 4394dc4c0af55d1ed7a57413572f79ec40bdf2cd Mon Sep 17 00:00:00 2001
+From 961fedeafe1bbeb3e54d3077799b929c43ce0ef0 Mon Sep 17 00:00:00 2001
 From: Juergen Arndt <ja at opencsw.org>
-Date: Sun, 26 Sep 2010 18:30:48 +0200
-Subject: [PATCH] added support for Solaris 10 and earlier
+Date: Thu, 13 Jan 2011 21:08:25 +0100
+Subject: [PATCH] Fix for Solaris 10
 
 ---
- plugins/node.d.sunos/if_.in |   57 +++++++++++++++++++++++++++----------------
- 1 files changed, 36 insertions(+), 21 deletions(-)
+ plugins/node.d.sunos/if_.in |   20 +++++++-------------
+ 1 files changed, 7 insertions(+), 13 deletions(-)
 
 diff --git a/plugins/node.d.sunos/if_.in b/plugins/node.d.sunos/if_.in
-index d72a539..273b597 100755
+index d72a539..94c1316 100755
 --- a/plugins/node.d.sunos/if_.in
 +++ b/plugins/node.d.sunos/if_.in
-@@ -42,6 +42,7 @@ Unknown license
+@@ -56,7 +56,7 @@ fi
  
- . $MUNIN_LIBDIR/plugins/plugin.sh
- 
-+SOLVERSION=`uname -r | awk -F. '{print $2}`
- INTERFACE=${0##*/if_}
- 
- if [ "$1" = "autoconf" ]; then
-@@ -56,7 +57,11 @@ fi
- 
  if [ "$1" = "suggest" ]; then
  	if [ -x /usr/bin/kstat ]; then
 -		kstat -m link -p -s '/^rbytes$/' | awk -F: '{ print $3 }'
-+		if [ $SOLVERSION -le 10 ]; then
-+			kstat -p -s '/^rbytes64$/' | awk -F: '{ print $3 }'
-+		elif [ $SOLVERSION -gt 10 ]; then
-+			kstat -m link -p -s '/^rbytes64$/' | awk -F: '{ print $3 }'
-+		fi
++		kstat -p -m '/^(?!unix)/' -n '/^(?!mac$)/' -s rbytes64 | awk -F: '{ print $3 }'
  		exit 0
  	else
  		exit 1
-@@ -65,30 +70,40 @@ fi
+@@ -64,31 +64,25 @@ if [ "$1" = "suggest" ]; then
+ fi
  
  if [ "$1" = "config" ]; then
- 
--	echo "graph_order rbytes obytes" 
-+	echo "graph_order rbytes64 obytes64" 
+-
+ 	echo "graph_order rbytes obytes" 
  	echo "graph_title $INTERFACE traffic"
  	echo 'graph_args --base 1000'
  	echo 'graph_vlabel bits per ${graph_period} in (-) / out (+)'
  	echo 'graph_category network'
--	echo 'rbytes.label received'
+ 	echo 'rbytes.label received'
 -        echo 'rbytes.type COUNTER'
 -        echo 'rbytes.max 2000000000'
 -        echo 'rbytes.graph no'
 -        echo 'rbytes.cdef rbytes,8,*'
--	print_warning rbytes
--	print_critical rbytes
++	echo 'rbytes.type COUNTER'
++	echo 'rbytes.graph no'
++	echo 'rbytes.cdef rbytes,8,*'
+ 	print_warning rbytes
+ 	print_critical rbytes
 -        echo 'obytes.label bps'
--	echo 'obytes.type COUNTER'
--	echo 'obytes.negative rbytes'
--	echo 'obytes.cdef obytes,8,*'
++	echo 'obytes.label bps'
+ 	echo 'obytes.type COUNTER'
+ 	echo 'obytes.negative rbytes'
+ 	echo 'obytes.cdef obytes,8,*'
 -        echo 'obytes.max 2000000000'
--	print_warning obytes
--	print_critical obytes
-+	echo 'rbytes64.label received'
-+        echo 'rbytes64.type COUNTER'
-+        echo 'rbytes64.max 2000000000'
-+        echo 'rbytes64.graph no'
-+        echo 'rbytes64.cdef rbytes64,8,*'
-+	print_warning rbytes64
-+	print_critical rbytes64
-+        echo 'obytes64.label bps'
-+	echo 'obytes64.type COUNTER'
-+	echo 'obytes64.negative rbytes64'
-+	echo 'obytes64.cdef obytes64,8,*'
-+        echo 'obytes64.max 2000000000'
-+	print_warning obytes64
-+	print_critical obytes64
+ 	print_warning obytes
+ 	print_critical obytes
  	exit 0
  fi;
  
@@ -78,21 +56,8 @@
 -	split($4, four, "\t")
 -	print four[1] ".value", four[2]
 -}'
-+if [ $SOLVERSION -le 10 ]       # Solaris 10 and earlier
-+then
-+        kstat -p -n $INTERFACE -s '/^[ro]bytes64$/' | awk -F: '
-+        {
-+                split($4, four, "\t")
-+                print four[1] ".value", four[2]
-+        }'
-+elif [ $SOLVERSION -gt 10 ]     # Solaris 11 or OpenSolaris / OpenIndiana or later
-+then
-+        kstat -p -n $INTERFACE -m link -s '/^[ro]bytes64$/' | awk -F: '
-+        {
-+                split($4, four, "\t")
-+                print four[1] ".value", four[2]
-+        }'
-+fi
++kstat -p -m '/^(?!unix)/' -n $INTERFACE -s '*bytes64' | sed \
++	's/.*\(.bytes\)64./\1.value /'
 -- 
-1.7.2.2
+1.7.3.2
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list