Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
Dannу
Contributor

Show NTP servers in FortiGate WebUI

Can auto-run when imported as Userscript.
Purely reads and shows monitoring data, not touching it.
If you use it, please write a comment or click the Kudo button.

 

Show status NTP server status in FortiGate's WebUI with just a click!

 

  1. Login to your FortiGate's WebUI and navigate to System > Settings
  2. Create a new bookmark in your web browser and copy the JavaScript code below into the URL field.
  3. Click the bookmark and enjoy viewing your NTP servers!

Result:

ntpstat.png

 
Copy & paste into a bookmark:
javascript:(async function(){const data=await fetch('/api/v2/monitor/system/ntp/status');const ntp=await data.json();const p=document.createElement('div');p.setAttribute("id","ntplist");let s="<p>NTP Status:<table style='padding:0;border-spacing:0;border-collapse:collapse'><tr><td style='border:1px solid #ddd;background:#ddd;padding:2px 5px 2px 5px'>NTP Server</td><td style='border:1px solid #ddd;background:#ddd;padding:2px 5px 2px 5px'>IP Address</td><td style='border:1px solid #ddd;background:#ddd;padding:2px 5px 2px 5px;text-align:center'>Version</td><td style='border:1px solid #ddd;background:#ddd;padding:2px 5px 2px 5px;text-align:center'>Reachable</td></tr>";for(const _ of ntp.results){s+="<tr><td style='border:1px solid #ddd;padding:2px 5px 2px 5px'>"+_.server+"</td><td style='border:1px solid #ddd;padding:2px 5px 2px 5px'>"+_.ip+"</td><td style='border:1px solid #ddd;padding:2px 5px 2px 5px;text-align:center'>"+_.version+"</td><td style='border:1px solid #ddd;padding:2px 5px 2px 5px;text-align:center'>"+_.reachable+"</td></tr>"}s=s.replace(/true/g,'<f-icon class="fa-accepted" title="Reachable" style="cursor:pointer"></f-icon>');s=s.replace(/false/g,'<f-icon class="fa-denied" title="Unreachable" style="cursor:pointer"></f-icon>');s=s.replace(/undefined/g,'-');p.innerHTML=s+"</table></p>";if(document.contains(document.getElementById("ntplist"))){document.getElementById("ntplist").remove();}document.getElementById("system-time-dlg").querySelector("section").getElementsByTagName('div')[4].after(p)})();
4 REPLIES 4
PRosenlind
New Contributor III

This should be available in the GUI, since the custom/manual buttons are available in. the gui but the tooltip just say "please do it in the cli"

Dannу

Thanks, I thought so, too. That's why I created the tool to show the actual NTP servers and their status. I'll publish more tools soon.

Roee-Golan
New Contributor II

Hi Danny,
All your developed tools are exceptional and have significantly improved our operations.
This tool It's efficient and user-friendly.

Keep being creative !

 

TPilot
New Contributor

Good Job! It's work's perfectly.

Announcements

Select Forum Responses to become Knowledge Articles!

Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.

Labels
Top Kudoed Authors