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)
Created attachment 248228 [details, diff] better detection for first_ip
More history about this issue is at bug 311723 (closed). http://bugs.gentoo.org/show_bug.cgi?id=311723
Is there something preventing getting this fixed? Anything I can do to help (more testing, etc)?
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.
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.
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?
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.
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.
Fixed in 1.4.16-r1.