summaryrefslogtreecommitdiffstats
path: root/plugins-scripts/t
diff options
context:
space:
mode:
Diffstat (limited to 'plugins-scripts/t')
0 files changed, 0 insertions, 0 deletions
diff --git a/plugins-scripts/check_ntp.pl b/plugins-scripts/check_ntp.pl
index d0167cd..d6584ae 100755
--- a/plugins-scripts/check_ntp.pl
+++ b/plugins-scripts/check_ntp.pl
@@ -289,7 +289,7 @@ if ($have_ntpq) {
289 if (/^(\*|\+|\#|o])/) { 289 if (/^(\*|\+|\#|o])/) {
290 ++$candidate; 290 ++$candidate;
291 push (@candidates, $_); 291 push (@candidates, $_);
292 print "Candiate count= $candidate\n" if ($verbose); 292 print "Candidate count= $candidate\n" if ($verbose);
293 } 293 }
294 294
295 # match sys.peer or pps.peer 295 # match sys.peer or pps.peer
@@ -302,11 +302,14 @@ if ($have_ntpq) {
302 print "Jitter_crit = $11 :$jcrit\n" if ($verbose); 302 print "Jitter_crit = $11 :$jcrit\n" if ($verbose);
303 $jitter_error = $ERRORS{'CRITICAL'}; 303 $jitter_error = $ERRORS{'CRITICAL'};
304 } elsif ($jitter > $jwarn ) { 304 } elsif ($jitter > $jwarn ) {
305 print "Jitter_warn = $11 :$jwarn \n" if ($verbose); 305 print "Jitter_warn = $11 :$jwarn\n" if ($verbose);
306 $jitter_error = $ERRORS{'WARNING'}; 306 $jitter_error = $ERRORS{'WARNING'};
307 } else { 307 } else {
308 $jitter_error = $ERRORS{'OK'}; 308 $jitter_error = $ERRORS{'OK'};
309 } 309 }
310 } else {
311 print "No match!\n" if $verbose;
312 $jitter = '(not parsed)';
310 } 313 }
311 314
312 } 315 }
@@ -343,53 +346,53 @@ if ($have_ntpq) {
343if ($ntpdate_error != $ERRORS{'OK'}) { 346if ($ntpdate_error != $ERRORS{'OK'}) {
344 $state = $ntpdate_error; 347 $state = $ntpdate_error;
345 if ($ntpdate_error == $ERRORS{'WARNING'} ) { 348 if ($ntpdate_error == $ERRORS{'WARNING'} ) {
346 $answer = $msg . "\n"; 349 $answer = $msg;
347 } 350 }
348 else { 351 else {
349 $answer = $msg . "Server for ntp probably down\n"; 352 $answer = $msg . "Server for ntp probably down";
350 } 353 }
351 354
352 if (defined($offset) && abs($offset) > $ocrit) { 355 if (defined($offset) && abs($offset) > $ocrit) {
353 $state = $ERRORS{'CRITICAL'}; 356 $state = $ERRORS{'CRITICAL'};
354 $answer = "Server Error and offset $offset sec > +/- $ocrit sec\n"; 357 $answer = "Server Error and offset $offset sec > +/- $ocrit sec";
355 } elsif (defined($offset) && abs($offset) > $owarn) { 358 } elsif (defined($offset) && abs($offset) > $owarn) {
356 $answer = "Server error and offset $offset sec > +/- $owarn sec\n"; 359 $answer = "Server error and offset $offset sec > +/- $owarn sec";
357 } elsif (defined($jitter) && abs($jitter) > $jcrit) { 360 } elsif (defined($jitter) && abs($jitter) > $jcrit) {
358 $answer = "Server error and jitter $jitter msec > +/- $jcrit msec\n"; 361 $answer = "Server error and jitter $jitter msec > +/- $jcrit msec";
359 } elsif (defined($jitter) && abs($jitter) > $jwarn) { 362 } elsif (defined($jitter) && abs($jitter) > $jwarn) {
360 $answer = "Server error and jitter $jitter msec > +/- $jwarn msec\n"; 363 $answer = "Server error and jitter $jitter msec > +/- $jwarn msec";
361 } 364 }
362 365
363} elsif ($have_ntpq && $jitter_error != $ERRORS{'OK'}) { 366} elsif ($have_ntpq && $jitter_error != $ERRORS{'OK'}) {
364 $state = $jitter_error; 367 $state = $jitter_error;
365 $answer = "Jitter $jitter too high\n"; 368 $answer = "Jitter $jitter too high";
366 if (defined($offset) && abs($offset) > $ocrit) { 369 if (defined($offset) && abs($offset) > $ocrit) {
367 $state = $ERRORS{'CRITICAL'}; 370 $state = $ERRORS{'CRITICAL'};
368 $answer = "Jitter error and offset $offset sec > +/- $ocrit sec\n"; 371 $answer = "Jitter error and offset $offset sec > +/- $ocrit sec";
369 } elsif (defined($offset) && abs($offset) > $owarn) { 372 } elsif (defined($offset) && abs($offset) > $owarn) {
370 $answer = "Jitter error and offset $offset sec > +/- $owarn sec\n"; 373 $answer = "Jitter error and offset $offset sec > +/- $owarn sec";
371 } elsif (defined($jitter) && abs($jitter) > $jcrit) { 374 } elsif (defined($jitter) && abs($jitter) > $jcrit) {
372 $answer = "Jitter error and jitter $jitter msec > +/- $jcrit msec\n"; 375 $answer = "Jitter error and jitter $jitter msec > +/- $jcrit msec";
373 } elsif (defined($jitter) && abs($jitter) > $jwarn) { 376 } elsif (defined($jitter) && abs($jitter) > $jwarn) {
374 $answer = "Jitter error and jitter $jitter msec > +/- $jwarn msec\n"; 377 $answer = "Jitter error and jitter $jitter msec > +/- $jwarn msec";
375 } 378 }
376 379
377} elsif( !$have_ntpq ) { # no errors from ntpdate and no ntpq or ntpq timed out 380} elsif( !$have_ntpq ) { # no errors from ntpdate and no ntpq or ntpq timed out
378 if (abs($offset) > $ocrit) { 381 if (abs($offset) > $ocrit) {
379 $state = $ERRORS{'CRITICAL'}; 382 $state = $ERRORS{'CRITICAL'};
380 $answer = "Offset $offset sec > +/- $ocrit sec\n"; 383 $answer = "Offset $offset sec > +/- $ocrit sec";
381 } elsif (abs($offset) > $owarn) { 384 } elsif (abs($offset) > $owarn) {
382 $state = $ERRORS{'WARNING'}; 385 $state = $ERRORS{'WARNING'};
383 $answer = "Offset $offset sec > +/- $owarn sec\n"; 386 $answer = "Offset $offset sec > +/- $owarn sec";
384 } elsif (( abs($offset) > $owarn) && $def_jitter ) { 387 } elsif (( abs($offset) > $owarn) && $def_jitter ) {
385 $state = $ERRORS{'WARNING'}; 388 $state = $ERRORS{'WARNING'};
386 $answer = "Offset $offset sec > +/- $owarn sec, ntpq timed out\n"; 389 $answer = "Offset $offset sec > +/- $owarn sec, ntpq timed out";
387 } elsif ( $def_jitter ) { 390 } elsif ( $def_jitter ) {
388 $state = $ERRORS{'WARNING'}; 391 $state = $ERRORS{'WARNING'};
389 $answer = "Offset $offset secs, ntpq timed out\n"; 392 $answer = "Offset $offset secs, ntpq timed out";
390 } else{ 393 } else{
391 $state = $ERRORS{'OK'}; 394 $state = $ERRORS{'OK'};
392 $answer = "Offset $offset secs \n"; 395 $answer = "Offset $offset secs";
393 } 396 }
394 397
395 398
@@ -397,27 +400,28 @@ if ($ntpdate_error != $ERRORS{'OK'}) {
397} else { # no errors from ntpdate or ntpq 400} else { # no errors from ntpdate or ntpq
398 if (abs($offset) > $ocrit) { 401 if (abs($offset) > $ocrit) {
399 $state = $ERRORS{'CRITICAL'}; 402 $state = $ERRORS{'CRITICAL'};
400 $answer = "Offset $offset sec > +/- $ocrit sec, jitter $jitter msec\n"; 403 $answer = "Offset $offset sec > +/- $ocrit sec, jitter $jitter msec";
401 } elsif (abs($jitter) > $jcrit ) { 404 } elsif (abs($jitter) > $jcrit ) {
402 $state = $ERRORS{'CRITICAL'}; 405 $state = $ERRORS{'CRITICAL'};
403 $answer = "Jitter $jitter msec> +/- $jcrit msec, offset $offset sec \n"; 406 $answer = "Jitter $jitter msec> +/- $jcrit msec, offset $offset sec";
404 } elsif (abs($offset) > $owarn) { 407 } elsif (abs($offset) > $owarn) {
405 $state = $ERRORS{'WARNING'}; 408 $state = $ERRORS{'WARNING'};
406 $answer = "Offset $offset sec > +/- $owarn sec, jitter $jitter msec\n"; 409 $answer = "Offset $offset sec > +/- $owarn sec, jitter $jitter msec";
407 } elsif (abs($jitter) > $jwarn ) { 410 } elsif (abs($jitter) > $jwarn ) {
408 $state = $ERRORS{'WARNING'}; 411 $state = $ERRORS{'WARNING'};
409 $answer = "Jitter $jitter msec> +/- $jwarn msec, offset $offset sec \n"; 412 $answer = "Jitter $jitter msec> +/- $jwarn msec, offset $offset sec";
410 413
411 } else { 414 } else {
412 $state = $ERRORS{'OK'}; 415 $state = $ERRORS{'OK'};
413 $answer = "Offset $offset secs, jitter $jitter msec, peer is stratum $stratum\n"; 416 $answer = "Offset $offset secs, jitter $jitter msec, peer is stratum $stratum";
414 } 417 }
415 418
416} 419}
417 420
418foreach my $key (keys %ERRORS) { 421foreach my $key (keys %ERRORS) {
419 if ($state==$ERRORS{$key}) { 422 if ($state==$ERRORS{$key}) {
420 print ("NTP $key: $answer"); 423# print ("NTP $key: $answer");
424 print ("NTP $key: $answer|offset=$offset, jitter=" . $jitter/1000 . ",peer_stratum=$stratum\n");
421 last; 425 last;
422 } 426 }
423} 427}