From 6a3a30725cdd850995af897d8e0a62189ff1a3b1 Mon Sep 17 00:00:00 2001 From: Kristian Lyngstol Date: Mon, 7 Nov 2016 16:11:54 +0100 Subject: Graph ALL the things Tweaks background colors on graphs. Adds a funky "ticker" to the navbar that may or may not break small screens. Graphs average latency and total bandwidth for all equipment. --- web/js/nms.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'web/js/nms.js') diff --git a/web/js/nms.js b/web/js/nms.js index 36ff97f..bdea1b6 100644 --- a/web/js/nms.js +++ b/web/js/nms.js @@ -395,6 +395,8 @@ function initNMS() { nmsData.registerSource("snmp","/api/read/snmp"); nmsData.registerSource("smanagement","/api/read/switches-management"); nmsData.registerSource("oplog", "/api/read/oplog"); + setInterval(nmsUpdateNavbarGraph, 10000); + nmsUpdateNavbarGraph(); nmsOplog.init(); } @@ -611,6 +613,19 @@ function restoreSettings() setMenu(); } +/* + * Updates a simple legend-free graph, located on the navbar. + * + * The idea is to give a general "feeling" of the event. And that it's + * neat. + * + * The timer-thing to bust a cache divides by 10 seconds, so updating more + * than once every 10 seconds is pointless. + */ +function nmsUpdateNavbarGraph() { + var img = document.getElementById("navbar-graph"); + img.src = "/render/?target=movingAverage(averageSeries(ping.*.ipv4),%225min%22)&target=secondYAxis(averageSeries(perSecond(snmp.*.*.{ifHCInOctets,ifHCOutOctets})))&bgcolor=%23ffffff00&width=600&height=20&format=svg&from=-60min&until=now&graphOnly=true&somerandomthing=" + Math.floor(new Date().getTime() / 10000); +} /* * Test if the entire path specified in the arrary "ar" exists under the * specified root. -- cgit v1.2.3