From c38af8933072bb2b9606cd6490e1a802ab4c4187 Mon Sep 17 00:00:00 2001 From: Kristian Lyngstol Date: Fri, 18 Nov 2016 18:54:10 +0100 Subject: Tweak various graphite/grafana integrations s3 is currently disabled as it's bugged. --- web/js/nms-info-box.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'web/js/nms-info-box.js') diff --git a/web/js/nms-info-box.js b/web/js/nms-info-box.js index 96cca89..2cc6fc4 100644 --- a/web/js/nms-info-box.js +++ b/web/js/nms-info-box.js @@ -682,7 +682,8 @@ var switchPortsPanel = function () { if (snmpJson[obj].ifHCInOctets != 0 || snmpJson[obj].ifHCOutOctets != 0) { var img = document.createElement("img"); - img.src = '/render/?target=cactiStyle(aliasByMetric(perSecond(snmp.' + this.sw + '.ports.' + obj + '.{ifHCOutOctets,ifHCInOctets})),"binary")&target=cactiStyle(aliasByMetric(secondYAxis(perSecond(snmp.' + this.sw + '.ports.' + obj + '.{ifInDiscards,ifInErrors,ifOutDiscards,ifOutErrors}))),"binary")' + nmsInfoBox._graphDefaults(); + var port_id = nmsInfoBox._graphNormalize(obj); + img.src = '/render/?target=cactiStyle(aliasByMetric(perSecond(snmp.' + this.sw + '.ports.' + port_id + '.{ifHCOutOctets,ifHCInOctets})),"binary")&target=cactiStyle(aliasByMetric(secondYAxis(perSecond(snmp.' + this.sw + '.ports.' + port_id + '.{ifInDiscards,ifInErrors,ifOutDiscards,ifOutErrors}))),"binary")' + nmsInfoBox._graphDefaults(); img.classList.add("graph"); panelBodyObj.appendChild(img); } @@ -902,7 +903,6 @@ var switchEditPanel = function () { var html = ''; if (v == "placement") { v = "placement Reset"; - console.log(v); } content.push([v, html]); } @@ -1139,6 +1139,9 @@ nmsInfoBox._graphZoom = function() { } nmsInfoBox._graphFrom = "-60min"; nmsInfoBox._graphUntil = "now"; +nmsInfoBox._graphNormalize = function(f) { + return f.replace(/[^a-z0-9]/gi,"_"); +} nmsInfoBox._graphDefaults = function(title) { if (title != undefined) { title = "From " + nmsInfoBox._graphFrom + " until " + nmsInfoBox._graphUntil + " (" + title + ")"; -- cgit v1.2.3