
Note that the builtin URLs are disabled by default. To activate, "builtinurl enable" or use the builtinurl_enable API. See .../extras/http/sample.md for some Hugo-friendly .md w/ embedded Javascript that accesses the builtin URLs. Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I6d82d9292c41d6d2d90be73ba8a1a043fb20c986
2.2 KiB
2.2 KiB
title
title |
---|
Home |
VPP Status
Here's the version...
VPP version:
build date:
Show Interface
Enter the interface name, then click "Submit" to display interface stats:
Get Stats
{{< rawhtml >}}
<script> function getStats() { var url="http://192.168.10.1:1234/interface_stats.json?"; var iface=document.getElementById("ifacename").value; url=url.concat(iface); fetch(url, { method: 'POST', mode: 'no-cors', cache: 'no-cache', headers: { 'Content-Type': 'application/json', }, }) .then((response) => response.json()) .then(function(obj) { console.log(obj) var result=obj.interface_stats.name; result = result.concat(": rx-pkts: "); result = result.concat(obj.interface_stats.rx_packets); result = result.concat(" rx-bytes: "); result = result.concat(obj.interface_stats.rx_bytes); result = result.concat(": tx-pkts: "); result = result.concat(obj.interface_stats.tx_packets); result = result.concat(" tx-bytes: "); result = result.concat(obj.interface_stats.tx_bytes); result = result.concat(" drops: "); result = result.concat(obj.interface_stats.drops); result = result.concat(" ip4: "); result = result.concat(obj.interface_stats.ip4); result = result.concat(" ip6: "); result = result.concat(obj.interface_stats.ip6); document.getElementById("ifacestats").innerHTML=result; }) .catch(function(error) { console.log(error); })} // unconditionally populate vpp version info -> fetch('http://192.168.10.1:1234/version.json', { method: 'GET', mode: 'no-cors', cache: 'no-cache', headers: { 'Content-Type': 'application/json', }, }) .then((response) => response.json()) .then(function(obj) { document.getElementById("VPPbuilddate").innerHTML=obj.vpp_details.build_date; document.getElementById("VPPversion").innerHTML=obj.vpp_details.version; }) .catch(function(error) { console.log(error); }); </script>{{< /rawhtml >}}