diff options
author | Ole Mathias Aa. Heggem <olemathias.aa.heggem@gmail.com> | 2018-03-17 03:01:46 +0100 |
---|---|---|
committer | Ole Mathias Aa. Heggem <olemathias.aa.heggem@gmail.com> | 2018-03-17 03:01:46 +0100 |
commit | 13eb05560576dc18cfc7aeb17b31d9cd9adf3637 (patch) | |
tree | 69e0f615e6b8ddeb6a2c171d3a5157fb2b00f84e | |
parent | 9866a8734360d54294ad96ad5149a44d676f1b83 (diff) |
Added a litle better color scheme to charts and some words about securing influx
-rw-r--r-- | INSTALLING.rst | 32 | ||||
-rwxr-xr-x | include/config.pm | 4 | ||||
-rw-r--r-- | web/js/nms-draw-chart.js | 28 | ||||
-rw-r--r-- | web/js/nms.js | 1 |
4 files changed, 55 insertions, 10 deletions
diff --git a/INSTALLING.rst b/INSTALLING.rst index 61e9147..6c11304 100644 --- a/INSTALLING.rst +++ b/INSTALLING.rst @@ -39,6 +39,32 @@ As ``$YOURUSER``:: Then visit http://ip-your-boxen/ +Securing InfluxDB +................. + +Default InfluxDB is wide open, to limit this a little we need to configure a few users + +Create the users needed +1. Admin + CREATE USER gondulAdmin WITH PASSWORD 'FancyPassword' WITH ALL PRIVILEGES +2. Write only user + CREATE USER gondulWrite WITH PASSWORD 'funfunfunWrite' + GRANT WRITE ON gondul to gondulWrite +3. Read only user + CREATE USER gondulRead WITH PASSWORD 'funfunfun' + GRANT READ ON gondul to gondulRead + +Enable authentication +Enable authentication by setting the auth-enabled option to true in the [http] section of the configuration file for influxDB /etc/influxdb/influxdb.conf + +Set the influxdb write user and password in /includes/config.pm +Add the read user to varnish so all read requests are authenticated +Example varnish config: +`if (req.url ~ "^/query") { + set req.backend_hint = influx; + set req.http.Authorization = "Basic Z29uZHVsUmVhZDpmdW5mdW5mdW4="; +}` + Setting up your network... -------------------------- @@ -75,6 +101,8 @@ Each collector establishes a service on your system, found in gondul-services with regular systemd-commands. Apache is installed and set to listen to port 8080. +Varnish is installed and listens to port 80 +InfluxDB is installed and listens to port 8086 SNMP mibs are downloaded to ``/opt/gondul/data/mibs``. Both for Cisco and Juniper. If either vendor changes their FTP servers or whatever, this might @@ -108,8 +136,6 @@ broken: - DHCP log tailer (this is easy to fix, just need to copy ping/snmp basically) -- Varnish -- Bootstrapping the database - Distribution of configuration (config is being re-implemented) - Various test-cases (They are already there, just need to be fiddled with) -- Graphite / Grafana. Most likely, this will be an external "optional dependency" +- Grafana. Most likely, this will be an external "optional dependency" diff --git a/include/config.pm b/include/config.pm index 9a881ed..dcc784d 100755 --- a/include/config.pm +++ b/include/config.pm @@ -13,8 +13,8 @@ our $graphite_port = "2003"; # Influx our $influx_host = "http://localhost:8086"; -our $influx_username = "admin"; -our $influx_password = "admin"; +our $influx_username = "gondulWrite"; +our $influx_password = "funfunfunWrite"; our $influx_database = "gondul"; # Max SNMP polls to fire off at the same time. diff --git a/web/js/nms-draw-chart.js b/web/js/nms-draw-chart.js index be463bf..056a95f 100644 --- a/web/js/nms-draw-chart.js +++ b/web/js/nms-draw-chart.js @@ -1,5 +1,14 @@ "use strict"; +function setNightModeChart(night) { + if(night) { + Chart.defaults.global.defaultFontColor = "#fff"; + } + else { + Chart.defaults.global.defaultFontColor = "#222"; + } +} + function drawLatency(canvas, sw) { var q = encodeURIComponent('SELECT mean("latency") AS "mean_latency" FROM "ping" WHERE time > now() - 15m AND "switch"=\''+sw+'\' GROUP BY time(60s), "version" fill(null)'); var dataset = []; @@ -10,7 +19,7 @@ function drawLatency(canvas, sw) { serie['values'].forEach(function(element) { data.push({t: new Date(element[0]), y: element[1]}); }); - dataset.push({data: data, label:serie['tags']['version'] }); + dataset.push({data: data, backgroundColor:'rgba(66,139,202,255)', label:serie['tags']['version'] }); }); var ctx = document.getElementById(canvas).getContext('2d'); var myChart = new Chart(ctx, { @@ -110,14 +119,14 @@ function drawSumOfPorts(canvas, sw) { serie['values'].forEach(function(element) { data.push({t: new Date(element[0]), y: element[1] / size_divider }); }); - dataset.push({data: data, backgroundColor:'rgba(0,204,255,10)', label:'Traffic in (' + sizeToText(size)+')'}); + dataset.push({data: data, backgroundColor:'rgba(38,105,28,200)', label:'Traffic in (' + sizeToText(size)+')'}); // Bytes out data = []; serie['values'].forEach(function(element) { data.push({t: new Date(element[0]), y: -Math.abs(element[2] / size_divider) }); }); - dataset.push({data: data, backgroundColor:'rgba(204,255,102,10)', label:'Traffic out (' + sizeToText(size)+')'}); + dataset.push({data: data, backgroundColor:'rgba(64,64,122,225)', label:'Traffic out (' + sizeToText(size)+')'}); }); @@ -166,6 +175,9 @@ function drawSumOfPorts(canvas, sw) { elements: { point: { radius: 0 + }, + line: { + tension: 0 } } } @@ -239,14 +251,14 @@ function drawPort(canvas, sw, port) { serie['values'].forEach(function(element) { data.push({t: new Date(element[0]), y: element[1] / size_divider }); }); - dataset.push({data: data, backgroundColor:'rgba(0,204,255,10)', label:'Traffic in (' + sizeToText(size)+')'}); + dataset.push({data: data, backgroundColor:'rgba(38,105,28,200)', label:'Traffic in (' + sizeToText(size)+')'}); // Bytes out data = []; serie['values'].forEach(function(element) { data.push({t: new Date(element[0]), y: -Math.abs(element[2] / size_divider) }); }); - dataset.push({data: data, backgroundColor:'rgba(204,255,102,10)', label:'Traffic out (' + sizeToText(size)+')'}); + dataset.push({data: data, backgroundColor:'rgba(64,64,122,225)', label:'Traffic out (' + sizeToText(size)+')'}); // Draw the chart @@ -286,6 +298,12 @@ function drawPort(canvas, sw, port) { }, responsive: true, animation: false, + elements: { + line: { + tension: 0 + } + } + } }); }); diff --git a/web/js/nms.js b/web/js/nms.js index 8f98c75..edb18b2 100644 --- a/web/js/nms.js +++ b/web/js/nms.js @@ -324,6 +324,7 @@ function setNightMode(toggle) { document.body.classList.remove("nightmode"); } nmsMap.setNightMode(toggle); + setNightModeChart(toggle); } /* |