Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 338247 - net-analyzer/nagios-plugins: vserver.patch breaks ping detection
Summary: net-analyzer/nagios-plugins: vserver.patch breaks ping detection
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Netmon project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-20 23:26 UTC by David Sparks
Modified: 2012-08-18 15:27 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
better detection for first_ip (first_ip.patch,517 bytes, patch)
2010-09-20 23:28 UTC, David Sparks
Details | Diff
Change for first_ip to remove extra forking and work w/ newer ifconfig (nagios-plugins-vserver-1.4.15-first_ip.patch,903 bytes, patch)
2012-04-10 18:44 UTC, Doug Warner
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Sparks 2010-09-20 23:26:24 UTC
The patch nagios-plugins-1.4.15-vserver.patch is not compatible with some networking setups (OpenVZ is a know incompatible setup).  The problem is the command output that goes to first_ip, it doesn't always get a bare IP address.

I have run the command assigned to first_ip below, as you can see the result is "127.0.0.1  Mask:255.0.0.0" which is not a valid IP:

nagios # /sbin/ifconfig | egrep "inet addr:" | sed -n '1p' | sed 's/
Bcast.*$//' | sed 's/^\s*inet addr://' 
127.0.0.1  Mask:255.0.0.0

This patch appears to fix the problem, tested on both hardware and OpenVZ nodes:

--- nagios-plugins-1.4.15-vserver.patch.orig    2010-09-07 16:01:17.851713531 -0700
+++ nagios-plugins-1.4.15-vserver.patch 2010-09-07 16:22:58.799839052 -0700
@@ -4,7 +4,7 @@
  REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'`
  REV_TIMESTAMP=`date '+%Y%m%d%H%M%S'`
  
-+first_ip=`/sbin/ifconfig | egrep "inet addr:" | sed -n '1p' | sed 's/ Bcast.*$//' | sed 's/^\s*inet addr://'`
++first_ip=`/sbin/ifconfig | egrep -m1 "inet addr:" | sed 's/^.*inet addr:\([[0-9.]]*\).*/\1/'`
 +
  AC_SUBST(PKG_ARCH)
  AC_SUBST(REV_DATESTAMP)
Comment 1 David Sparks 2010-09-20 23:28:08 UTC
Created attachment 248228 [details, diff]
better detection for first_ip
Comment 2 David Sparks 2010-09-20 23:31:07 UTC
More history about this issue is at bug 311723 (closed).

http://bugs.gentoo.org/show_bug.cgi?id=311723
Comment 3 David Sparks 2011-10-14 23:14:19 UTC
Is there something preventing getting this fixed?  Anything I can do to help (more testing, etc)?
Comment 4 Michael Palimaka (kensington) gentoo-dev 2011-11-22 10:51:39 UTC
While I can't comment with regards to virtualised nodes, this unbreaks things for me on hardware.

I've also send the patched patch upstream.
Comment 5 Reuben Farrelly 2011-11-24 12:30:59 UTC
This patch fixes the problem for me on bare hardware now too, with one rather problematic exception.  The net-tools package which saw an upgrade in the last few days and the proposed patch no longer work together.

Note the change in output of ifconfig...

With =sys-apps/net-tools-1.60_p20110820045617 :

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:426233 errors:0 dropped:0 overruns:0 frame:0
          TX packets:426233 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:65196510 (62.1 MiB)  TX bytes:65196510 (62.1 MiB)

With =sys-apps/net-tools-1.60_p201111202031570500 :

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 16436  metric 1
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 426592  bytes 65252379 (62.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 426592  bytes 65252379 (62.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Note how "inet addr:" has become "inet".

I imagine with a tiny bit of tweaking the patch could be made to work on both outputs.

If this hasn't burnt anyone else yet it will certainly do so next time they rebuild nagios-plugins with the new version of net-tools installed.
Comment 6 Robin Bankhead 2012-02-22 12:46:51 UTC
Yep, just bit me on a new install. In portage terms, net-analyzer/nagios-plugins[nagios-ping] has compile-time dependency on sys-apps/net-tools[old-output] until this is fixed. It's not a run-time dependency, as I've just verified.

If there isn't one already, perhaps there should be a tracker for packages that haven't yet updated for the new ifconfig output, as I bet there are others... or is it just this and my own homebrew scripts?
Comment 7 Doug Warner 2012-04-10 18:44:55 UTC
Created attachment 308435 [details, diff]
Change for first_ip to remove extra forking and work w/ newer ifconfig

I was most of the way down this rabbit hole before I found this bug but wanted to attach this patch to the vserver.patch that just uses sed rather than forking a bunch of different calls (pendantic, I know) and should work with the new ifconfig output posted in comment #5.
Comment 8 Andrea Conti 2012-04-25 19:30:42 UTC
More breakage... as of sys-apps/net-tools-1.60_p20120127084908, ifconfig is installed in /bin instead of /sbin. 

This patch *really* needs an update.
Comment 9 Diego Elio Pettenò (RETIRED) gentoo-dev 2012-08-18 02:57:52 UTC
Fixed in 1.4.16-r1.