initial in new branch
This commit is contained in:
parent
af30d5ec57
commit
9d8aa63bed
21
snippets/ntp/test02.py
Normal file
21
snippets/ntp/test02.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import ntp.packet
|
||||||
|
import json
|
||||||
|
|
||||||
|
session = ntp.packet.ControlSession()
|
||||||
|
session.openhost('localhost')
|
||||||
|
|
||||||
|
peers = session.readstat()
|
||||||
|
|
||||||
|
k = []
|
||||||
|
|
||||||
|
l = session.readvar(0)
|
||||||
|
print(f"{l=}")
|
||||||
|
k.append(list(dict(l).keys()))
|
||||||
|
|
||||||
|
for p in peers:
|
||||||
|
l = session.readvar(p.associd)
|
||||||
|
print(f"{p.associd}: {dict(l)}")
|
||||||
|
k.append(list(dict(l).keys()))
|
||||||
|
|
||||||
|
print(json.dumps(k, indent=4))
|
||||||
|
|
@ -17,7 +17,8 @@ hottis MODULE-IDENTITY
|
|||||||
|
|
||||||
hottisNtpsec OBJECT IDENTIFIER ::= { hottis 123 }
|
hottisNtpsec OBJECT IDENTIFIER ::= { hottis 123 }
|
||||||
local OBJECT IDENTIFIER ::= { hottisNtpsec 1 }
|
local OBJECT IDENTIFIER ::= { hottisNtpsec 1 }
|
||||||
peers OBJECT IDENTIFIER ::= { hottisNtpsec 2 }
|
system OBJECT IDENTIFIER ::= { hottisNtpsec 2 }
|
||||||
|
peers OBJECT IDENTIFIER ::= { hottisNtpsec 3 }
|
||||||
|
|
||||||
|
|
||||||
ntpsecLocalLeap OBJECT-TYPE
|
ntpsecLocalLeap OBJECT-TYPE
|
||||||
|
@ -26,7 +26,7 @@ NUMBER_OF_PEERS_PREFIX = PEERS_PREFIX + '.1'
|
|||||||
# 2 is the prefix
|
# 2 is the prefix
|
||||||
# the first 1 is for the table in the mib
|
# the first 1 is for the table in the mib
|
||||||
# the second 1 is for the entries in the table in the mib
|
# the second 1 is for the entries in the table in the mib
|
||||||
TABLE_OF_PEERS_PREFIX = PEERS_PREFIX + '.2.1'
|
TABLE_OF_PEERS_PREFIX = PEERS_PREFIX + '.3.1'
|
||||||
|
|
||||||
|
|
||||||
def int_scale1k(x):
|
def int_scale1k(x):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user