Bug 225439

Summary: net-mgmt/telegraf add custom PATH to rc script
Product: Ports & Packages Reporter: Chris Gordon <freebsd-bugs>
Component: Individual Port(s)Assignee: Palle Girgensohn <girgen>
Status: Closed FIXED    
Severity: Affects Some People Flags: bugzilla: maintainer-feedback? (girgen)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   

Description Chris Gordon 2018-01-24 22:57:54 UTC
telegraf supports gathering stats from fail2ban via fail2ban-client, which is installed in /usr/local/bin.  Since /usr/local/bin is not in the PATH set by rc.  A log entry such as below is generated in /var/log/telegraf.log

2018-01-24T22:53:00Z E! Error in plugin [inputs.fail2ban]: fail2ban-client not found: verify that fail2ban is installed and that fail2ban-client is in your PATH

I have fixed this by adding "PATH=${PATH}:/usr/local/bin" to /etc/rc.conf, but it seems more appropriate that this is in the telegraf rc script.
Comment 1 Palle Girgensohn freebsd_committer 2018-01-26 00:38:24 UTC
Hi,

That just half the story. From what I can see, the executable is not named fail2ban-client but actually fail2ban-python? But I guess that's beside the point. If the executable is installed, it should be found. Reasonable.

Just curious, though, which port supplies the fail2ban-client executable?

Palle
Comment 2 Chris Gordon 2018-01-26 01:10:09 UTC
I installed py27-fail2ban via pkg.  I use "latest" with my pkg config and currently have fail2ban version 0.10.1_1.

% pkg info -l py27-fail2ban
py27-fail2ban-0.10.1_1:
	/usr/local/bin/fail2ban-client
	/usr/local/bin/fail2ban-python
	/usr/local/bin/fail2ban-regex
	/usr/local/bin/fail2ban-server
	....

% find /usr/local/bin -name fail2ban\*
/usr/local/bin/fail2ban-regex
/usr/local/bin/fail2ban-server
/usr/local/bin/fail2ban-python
/usr/local/bin/fail2ban-client

I'm assuming the py36-fail2ban package does the same thing, but I've not checked it.

Thanks for maintaining this port.  On a side note, I put in a request for telegraf to also report wired memory (request 3628) which is in their head now and looks like its slated to go in the 1.6 release.
Comment 3 Chris Gordon 2018-01-28 02:14:07 UTC
I have also just run into the similar problem with the smart input (for smartmontool).  smartctl is in /usr/local/sbin which telegraf can't find since it's not part of rc's default path.
Comment 4 commit-hook freebsd_committer 2018-01-28 10:55:02 UTC
A commit references this bug:

Author: girgen
Date: Sun Jan 28 10:54:47 UTC 2018
New revision: 460163
URL: https://svnweb.freebsd.org/changeset/ports/460163

Log:
  Add /usr/local/[s]bin to the path when running telegraf

  Submitted by:	Chris Gordon
  PR:		225439

Changes:
  head/net-mgmt/telegraf/Makefile
  head/net-mgmt/telegraf/files/telegraf.in
Comment 5 Palle Girgensohn freebsd_committer 2018-01-28 10:55:47 UTC
Committed. Thanks!