Bug 196739

Summary: sysutils/munin-node: Several plugins broken out of the box
Product: Ports & Packages Reporter: Daniel O'Connor <darius>
Component: Individual Port(s)Assignee: Mathieu Arnold <mat>
Status: Closed FIXED    
Severity: Affects Only Me CC: takefu
Priority: --- Flags: bugzilla: maintainer-feedback? (mat)
Version: Latest   
Hardware: Any   
OS: Any   

Description Daniel O'Connor 2015-01-14 23:39:32 UTC
smart_ now wants smartpath to find smartctl (an alternative would be to modify the plugin to look in the right place by default). Also, the sample config runs it in group operator but this is not sufficient without modifying the permissions for all disk devices and xpt0. I changed it to run it as root.

ipmi_sensor_ does not use an explicit path for ipmitool which causes problems because (apparently) /usr/local/bin isn’t in the default munin path. Modifying the plugin to use /usr/local/bin/ipmitool makes it work. It also seems to invert the limits for fans which cause problems so I reverted that change.
--- /usr/local/share/munin/plugins/ipmi_sensor_.orig	2015-01-06 12:12:14.723448042 +1030
+++ /usr/local/share/munin/plugins/ipmi_sensor_	2015-01-06 13:16:58.003180510 +1030
@@ -124,7 +124,7 @@

def get_sensor_names():
    try:
-        p = Popen(["ipmitool","-I","open","sensor"], shell=False, stdout=PIPE)
+        p = Popen(["/usr/local/bin/ipmitool","-I","open","sensor"], shell=False, stdout=PIPE)
    except OSError:
        return
    data = p.stdout.readlines()
@@ -152,12 +152,12 @@
    if curtime-mtime>CACHEAGE:
	if not SENSORS:
            try:
-            	p = Popen(["ipmitool","-I","open","sensor"], shell=False, stdout=PIPE)
+            	p = Popen(["/usr/local/bin/ipmitool","-I","open","sensor"], shell=False, stdout=PIPE)
            except OSError:
                return
	else:
            try:
-                p = Popen(["ipmitool","-I","open","sensor", "get", "--"] + SENSORS, shell=False, stdout=PIPE)
+                p = Popen(["/usr/local/bin/ipmitool","-I","open","sensor", "get"] + SENSORS, shell=False, stdout=PIPE)
            except OSError:
                return
        data = p.stdout.read()
@@ -254,12 +254,8 @@
            warn_u = values['Upper Non-Critical'].replace("na","")

	#TODO add 'fans'
-	if 'rpm'==unit:
-		warn = "%s:%s" % (warn_u,warn_l)
-		crit = "%s:%s" % (crit_u,crit_l)
-	else:
-		warn = "%s:%s" % (warn_l,warn_u)
-		crit = "%s:%s" % (crit_l,crit_u)
+	warn = "%s:%s" % (warn_l,warn_u)
+	crit = "%s:%s" % (crit_l,crit_u)

        if warn!=":":
            print "%s.warning %s" % (nname, warn)

The sample config file nut has a trailing “ for env.upsconf which causes it to fail.

Also, sendmail_mailtraffic doesn’t work unless you have 'group wheel’ so it can read /var/log/sendmail.st
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2015-01-14 23:39:32 UTC
Auto-assigned to maintainer mat@FreeBSD.org
Comment 2 takefu 2015-01-15 00:26:28 UTC
No it's individual settings?

etc/munin/plugin-conf.d/plugins.conf
[ipmi_*]
group operator
env.PATH /usr/local/bin
Comment 3 Daniel O'Connor 2015-01-15 14:03:38 UTC
(In reply to takefu from comment #2)

If the script is fixed to set its path or use the full path to ipmitool, or more generally: munin runs plugins with $PREFIX/[s]bin in the path then the 'suggest' functionality will work.

IMO it's just a work around to have the user have to modify the configuration in this way when the script can be adjusted to "Just Work (tm)" and make things easier.
Comment 4 commit-hook freebsd_committer freebsd_triage 2015-01-19 17:48:27 UTC
A commit references this bug:

Author: mat
Date: Mon Jan 19 17:47:49 UTC 2015
New revision: 377445
URL: https://svnweb.freebsd.org/changeset/ports/377445

Log:
  Fix the iostat plugin to report the correct unit. [1]
  Fix common plugins PATH problems by adding LOCALBASE/{bin,sbin} to the default
  PATH.  Fix a " that should not have been there.  Fix a few permissions
  problems. [2]

  PR:		196504 [1]
  Submitted by:	Vlad "Blackflow" K.
  PR:		196739 [2]
  Submitted by:	darius dons net au
  Sponsored by:	Absolight

Changes:
  head/sysutils/munin-common/files/patch-plugins_node.d.freebsd_iostat.in
  head/sysutils/munin-node/Makefile
  head/sysutils/munin-node/files/plugins.conf.in