@cryptotaxi247 / netdata-1 / commits / 88e698b87

allow fireqos names to have in/out either as prefix or suffix #275

Costa Tsaousis (ktsaou) committed Apr 19, 2016 at 20:19 UTC 88e698b87305e2a32957f09ef99d6bded03e89a4
2 files changed +15 -3
.gitignore
+1
@@ -60,6 +60,7 @@ web/version.txt
60
61 system/netdata-openrc
62 system/netdata-init-d
63 +system/netdata.logrotate
64
65 netdata-installer.log
66 netdata-uninstaller.sh
web/index.html
+14 -3
@@ -1357,11 +1357,22 @@ function enrichChartData(chart) {
1357 case 'tc':
1358 chart.menu = tmp;
1359
1360 - // find the interface name from the name
1361 - if(typeof options.submenu_names[chart.family] === 'undefined' || options.submenu_names[chart.family] === chart.family)
1362 - options.submenu_names[chart.family] = chart.name.split('.')[1].split('_')[0];
1360 + // find a name for this device from fireqos info
1361 + // we strip '_(in|out)' or '(in|out)_'
1362 + if(typeof options.submenu_names[chart.family] === 'undefined' || options.submenu_names[chart.family] === chart.family) {
1363 + var n = chart.name.split('.')[1];
1364 + if(n.endsWith('_in'))
1365 + options.submenu_names[chart.family] = n.slice(0, n.lastIndexOf('_in'));
1366 + else if(n.endsWith('_out'))
1367 + options.submenu_names[chart.family] = n.slice(0, n.lastIndexOf('_out'));
1368 + else if(n.startsWith('in_'))
1369 + options.submenu_names[chart.family] = n.slice(3, n.length);
1370 + else if(n.startsWith('out_'))
1371 + options.submenu_names[chart.family] = n.slice(4, n.length);
1372 + }
1373
1374 // increase the priority of IFB devices
1375 + // to have inbound appear before outbound
1376 if(chart.id.match(/.*-ifb$/))
1377 chart.priority--;
1378