Skip to main content

NQE Query for F5 NTP Server details from config, Please help us to collect this data.

Hi Rohit,

Firstly, what version are you running?

 

Regardless of your version, the collection of NTP configuration will require a custom command. 

For later versions, it looks like the the command for listing the currently defined NTP servers is list /sys ntp servers

However, I prefer the output of ntpq -np which verifies the status of the NTP.

Could you please run both of these commands and show the outputs?

This will help us create the NQE for you.

 

Stewart


To look at the configured NTP servers, you could use the custom command list sys ntp

and an NQE query like this:

pattern = ```
sys ntp
servers {server1:string} {server2:string}
```;

getServers(device) =
foreach command in device.outputs.commands
where command.commandText == "list sys ntp"
let filtered_response = replace(command.response, "{", "")
let filtered_response = replace(filtered_response, "}", "")
let blocks = parseConfigBlocks(OS.F5, filtered_response)
foreach match in blockMatches(blocks, pattern)
select {server1: match.data.server1, server2: match.data.server2
};

foreach device in network.devices
where device.platform.os == OS.F5
select {
device: device.name,
os: device.platform.os,
server1: max(getServers(device)).server1,
server2: max(getServers(device)).server2

}

 


Reply