aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/nms-info-box.js
diff options
context:
space:
mode:
authorKristian Lyngstol <kly@kly.no>2016-11-18 18:54:10 +0100
committerKristian Lyngstol <kly@kly.no>2016-11-18 18:54:10 +0100
commitc38af8933072bb2b9606cd6490e1a802ab4c4187 (patch)
treeadf4e5cb65ed1dc5852c7c29e77eb6b1e09e12e3 /web/js/nms-info-box.js
parent06591202ce5549a949343f0f5f8959771a1b5657 (diff)
Tweak various graphite/grafana integrations
s3 is currently disabled as it's bugged.
Diffstat (limited to 'web/js/nms-info-box.js')
-rw-r--r--web/js/nms-info-box.js7
1 files changed, 5 insertions, 2 deletions
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 = '<input type="text" class="form-control" value="' + template[v] + '" id="edit-' + this.sw + '-' + v + '" onchange=' + tmphandler + ' oninput=' + tmphandler + ' ' + (v == 'sysname' ? "readonly" : "") + '>';
if (v == "placement") {
v = "placement <a onclick='var _x = document.getElementById(\"edit-" + this.sw + "-placement\"); _x.value = \"\\\"reset\\\"\"; _x.oninput();' class='pull-right'>Reset</a>";
- 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 + ")";