[Nagiosplug-devel] [ nagiosplug-Bugs-1267741 ] 1.4.1: check_ntp logic incorrect with >1 peers
SourceForge.net
noreply at sourceforge.net
Tue Dec 20 15:31:07 CET 2005
Bugs item #1267741, was opened at 2005-08-24 08:42
Message generated for change (Comment added) made by lausser
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1267741&group_id=29880
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Parsing problem
Group: Release (specify)
Status: Open
Resolution: None
Priority: 5
Submitted By: ozburgess (ozburgess)
Assigned to: Nobody/Anonymous (nobody)
Summary: 1.4.1: check_ntp logic incorrect with >1 peers
Initial Comment:
After finding a matching entry and recording the
jitter, the loop parsing the ntpq output (below) should
exit. Otherwise, it will read the next line, that line
will not match the regex (since it is not the sys.peer
or pps.peer), and $jitter will always be set to '(not
parsed)' (which is what we see with every test).
# match sys.peer or pps.peer
if
(/^(\*|o)([-0-9.\s]+)\s+([-0-9A-Za-z_().]+)\s+([-0-9.]+)\s+([lumb-]+)\s+([-0-9hm.]+)\s+([-0-9
.mh]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/)
{
$syspeer = $2;
$stratum = $4;
$jitter = $11;
print "match $_ \n" if
$verbose;
if ($jitter > $jcrit) {
print
"Jitter_crit = $11 :$jcrit\n" if ($verbose);
$jitter_error =
$ERRORS{'CRITICAL'};
} elsif ($jitter >
$jwarn ) {
print
"Jitter_warn = $11 :$jwarn\n" if ($verbose);
$jitter_error =
$ERRORS{'WARNING'};
} else {
$jitter_error =
$ERRORS{'OK'};
}
########################
# I think we need a loop break here.
########################
} else {
print "No match!\n" if
$verbose;
$jitter = '(not parsed)';
}
----------------------------------------------------------------------
Comment By: gerhard lausser (lausser)
Date: 2005-12-21 00:30
Message:
Logged In: YES
user_id=613416
You're right. I should have beer reading more carefully.
Then what ozburgess proposed will be the way to go?
----------------------------------------------------------------------
Comment By: Bufalooo (zjuran)
Date: 2005-12-20 18:49
Message:
Logged In: YES
user_id=1405801
sorry pehaps I'm wrong but the goal is to select just one
row with selected synchronization peer. That means row
beginning with * or o only.
There is required to run ntpq with two "like" hosts to
obtain peer adress on the row first (you get Invalid
argument warning). ie:
ss2:~ # ntpq -p 10.10.0.11
remote refid st t when poll reach
delay offset jitter
============================================================
==================
*stratum.eunet.c .PPS. 1 - 178 1024 377
3.217 3.290 1.025
+nic.eunet.cz clock.tl.fukuok 2 - 220 1024 377
1.531 4.093 0.341
+217.169.176.254 217.169.176.253 3 - 234 1024 377
1.046 2.195 0.493
ss2:~ # ntpq -p 10.10.0.11 1
host remote refid st t when poll
reach delay offset jitter
============================================================
=============================
10.10.0.11 *stratum.eunet.c .PPS. 1 - 394 1024
377 3.217 3.290 1.025
10.10.0.11 +nic.eunet.cz clock.tl.fukuok 2 - 436 1024
377 1.531 4.093 0.341
10.10.0.11 +217.169.176.254 217.169.176.253 3 - 450 1024
377 1.046 2.195 0.493
ntpq: connect: Invalid argument
----------------------------------------------------------------------
Comment By: gerhard lausser (lausser)
Date: 2005-12-20 18:19
Message:
Logged In: YES
user_id=613416
1381801 does not solve the problem.
The expression
(/^(\*|o)([-0-9.\s]+)\s+([-0-9A-Za-z_().]+)........
needs to be extended to
(/^(\+|\*|o)([-0-9.\s]+)\s+([-0-9A-Za-z_().]+)........
so that output like
remote refid st t when poll reach
delay offset jitter
===========================================================
===================
*160.50.94.70 .PPS. 1 u 250 1024 377
0.958 -0.360 0.013
+160.50.7.12 160.50.94.70 2 u 303 1024 373
0.334 -0.129 0.111
+160.50.7.203 160.50.94.70 2 u 362 1024 376
0.137 -0.237 0.134
will be parsed correctly.
----------------------------------------------------------------------
Comment By: Bufalooo (zjuran)
Date: 2005-12-20 11:23
Message:
Logged In: YES
user_id=1405801
see reqid 1381801 perhaps it helps
----------------------------------------------------------------------
Comment By: Bufalooo (zjuran)
Date: 2005-12-20 11:20
Message:
Logged In: YES
user_id=1405801
see reqid 1381801 perhaps it helps
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1267741&group_id=29880
More information about the Devel
mailing list