Ticket #886 (new defect)

Opened 5 months ago

if_err_ does not produce any output on Solaris 10 and earlier

Reported by: ja Assigned to: nobody
Priority: normal Milestone: Munin 1.4.6
Component: plugins Version: 1.4.4
Severity: normal Keywords: if_err_ kstat Solaris
Cc:

Description

Hi,

the plugin if_err_ does not produce any output on Solaris 10 or earlier. Reason is the option "-m link" for the kstat command. The module "link" exists only in OpenSolaris? but not in Solaris (see Ticket #820).

I attached a patch, which should work on both Solaris and OpenSolaris?:

--- munin-1.4.4.orig/plugins/node.d.sunos/if_err_.in    2010-02-26 13:32:44.000000000 +0100
+++ munin-1.4.4/plugins/node.d.sunos/if_err_.in 2010-03-13 18:08:35.844764023 +0100
@@ -42,6 +42,7 @@

 . $MUNIN_LIBDIR/plugins/plugin.sh

+SOLVERSION=`uname -r | awk -F. '{print $2}`
 INTERFACE=${0##*/if_err_}

 if [ "$1" = "autoconf" ]; then
@@ -56,7 +57,11 @@

 if [ "$1" = "suggest" ]; then
        if [ -x /usr/bin/kstat ]; then
-               kstat -m link -p -s '/^ierrors$/' | awk -F: '{ print $3 }'
+               if [ $SOLVERSION -le 10 ]; then
+                       kstat -p -s '/^ierrors$/' | awk -F: '{ print $3 }'
+               elif [ $SOLVERSION -eq 11 ]; then
+                       kstat -m link -p -s '/^ierrors$/' | awk -F: '{ print $3 }'
+               fi
                exit 0
        else
                exit 1
@@ -88,8 +93,18 @@
        exit 0
 fi;

-kstat -p -n $INTERFACE -m link -s '/^([io]errors|collisions)$/' | awk -F: '
-{
-       split($4, four, "\t")
-       print four[1] ".value", four[2]
-}'
+if [ $SOLVERSION -le 10 ]       # Solaris 10 and earlier
+then
+       kstat -p -n $INTERFACE -s '/^([io]errors|collisions)$/' | awk -F: '
+       {
+               split($4, four, "\t")
+               print four[1] ".value", four[2]
+       }'
+elif [ $SOLVERSION -eq 11 ]     # OpenSolaris
+then
+       kstat -p -n $INTERFACE -m link -s '/^([io]errors|collisions)$/' | awk -F: '
+       {
+               split($4, four, "\t")
+               print four[1] ".value", four[2]
+       }'
+fi

Please verify it.

Thanks, Juergen

Attachments

if_err_.in.diff (1.4 kB) - added by ja on 13/03/10 18:29:34.
Patch for if_err_.in for Solaris

Change History

13/03/10 18:29:34 changed by ja

  • attachment if_err_.in.diff added.

Patch for if_err_.in for Solaris