Source: xymon
Version: 4.3.0~beta2.dfsg-9.1
Tags: patch upstream
Severity: annoying

Dear Christoph and myself,

In hobbitserver.cfg/xymonserver.cfg you can easily set any additional
ntpdate parameter you want with $NTPDATE -- except "-p".

Because in bbtest-net.c/xymonnet.c it always gets overriden with "-p 2":

  sprintf(cmd, "%s -u -q -p 2 %s 2>&1", cmdpath, ip_to_test(t->host));
                         ^^^^

Unfortunately that parameter is crucial for any Hobbit/Xymon server
which runs that check on more than 150 machines, because it makes the
test to take always at least 2 seconds (at least since Debian 7 Wheezy):

$ time ntpdate -t 0.2 -p 1 -u -q -p 2 localhost
server ::1, stratum 2, offset -0.000016, delay 0.02571
server 127.0.0.1, stratum 2, offset -0.000005, delay 0.02567
30 Jan 19:41:49 ntpdate[7275]: adjust time server 127.0.0.1 offset -0.000005 sec
ntpdate -t 0.2 -p 1 -u -q -p 2 localhost  0.00s user 0.00s system 0% cpu 2.304 
total
$ time ntpdate -t 0.2 -p 1 -u -q localhost
server ::1, stratum 2, offset -0.000036, delay 0.02574
server 127.0.0.1, stratum 2, offset -0.000035, delay 0.02573
30 Jan 19:41:55 ntpdate[7350]: adjust time server 127.0.0.1 offset -0.000035 sec
ntpdate -t 0.2 -p 1 -u -q localhost  0.00s user 0.00s system 0% cpu 0.303 total
$

My current non-patchy workaround is to use the following Perl script
instead of ntpdate:

---8<---
#!/usr/bin/perl

use strict;
use warnings;
use 5.010;

for (my $i = 0; $i <= $#ARGV; $i++) {
    if ($ARGV[$i] eq '-p') {
        $ARGV[$i+1] = 1;
    }
}
say join(' ', @ARGV);
exec('/usr/sbin/ntpdate', @ARGV);
--->8---

This can be easily done by any administrator affected by this until the
following patch is included.

Besides not only making the "-p" parameter configurable again, the patch
below also changes the default from "-p 2" to "-p 1", too, to get back
the same behaviour as with Squeeze (where "-p 2" just worked fine).

---8<---
Description: Workaround changed "ntpdate -p 2" behaviour in Wheezy
 In Squeeze, "ntpdate -p 2 host" exits nearly immediately if the host
 is reachable and longer if not. On Wheezy, this command always takes
 at least two seconds, and hence slows down bbtest-net runs immensely.
 "ntpdate -p 1 host" works in Wheezy as fast as in Squeeze, though.
 .
 This patch changes the default for -p from 2 to 1 and changes its
 location from being a hardcoded value in bbtest-net.c to a
 configurable value in hobbitserver.cfg
Author: Axel Beckert <a...@debian.org>

Index: xymon-4.3.0~beta2.dfsg/bbnet/bbtest-net.c
===================================================================
--- xymon-4.3.0~beta2.dfsg.orig/bbnet/bbtest-net.c      2013-06-19 
19:53:24.654988966 +0200
+++ xymon-4.3.0~beta2.dfsg/bbnet/bbtest-net.c   2013-06-19 19:54:39.434287849 
+0200
@@ -1004,7 +1004,7 @@
        strcpy(cmdpath, (p ? p : "ntpdate"));
        for (t=service->items; (t); t = t->next) {
                if (!t->host->dnserror) {
-                       sprintf(cmd, "%s -u -q -p 2 %s 2>&1", cmdpath, 
ip_to_test(t->host));
+                       sprintf(cmd, "%s -u -q %s 2>&1", cmdpath, 
ip_to_test(t->host));
                        t->open = (run_command(cmd, "no server suitable for 
synchronization", t->banner, 1, extcmdtimeout) == 0);
                }
        }
Index: xymon-4.3.0~beta2.dfsg/hobbitd/etcfiles/hobbitserver.cfg.DIST
===================================================================
--- xymon-4.3.0~beta2.dfsg.orig/hobbitd/etcfiles/hobbitserver.cfg.DIST  
2013-06-19 19:53:24.614989341 +0200
+++ xymon-4.3.0~beta2.dfsg/hobbitd/etcfiles/hobbitserver.cfg.DIST       
2013-06-19 19:55:41.081709854 +0200
@@ -106,7 +106,7 @@
 IPTEST_2_CLEAR_ON_FAILED_CONN="TRUE"           # If TRUE, then failing network 
tests go CLEAR if conn-test fails.
 NONETPAGE=""                                   # Network tests that go YELLOW 
upon failure
 FPING="@FPING@"                                        # Path and options for 
the ping program.
-NTPDATE="ntpdate"                              # Path to the 'ntpdate' program
+NTPDATE="ntpdate -p 1"                         # Path to the 'ntpdate' program
 TRACEROUTE="traceroute"                         # How to do traceroute on 
failing ping tests. Requires "trace" in bb-hosts.
 BBROUTERTEXT="router"                          # What to call a failing 
intermediate network device.
 NETFAILTEXT="not OK"                           # Text indicating a network 
test failed
--->8---

(The patch is against the Wheezy package as it is in use here since June
2013: http://debian.phys.ethz.ch/pub/debian-local/pool/main/x/xymon/.
Sorry to mention it only that late, but I actually forgot that wrote it
and initially wondered about performance issues with xymon under
Jessie. When I found out again what the issue was, I remembered that I
once wrote a patch for that.)

-- System Information:
Debian Release: 8.0
  APT prefers testing-updates
  APT policy: (500, 'testing-updates'), (500, 'testing-proposed-updates'), 
(500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to