Community discussions

MikroTik App
 
User avatar
rosman
newbie
Topic Author
Posts: 27
Joined: Wed Jun 27, 2018 12:30 am
Location: Southlake, Texas, USA - Dallas-Forth Worth Metro

SNTP Client GET returns nothing?

Tue Jul 17, 2018 1:27 am

Environment: RB2011UiAS-2HnD running 6.42.5 (stable)

I'm using the basic SNTP client from the system package. I'm getting good time, but I can't use other SNTP client information for scripting.

I can't seem to get the CLI to return anything to a GET request. As I understand it, I should be able to at least GET the fields from the print command. The commands after the print listing below were tab completed, so it looks like it should work, but - nothing...

What am I doing wrong?

/system ntp client> print
enabled: yes
primary-ntp: 0.0.0.0
secondary-ntp: 0.0.0.0
server-dns-names: 2.us.pool.ntp.org,3.us.pool.ntp.org,
0.us.pool.ntp.org,1.us.pool.ntp.org
mode: unicast
poll-interval: 15m
active-server: 96.245.170.99
last-update-from: 96.245.170.99
last-update-before: 12s750ms
last-adjustment: 3ms683us
last-bad-packet-from: 192.168.47.77
last-bad-packet-before: 8s980ms
last-bad-packet-reason: server-ip-mismatch
[admin@router] /system ntp client> get enabled
[admin@router] /system ntp client> get primary-ntp
[admin@router] /system ntp client> get mode
[admin@router] /system ntp client> get last-update-before
[admin@router] /system ntp client> get poll-interval
[admin@router] /system ntp client>
 
sid5632
Long time Member
Long time Member
Posts: 554
Joined: Fri Feb 17, 2017 6:05 pm

Re: SNTP Client GET returns nothing?  [SOLVED]

Tue Jul 17, 2018 3:02 am

What am I doing wrong?
:put [get enabled]
:put [get primary-ntp]
etc.
 
User avatar
rosman
newbie
Topic Author
Posts: 27
Joined: Wed Jun 27, 2018 12:30 am
Location: Southlake, Texas, USA - Dallas-Forth Worth Metro

Re: SNTP Client GET returns nothing?

Tue Jul 17, 2018 5:45 pm

That's got it.

What I don't understand is why it doesn't work as a GET from the command line.

Why does
[admin@router] /system ntp client>> :put [get last-update-before ]
00:06:05.690

work and

[admin@router] /system ntp client>> get last-update-before
[admin@router] /system ntp client>>

gets nothing back. The field names even tab-complete for the GET, but the response is blank. Likewise with FIND. I see in the scripting manual page that this is how it works in scripts. The Console (command) pages don't even hint at this.

Any suggestions as to where to read more about this?
 
sindy
Forum Guru
Forum Guru
Posts: 10206
Joined: Mon Dec 04, 2017 9:19 pm

Re: SNTP Client GET returns nothing?

Tue Jul 17, 2018 6:08 pm

It's doing exactly what it should. get provides a value, and you have to do something with that value, either store it to a variable or visualize it using put. Likewise, with find, the value is a list of references to items matching the find condition and you have to do something with it; on top of storing and visualization as above, you may use the list in some modification command (set, unset, remove, ...)
 
User avatar
rosman
newbie
Topic Author
Posts: 27
Joined: Wed Jun 27, 2018 12:30 am
Location: Southlake, Texas, USA - Dallas-Forth Worth Metro

Re: SNTP Client GET returns nothing?

Thu Jul 19, 2018 4:13 pm

Sindy,

Thanks, that helps. It's not some I get from the docs. May be there, but I didn't see it.

Again, thanks.

Rich

Who is online

Users browsing this forum: akakua, Bing [Bot], shahzaddj1 and 205 guests