Querying NTP Peer Status

Querying NTP Peer Status
GET http://<IP_Address>/api/mo/sys/time.json?rsp-subtree=full&rsp-prop-include=config-only     
{
    "totalCount": "1",
    "imdata": [
        {
            "datetimeClkPol": {
                "attributes": {
                    "adminSt": "enabled",
                    "authSt": "disabled",
                    "descr": "",
                    "dn": "sys/time",
                    "logging": "disabled",
                    "loggingLevel": "critical",
                    "master": "disabled",
                    "masterStratum": "8",
                    "ownerKey": "",
                    "ownerTag": "",
                    "persistentOnReload": "true"
                },
                "children": [
                    {
                        "datetimeNtpProvider": {
                            "attributes": {
                                "descr": "",
                                "keyId": "0",
                                "maxPoll": "6",
                                "minPoll": "4",
                                "name": "4.3.2.1",
                                "persistentOnReload": "true",
                                "preferred": "no",
                                "provT": "peer",
                                "rn": "prov-4.3.2.1",
                                "vrf": ""
                            }
                        }
                    },
                    {
                        "datetimeNtpProvider": {
                            "attributes": {
                                "descr": "",
                                "keyId": "0",
                                "maxPoll": "6",
                                "minPoll": "4",
                                "name": "1.2.3.4",
                                "persistentOnReload": "true",
                                "preferred": "no",
                                "provT": "server",
                                "rn": "prov-1.2.3.4",
                                "vrf": ""
                            }
                        }
                    }
                ]
            }
        }
    ]
}
GET  http://<IP_Address>/restconf/data/Cisco-NX-OS-device:System/time-items/
    
<time-items>
    <adminSt>enabled</adminSt>
    <authSt>disabled</authSt>
    <clock>2018-06-20T09:48:03.764+00:00</clock>
    <clockRaw>1529488083764</clockRaw>
    <descr/>
    <flags/>
    <leap>0</leap>
    <logging>disabled</logging>
    <loggingLevel>critical</loggingLevel>
    <master>disabled</master>
    <masterStratum>8</masterStratum>
    <name>default</name>
    <ownerKey/>
    <ownerTag/>
    <peer>0</peer>
    <poll>0</poll>
    <precision>0</precision>
    <prov-items>
        <NtpProvider-list>
            <name>4.3.2.1</name>
            <maxPoll>6</maxPoll>
            <minPoll>4</minPoll>
            <preferred>false</preferred>
            <provT>peer</provT>
            <status-items>
                <delay>0.00000</delay>
                <delayRaw>0</delayRaw>
                <dispersion>261631</dispersion>
                <flags>configured</flags>
                <hostPoll>6</hostPoll>
                <mode>symmetricActive</mode>
                <peerPoll>6</peerPoll>
                <reach>0</reach>
                <stratum>16</stratum>
            </status-items>
        </NtpProvider-list>
        <NtpProvider-list>
            <name>1.2.3.4</name>
            <maxPoll>6</maxPoll>
            <minPoll>4</minPoll>
            <preferred>false</preferred>
            <provT>server</provT>
            <status-items>
                <delay>0.00000</delay>
                <delayRaw>0</delayRaw>
                <dispersion>261631</dispersion>
                <flags>configured</flags>
                <hostPoll>6</hostPoll>
                <mode>client</mode>
                <peerPoll>6</peerPoll>
                <reach>0</reach>
                <stratum>16</stratum>
            </status-items>
        </NtpProvider-list>
    </prov-items>
    <refId>0.0.0.0</refId>
    <refTime>1970-01-01T00:00:00.000+00:00</refTime>
    <refTimeRaw>0</refTimeRaw>
    <rootDelay>0</rootDelay>
    <rootDispersion>0</rootDispersion>
    <srvStatus>0</srvStatus>
    <stratum>0</stratum>
</time-items>

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show ntp peer-status
Total peers : 2
* - selected for sync, + -  peer mode(active),
- - peer mode(passive), = - polled in client mode
    remote                                 local
   st   poll   reach delay   vrf
--------------------------------------------------------------------------------
---------------------------------------
=1.2.3.4                                 0.0.0.0
 16   16       0   0.00000default
+4.3.2.1                                 0.0.0.0
 16   16       0   0.00000default


Note: The property information for this example was added in Release 9.3(3).


datetimeClkPol Properties

The following table contains information about the datetimeClkPol properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.

Property NameData TypeDescriptionValues
adminStdatetime:AdminState
(scalar:Enum8)
A property that indicates if the NTP protocol is enabled or disabled.SELECTION:
1 - enabled
2 - disabled
DEFAULT: enabled
authStdatetime:AdminState
(scalar:Enum8)
A property that indicates if the Datetime policy authentication is enabled or disabled.SELECTION:
1 - enabled
2 - disabled
DEFAULT: disabled
descrpol:Descr
Description of the specified attribute
dn
reference:BinRef
A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module.
loggingdatetime:AdminState
(scalar:Enum8)
NTP Logging StatusSELECTION:
1 - enabled
2 - disabled
DEFAULT: disabled
loggingLeveldatetime:LoggingLevel
(scalar:Enum8)
NTP Logging LevelSELECTION:
0 - emergency
1 - alert
2 - critical
3 - error
4 - warning
5 - notif
6 - inform
7 - debug
DEFAULT: critical
masterdatetime:AdminState
(scalar:Enum8)
NTP Master ConfigurationSELECTION:
1 - enabled
2 - disabled
DEFAULT: disabled
masterStratumdatetime:Stratum
(scalar:UByte)
NTP Master Stratum Level
RANGE: [1 , 15]
DEFAULT: 8
ownerKeynaming:Descr
(string:Basic)
The key for enabling clients to own their data for entity correlation.
MAX SIZE: 128
ownerTagnaming:Descr1024
(string:Basic)
A tag for enabling clients to add their own data. For example, to indicate who created this object.
MAX SIZE: 64
persistentOnReload
mo:Persistent
scalar:Enum8
NO COMMENTSSELECTION:
  • 0 - false
  • 1 - true
  • DEFAULT: true(1)

  • datetimeNtpProvider Properties

    The following table contains information about the datetimeNtpProvider properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.

    Property NameData TypeDescriptionValues
    descrpol:Descr
    Description of the specified attribute
    keyIddatetime:KeyId
    (scalar:Uint16)
    The NTP provider key ID. The range is from 1 to 65535.RANGE: [1, 65535]
    maxPolldatetime:Poll
    (scalar:UByte)
    The NTP maximum interval default in seconds.
    RANGE: [4 , 16]
    DEFAULT: 6
    minPolldatetime:Poll
    (scalar:UByte)
    The NTP minimum interval default in seconds.
    RANGE: [4 , 16]
    DEFAULT: 4
    namepol:ObjName
    (naming:Name256)
    Object name
    RANGE: [1 , 80]
    persistentOnReload
    mo:Persistent
    scalar:Enum8
    NO COMMENTSSELECTION:
  • 0 - false
  • 1 - true
  • DEFAULT: true(1)
  • preferredscalar:Bool
    A property that indicates if the NTP server is preferred. Only one preferred server is allowed.SELECTION: true or false
    provTdatetime:ProvT
    (scalar:Enum8)
    NTP Server Or PeerSELECTION:
    0 - peer
    1 - server
    2 - invalid
    DEFAULT: invalid
    rn
    reference:BinRN
    Identifies an object from its siblings within the context of its parent object. The distinguished name contains a sequence of relative names.
    vrfl3:VrfName
    (string:Basic)
    Identifies the VRF for the NTP providersA sequence of characters


    Related Documentation

    For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:

    http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

    See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload:

    https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/

    For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide:

    https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html