Sponsored Content
Full Discussion: Script to detect time drift
Operating Systems HP-UX Script to detect time drift Post 303018932 by Green_Star on Tuesday 19th of June 2018 10:07:30 AM
Old 06-19-2018
Hi there, sorry to bother you again.

When I had this command "ntpq -c rl" run on the server, this the the output I get.

Code:
associd=0 status=0615 leap_none, sync_ntp, 1 event, clock_sync,
version="ntpd 4.2.6 Revision 6.0 Tue April 14 14:21:22 UTC 2015",
processor=, system="HP-UX/", leap=00, stratum=3, precision=-20,
rootdelay=14.482, rootdisp=44.199, refid=10.101.162.196,
reftime=ded28e5d.90b912dc  Mon, Jun 18 2018 16:02:37.565,
clock=ded2918b.a1b70695  Mon, Jun 18 2018 16:16:11.631, peer=23187,
tc=10, mintc=3, offset=0.182, frequency=20.824, sys_jitter=0.211,
clk_jitter=0.122, clk_wander=0.000

Do we still need to check for "Phase" in the script?
Code:
s/.*phase=-\{0,1\}\([0-9]*\).*/\1/p
t


Last edited by Don Cragun; 06-19-2018 at 12:41 PM.. Reason: Change COLOR tags to CODE tags, add missing CODE tags.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to detect my script is already running

I have a script which must not be run more than once at any given time. THis script will be scheduled to run every 20 mins as a cron job. In my script can i have logic to say if this script is already running from the previous cron, then exit. How do i go about doing that. If you describe the... (11 Replies)
Discussion started by: rmulchandani
11 Replies

2. Shell Programming and Scripting

AWK script to detect webpages from file

Hi guys I'm very new to unix and I have to create an awk script that detects webpage addresses from a file/webpage and outputs how many times each webpage was detected.e.g. if my file was: (Note: The symbol " was added to stop them being created into links) "www.google.com"... (1 Reply)
Discussion started by: ROFL
1 Replies

3. Shell Programming and Scripting

AWK script to detect webpages from file

Hi guys I'm very new to unix and I have to create an awk script that detects webpage addresses from a file/webpage and outputs how many times each webpage was detected.e.g. if my file was: www.google.com www.facebook.com www.google.com the output should be: www.google.com x2... (2 Replies)
Discussion started by: ROFL
2 Replies

4. Shell Programming and Scripting

Detect if script starts from queue

Dear community, what I'm try to do is deny users to run a script without parameters from command bash, but the same script should run without parameters only from crontab. Example runs by crontab:*/5 * * * * /tmp/script.sh Here the normal execution starts every 5 minutes Example #1 runs by... (16 Replies)
Discussion started by: Lord Spectre
16 Replies

5. Shell Programming and Scripting

How to detect Hanged process in shell script?

I have to check daily 20 processes each day. The names are like Network1 Network2 Network3 ....... Network20. There is built in utility for doing this. Following is the command to check a single network process. check_process_status 1 If we want to check the status of Network2 then the... (6 Replies)
Discussion started by: Nakul_sh
6 Replies

6. Shell Programming and Scripting

Help with detect with regex and move script

Hi all, I am needing some help with a script that will search for a video file by known extensions and then do a pattern search (I'm guessing via regex) and then based on a match of one type of another move the file to an assigned directory. I would like to do this with either a shell script... (7 Replies)
Discussion started by: Simplify
7 Replies

7. UNIX for Advanced & Expert Users

A script to detect system type

Hi forum, So I am trying to determine the OS type with the following script: #!/usr/bin/sh OStype1=`uname -s` Sunos1=SunOs if then echo "This system is Linux" exit 0 elif then echo "This system is SunOs" exit 0 elif (1 Reply)
Discussion started by: dampio
1 Replies

8. UNIX for Beginners Questions & Answers

Script to detect time drift on server

Hello there, I am not an expert in networking related stuff but I got a requirement to create UNIX script to query our Company's internal time source via NTP for time drift detect and report it when > +/- 50ms. I have been googling a lot but thought to post it in this forum to get a... (1 Reply)
Discussion started by: Green_Star
1 Replies

9. Shell Programming and Scripting

How to detect url in use in a script?

Hello, I have a small script and it runs from web application in below format: pipe:///path_to_myscript.sh url1 url2 url3 myscript.sh: #!/bin/bash count=0 while do count=$((count+1)) exec 3>&1 ((ffmpeg -i $1 ...... -f mpegts pipe:1 2>/dev/null 1>&3 ) 2>&1 | \ while read LINE; do echo... (9 Replies)
Discussion started by: baris35
9 Replies
ntp_decode(5)							File Formats Manual						     ntp_decode(5)

NAME
ntp_decode - ntpd Event Messages and Status Words INTRODUCTION
This page lists the status words, event messages and error codes used for ntpd reporting and monitoring. Status words are used to display the current status of the running program. There is one system status word and a peer status word for each association. There is a clock status word for each association that supports a reference clock. There is a flash code for each association which shows errors found in the last packet received (pkt) and during protocol processing (peer). These are commonly viewed using the ntpq program. Significant changes in program state are reported as events. There is one set of system events and a set of peer events for each associa- tion. In addition, there is a set of clock events for each association that supports a reference clock. Events are normally reported to the protostats monitoring file and optionally to the system log. In addition, if the trap facility is configured, events can be reported to a remote program that can page an administrator. This page also includes a description of the error messages produced by the Autokey protocol. These messages are normally sent to the cryp- tostats monitoring file. In the following tables the Code Field is the status or event code assigned and the Message Field a short string used for display and event reporting. The Description field contains a longer explanation of the status or event. Some messages include additional information useful for error diagnosis and performance assessment. SYSTEM STATUS WORD
The system status word consists of four fields LI (0-1), Source (2-7), Count (8-11) and Code (12-15). It is reported in the first line of the rv display produced by the ntpq program. +-------------------------------+-------------------------------------+-------------------------------------+------------------------------+ | Leap | Source | Count | Code | +-------------------------------+-------------------------------------+-------------------------------------+------------------------------+ The Leap Field displays the system leap indicator bits coded as follows: +---------------------+--------------------------------+-------------------------------------------------------------------+---------------+ | Code | Message | Description | | +---------------------+--------------------------------+-------------------------------------------------------------------+---------------+ | 0 | leap_none | normal synchronized state | | +---------------------+--------------------------------+-------------------------------------------------------------------+---------------+ | 1 | leap_add_sec | insert second after 23:59:59 of the current day | | +---------------------+--------------------------------+-------------------------------------------------------------------+---------------+ | 2 | leap_del_sec | delete second 23:59:59 of the current day | | +---------------------+--------------------------------+-------------------------------------------------------------------+---------------+ | 3 | leap_alarm | never synchronized | | +---------------------+--------------------------------+-------------------------------------------------------------------+---------------+ The Source Field displays the current synchronization source coded as follows:. +---------------------+-----------------------------------+----------------------------------------------------------------+---------------+ | Code | Message | Description | | +---------------------+-----------------------------------+----------------------------------------------------------------+---------------+ | 0 | sync_unspec | not yet synchronized | | +---------------------+-----------------------------------+----------------------------------------------------------------+---------------+ | 1 | sync_pps | pulse-per-second signal (Cs, Ru, GPS, etc.) | | +---------------------+-----------------------------------+----------------------------------------------------------------+---------------+ | 2 | sync_lf_radio | VLF/LF radio (WWVB, DCF77, etc.) | | +---------------------+-----------------------------------+----------------------------------------------------------------+---------------+ | 3 | sync_hf_radio | MF/HF radio (WWV, etc.) | | +---------------------+-----------------------------------+----------------------------------------------------------------+---------------+ | 4 | sync_uhf_radio | VHF/UHF radio/satellite (GPS, Galileo, etc.) | | +---------------------+-----------------------------------+----------------------------------------------------------------+---------------+ | 5 | sync_local | local timecode (IRIG, LOCAL driver, etc.) | | +---------------------+-----------------------------------+----------------------------------------------------------------+---------------+ | 6 | sync_ntp | NTP | | +---------------------+-----------------------------------+----------------------------------------------------------------+---------------+ | 7 | sync_other | other (IEEE 1588, openntp, crony, etc.) | | +---------------------+-----------------------------------+----------------------------------------------------------------+---------------+ | 8 | sync_wristwatch | eyeball and wristwatch | | +---------------------+-----------------------------------+----------------------------------------------------------------+---------------+ | 9 | sync_telephone | telephone modem (ACTS, PTB, etc.) | | +---------------------+-----------------------------------+----------------------------------------------------------------+---------------+ The Count Field displays the number of events since the last time the code changed. Upon reaching 15, subsequent events with the same code are ignored. The Event Field displays the most recent event message coded as follows: +---------------------+------------------------------------------+---------------------------------------------------------+---------------+ | Code | Message | Description | | +---------------------+------------------------------------------+---------------------------------------------------------+---------------+ | 00 | unspecified | unspecified | | +---------------------+------------------------------------------+---------------------------------------------------------+---------------+ | 01 | freq_not_set | frequency file not available | | +---------------------+------------------------------------------+---------------------------------------------------------+---------------+ | 02 | freq_set | frequency set from frequency file | | +---------------------+------------------------------------------+---------------------------------------------------------+---------------+ | 03 | spike_detect | spike detected | | +---------------------+------------------------------------------+---------------------------------------------------------+---------------+ | 04 | freq_mode | initial frequency training mode | | +---------------------+------------------------------------------+---------------------------------------------------------+---------------+ | 05 | clock_sync | clock synchronized | | +---------------------+------------------------------------------+---------------------------------------------------------+---------------+ | 06 | restart | program restart | | +---------------------+------------------------------------------+---------------------------------------------------------+---------------+ | 07 | panic_stop | clock error more than 600 s | | +---------------------+------------------------------------------+---------------------------------------------------------+---------------+ | 08 | no_system_peer | no system peer | | +---------------------+------------------------------------------+---------------------------------------------------------+---------------+ | 09 | leap_armed | leap second armed from file or Autokey | | +---------------------+------------------------------------------+---------------------------------------------------------+---------------+ | 0a | leap_disarmed | leap second disarmed | | +---------------------+------------------------------------------+---------------------------------------------------------+---------------+ | 0b | leap_event | leap event | | +---------------------+------------------------------------------+---------------------------------------------------------+---------------+ | 0c | clock_step | clock stepped | | +---------------------+------------------------------------------+---------------------------------------------------------+---------------+ | 0d | kern | kernel information message | | +---------------------+------------------------------------------+---------------------------------------------------------+---------------+ | 0e | TAI... | leapsecond values update from file | | +---------------------+------------------------------------------+---------------------------------------------------------+---------------+ | 0f | stale leapsecond values | new NIST leapseconds file needed | | +---------------------+------------------------------------------+---------------------------------------------------------+---------------+ | 10 | clockhop | spurious clock hop suppressed | | +---------------------+------------------------------------------+---------------------------------------------------------+---------------+ PEER STATUS WORD
The peer status word consists of four fields: Status (0-4), Select (5-7), Count (8-11) and Code (12-15). It is reported in the first line of the rv associd display produced by the ntpq program. +--------------------------------+-------------------------------------+------------------------------------+------------------------------+ | Status | Select | Count | Code | +--------------------------------+-------------------------------------+------------------------------------+------------------------------+ The Status Field displays the peer status code bits in hexadecimal; each bit is an independent flag. (Note this field is 5 bits wide, and combines with the the 3-bit-wide Select Field to create the first full byte of the peer status word.) The meaning of each bit in the Status Field is listed in the following table: +----------------------------+-----------------------------------+--------------------------------------------------+----------------------+ | Code | Message | Description | | +----------------------------+-----------------------------------+--------------------------------------------------+----------------------+ | 08 | bcst | broadcast association | | +----------------------------+-----------------------------------+--------------------------------------------------+----------------------+ | 10 | reach | host reachable | | +----------------------------+-----------------------------------+--------------------------------------------------+----------------------+ | 20 | authenb | authentication enabled | | +----------------------------+-----------------------------------+--------------------------------------------------+----------------------+ | 40 | auth | authentication ok | | +----------------------------+-----------------------------------+--------------------------------------------------+----------------------+ | 80 | config | persistent association | | +----------------------------+-----------------------------------+--------------------------------------------------+----------------------+ The Select Field displays the current selection status. (The T Field in the following table gives the corresponding tally codes used in the ntpq peers display.) The values are coded as follows: +----------------------+----------------------------------+----------------------+---------------------------------------------------------+ | Code | Message | T | Description | +----------------------+----------------------------------+----------------------+---------------------------------------------------------+ | 0 | sel_reject | | discarded as not valid (TEST10-TEST13) | +----------------------+----------------------------------+----------------------+---------------------------------------------------------+ | 1 | sel_falsetick | x | discarded by intersection algorithm | +----------------------+----------------------------------+----------------------+---------------------------------------------------------+ | 2 | sel_excess | . | discarded by table overflow (not used) | +----------------------+----------------------------------+----------------------+---------------------------------------------------------+ | 3 | sel_outlyer | - | discarded by the cluster algorithm | +----------------------+----------------------------------+----------------------+---------------------------------------------------------+ | 4 | sel_candidate | + | included by the combine algorithm | +----------------------+----------------------------------+----------------------+---------------------------------------------------------+ | 5 | sel_backup | # | backup (more than tos maxclock sources) | +----------------------+----------------------------------+----------------------+---------------------------------------------------------+ | 6 | sel_sys.peer | * | system peer | +----------------------+----------------------------------+----------------------+---------------------------------------------------------+ | 7 | sel_pps.peer | o | PPS peer (when the prefer peer is valid) | +----------------------+----------------------------------+----------------------+---------------------------------------------------------+ The Count Field displays the number of events since the last time the code changed. Upon reaching 15, subsequent events with the same code are ignored. The Event Field displays the most recent event message coded as follows: +-----------------------+--------------------------------------+---------------------------------------------------------+-----------------+ | Code | Message | Description | | +-----------------------+--------------------------------------+---------------------------------------------------------+-----------------+ | 01 | mobilize | association mobilized | | +-----------------------+--------------------------------------+---------------------------------------------------------+-----------------+ | 02 | demobilize | association demobilized | | +-----------------------+--------------------------------------+---------------------------------------------------------+-----------------+ | 03 | unreachable | server unreachable | | +-----------------------+--------------------------------------+---------------------------------------------------------+-----------------+ | 04 | reachable | server reachable | | +-----------------------+--------------------------------------+---------------------------------------------------------+-----------------+ | 05 | restart | association restart | | +-----------------------+--------------------------------------+---------------------------------------------------------+-----------------+ | 06 | no_reply | no server found (ntpdate mode) | | +-----------------------+--------------------------------------+---------------------------------------------------------+-----------------+ | 07 | rate_exceeded | rate exceeded (kiss code RATE) | | +-----------------------+--------------------------------------+---------------------------------------------------------+-----------------+ | 08 | access_denied | access denied (kiss code DENY) | | +-----------------------+--------------------------------------+---------------------------------------------------------+-----------------+ | 09 | leap_armed | leap armed from server LI code | | +-----------------------+--------------------------------------+---------------------------------------------------------+-----------------+ | 0a | sys_peer | become system peer | | +-----------------------+--------------------------------------+---------------------------------------------------------+-----------------+ | 0b | clock_event | see clock status word | | +-----------------------+--------------------------------------+---------------------------------------------------------+-----------------+ | 0c | bad_auth | authentication failure | | +-----------------------+--------------------------------------+---------------------------------------------------------+-----------------+ | 0d | popcorn | popcorn spike suppressor | | +-----------------------+--------------------------------------+---------------------------------------------------------+-----------------+ | 0e | interleave_mode | entering interleave mode | | +-----------------------+--------------------------------------+---------------------------------------------------------+-----------------+ | 0f | interleave_error | interleave error (recovered) | | +-----------------------+--------------------------------------+---------------------------------------------------------+-----------------+ | 10 | TAI... | leapsecond values update from server | | +-----------------------+--------------------------------------+---------------------------------------------------------+-----------------+ CLOCK STATUS WORD
The clock status word consists of four fields: Unused (0-7), Count (8-11) and Code (12-15). It is reported in the first line of the clock- var associd display produced by the ntpq program. +----------------------------------+--------------------------------------+-------------------------------------+--------------------------+ | Unused | Count | Code | | +----------------------------------+--------------------------------------+-------------------------------------+--------------------------+ The Count Field displays the number of events since the last lockvar command, while the Event Field displays the most recent event message coded as follows: +-------------------------+----------------------------------------+--------------------------------------------------+--------------------+ | Code | Message | Description | | +-------------------------+----------------------------------------+--------------------------------------------------+--------------------+ | 00 | clk_unspe | nominal | | +-------------------------+----------------------------------------+--------------------------------------------------+--------------------+ | 01 | clk_noreply | no reply to poll | | +-------------------------+----------------------------------------+--------------------------------------------------+--------------------+ | 02 | clk_badformat | bad timecode format | | +-------------------------+----------------------------------------+--------------------------------------------------+--------------------+ | 03 | clk_fault | hardware or software fault | | +-------------------------+----------------------------------------+--------------------------------------------------+--------------------+ | 04 | clk_bad_signal | signal loss | | +-------------------------+----------------------------------------+--------------------------------------------------+--------------------+ | 05 | clk_bad_date | bad date format | | +-------------------------+----------------------------------------+--------------------------------------------------+--------------------+ | 06 | clk_bad_time | bad time format | | +-------------------------+----------------------------------------+--------------------------------------------------+--------------------+ When the clock driver sets the code to a new value, a clock_alarm (11) peer event is reported. FLASH STATUS WORD
The flash status word is displayed by the ntpq program rv command. It consists of a number of bits coded in hexadecimal as follows: +------------------------+------------------------------+------------------------------------+---------------------------------------------+ | Code | Tag | Message | Description | +------------------------+------------------------------+------------------------------------+---------------------------------------------+ | 0001 | TEST1 | pkt_dup | duplicate packet | +------------------------+------------------------------+------------------------------------+---------------------------------------------+ | 0002 | TEST2 | pkt_bogus | bogus packet | +------------------------+------------------------------+------------------------------------+---------------------------------------------+ | 0004 | TEST3 | pkt_unsync | protocol unsynchronized | +------------------------+------------------------------+------------------------------------+---------------------------------------------+ | 0008 | TEST4 | pkt_denied | access denied | +------------------------+------------------------------+------------------------------------+---------------------------------------------+ | 0010 | TEST5 | pkt_auth | bad authentication | +------------------------+------------------------------+------------------------------------+---------------------------------------------+ | 0020 | TEST6 | pkt_stratum | bad synch or stratum | +------------------------+------------------------------+------------------------------------+---------------------------------------------+ | 0040 | TEST7 | pkt_header | bad header | +------------------------+------------------------------+------------------------------------+---------------------------------------------+ | 0080 | TEST8 | pkt_autokey | bad autokey | +------------------------+------------------------------+------------------------------------+---------------------------------------------+ | 0100 | TEST9 | pkt_crypto | bad crypto | +------------------------+------------------------------+------------------------------------+---------------------------------------------+ | 0200 | TEST10 | peer_stratum | peer bad synch or stratum | +------------------------+------------------------------+------------------------------------+---------------------------------------------+ | 0400 | TEST11 | peer_dist | peer distance exceeded | +------------------------+------------------------------+------------------------------------+---------------------------------------------+ | 0800 | TEST12 | peer_loop | peer synchronization loop | +------------------------+------------------------------+------------------------------------+---------------------------------------------+ | 1000 | TEST13 | peer_unreach | peer unreachable | +------------------------+------------------------------+------------------------------------+---------------------------------------------+ KISS CODES
Kiss codes are used in kiss-o'-death (koD) packets, billboard displays and log messages. They consist of a string of four zero-padded ASCII charactes. In practice they are informal and tend to change with time and implementation. Some of these codes can appear in the reference identifier field in ntpq billboards. Following is the current list: +-------------------------------+----------------------------------------------------+----------------------------+------------------------+ | Code | Description | | | +-------------------------------+----------------------------------------------------+----------------------------+------------------------+ | ACST | manycast server | | | +-------------------------------+----------------------------------------------------+----------------------------+------------------------+ | AUTH | authentication error | | | +-------------------------------+----------------------------------------------------+----------------------------+------------------------+ | AUTO | Autokey sequence error | | | +-------------------------------+----------------------------------------------------+----------------------------+------------------------+ | BCST | broadcast server | | | +-------------------------------+----------------------------------------------------+----------------------------+------------------------+ | CRYPT | Autokey protocol error | | | +-------------------------------+----------------------------------------------------+----------------------------+------------------------+ | DENY | access denied by server | | | +-------------------------------+----------------------------------------------------+----------------------------+------------------------+ | INIT | association initialized | | | +-------------------------------+----------------------------------------------------+----------------------------+------------------------+ | MCST | multicast server | | | +-------------------------------+----------------------------------------------------+----------------------------+------------------------+ | RATE | rate exceeded | | | +-------------------------------+----------------------------------------------------+----------------------------+------------------------+ | TIME | association timeout | | | +-------------------------------+----------------------------------------------------+----------------------------+------------------------+ | STEP | step time change | | | +-------------------------------+----------------------------------------------------+----------------------------+------------------------+ CRYPTO MESSAGES
These messages are sent to the cryptostats file when an error is detected in the Autokey protocol. +----------------------+--------------------------------------+-----------------------------------------------------------+----------------+ | Code | Message | Description | | +----------------------+--------------------------------------+-----------------------------------------------------------+----------------+ | 01 | bad_format | bad extension field format or length | | +----------------------+--------------------------------------+-----------------------------------------------------------+----------------+ | 02 | bad_timestamp | bad timestamp | | +----------------------+--------------------------------------+-----------------------------------------------------------+----------------+ | 03 | bad_filestamp | bad filestamp | | +----------------------+--------------------------------------+-----------------------------------------------------------+----------------+ | 04 | bad_public_key | bad or missing public key | | +----------------------+--------------------------------------+-----------------------------------------------------------+----------------+ | 05 | bad_digest | unsupported digest type | | +----------------------+--------------------------------------+-----------------------------------------------------------+----------------+ | 06 | bad_identity | unsupported identity type | | +----------------------+--------------------------------------+-----------------------------------------------------------+----------------+ | 07 | bad_siglength | bad signature length | | +----------------------+--------------------------------------+-----------------------------------------------------------+----------------+ | 08 | bad signature | extension field signature not verified | | +----------------------+--------------------------------------+-----------------------------------------------------------+----------------+ | 09 | cert_not_verified | certificate signature not verified | | +----------------------+--------------------------------------+-----------------------------------------------------------+----------------+ | 0a | cert_expired | host certificate expired | | +----------------------+--------------------------------------+-----------------------------------------------------------+----------------+ | 0b | bad_cookie | bad or missing cookie | | +----------------------+--------------------------------------+-----------------------------------------------------------+----------------+ | 0c | bad_leapseconds | bad or missing leapseconds values | | +----------------------+--------------------------------------+-----------------------------------------------------------+----------------+ | 0d | cert_missing | bad or missing certificate | | +----------------------+--------------------------------------+-----------------------------------------------------------+----------------+ | 0e | bad_group_key | bad or missing group key | | +----------------------+--------------------------------------+-----------------------------------------------------------+----------------+ | 0f | proto_error | protocol error | | +----------------------+--------------------------------------+-----------------------------------------------------------+----------------+ SEE ALSO
ntpq(8), ntp_mon(5) The official HTML documentation. This file was automatically generated from HTML source. ntp_decode(5)
All times are GMT -4. The time now is 08:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy