Logo - stats adjustment (hostname)

This commit is contained in:
Akkadius 2017-09-06 02:36:58 -05:00
parent e3e3e0dde9
commit 3082923936
7 changed files with 34 additions and 7 deletions

8
app.js
View File

@ -81,6 +81,8 @@ listening_to_log_file = 0;
options = {}; options = {};
options.interval = 1000; options.interval = 1000;
host_name = execSync("cat /etc/hostname").toString();
/** /**
* Ingest Current Lease File * Ingest Current Lease File
*/ */
@ -187,7 +189,7 @@ leases_per_minute_counter_timer = setInterval(function(){
*/ */
cpu_utilization_poll = setInterval(function(){ cpu_utilization_poll = setInterval(function(){
cpu_utilization = parseFloat(execSync("top -bn 1 | awk 'NR>7{s+=$9} END {print s/4}'")) cpu_utilization = parseFloat(execSync("top -bn 1 | awk 'NR>7{s+=$9} END {print s/4}'").toString())
}, (15 * 1000)); }, (15 * 1000));
/** /**
@ -207,13 +209,13 @@ function get_socket_clients_connected_count() {
} }
/** /**
* Websocker Server * Websocket Server
*/ */
const WebSocket = require('ws'); const WebSocket = require('ws');
const wss = new WebSocket.Server({ port: 8080 }); const wss = new WebSocket.Server({ port: 8080 });
options.interval = 100; options.interval = 300;
var tail_dhcp_log = new tail_module( var tail_dhcp_log = new tail_module(
glass_config.log_file, glass_config.log_file,
"\n", "\n",

View File

@ -11,7 +11,7 @@ module.exports = {
} }
else { else {
core = fs.readFileSync('./public/templates/index.html', 'utf8'); core = fs.readFileSync('./public/templates/index.html', 'utf8');
core = core.replace(/\[application_name\]/, 'Glass - isc dhcp server utility'); core = core.replace(/\[application_name\]/, 'Glass | ISC DHCP server utility');
core = core.replace(/\[body_content\]/, body_content); core = core.replace(/\[body_content\]/, body_content);
// core = core.replace(/\[(.*?)\]/, ""); // core = core.replace(/\[(.*?)\]/, "");
return core; return core;

View File

@ -107,3 +107,17 @@ function notification(text){
'</div>' '</div>'
}); });
} }
function change_favicon(img) {
var favicon = document.querySelector('link[rel="shortcut icon"]');
if (!favicon) {
favicon = document.createElement('link');
favicon.setAttribute('rel', 'shortcut icon');
var head = document.querySelector('head');
head.appendChild(favicon);
}
favicon.setAttribute('type', 'image/png');
favicon.setAttribute('href', img);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -4,7 +4,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<title>Glass - ISC DHCP Server Utility</title> <title>Glass | ISC DHCP Server Utility</title>
<!-- Favicon--> <!-- Favicon-->
<link rel="icon" href="../../favicon.ico" type="image/x-icon"> <link rel="icon" href="../../favicon.ico" type="image/x-icon">
@ -67,6 +67,13 @@
<section> <section>
<!-- Left Sidebar --> <!-- Left Sidebar -->
<aside id="leftsidebar" class="sidebar"> <aside id="leftsidebar" class="sidebar">
<div class="user-info" style="background: url('images/user-img-background.jpg') no-repeat no-repeat;height: 75px">
<div class="image">
<img src="images/glass_logo.png" width="48" height="48" alt="User">
</div>
</div>
<!-- Menu --> <!-- Menu -->
<div class="menu"> <div class="menu">
<ul class="list"> <ul class="list">
@ -140,7 +147,7 @@
<!-- Footer --> <!-- Footer -->
<div class="legal"> <div class="legal">
<div class="copyright"> <div class="copyright">
&copy; 2017 <a href="javascript:void(0);">Glass - Chris Miles</a><br> &copy; 2017 <a href="javascript:void(0);">Glass | Chris Miles</a><br>
&copy; 2016 - 2017 <a href="javascript:void(0);">AdminBSB - Material Design</a> &copy; 2016 - 2017 <a href="javascript:void(0);">AdminBSB - Material Design</a>
</div> </div>
<div class="version"> <div class="version">
@ -222,6 +229,7 @@
$('#cpu-utilization').html(data.cpu_utilization + "%"); $('#cpu-utilization').html(data.cpu_utilization + "%");
$('#leases-sec').html(data.leases_per_second.toLocaleString('en') + ' / ' + data.leases_per_minute.toLocaleString('en')); $('#leases-sec').html(data.leases_per_second.toLocaleString('en') + ' / ' + data.leases_per_minute.toLocaleString('en'));
$('#total-leases').html(data.leases_used.toLocaleString('en')); $('#total-leases').html(data.leases_used.toLocaleString('en'));
$('#server-name').html(data.host_name);
$('#shared-networks > tbody').html(data.shared_network_table); $('#shared-networks > tbody').html(data.shared_network_table);
$('#display-subnets > tbody').html(data.display_subnets_table); $('#display-subnets > tbody').html(data.display_subnets_table);
@ -251,6 +259,8 @@
}); });
} }
change_favicon("images/glass_logo.png");
get_stats_timer = setInterval(function () { get_stats_timer = setInterval(function () {
if (window_focus && $('#total-leases').length) { if (window_focus && $('#total-leases').length) {
get_stats(); get_stats();

View File

@ -99,6 +99,7 @@ router.get('/', function(req, res, next) {
"leases_per_second": current_leases_per_second, "leases_per_second": current_leases_per_second,
"leases_per_minute": leases_per_minute, "leases_per_minute": leases_per_minute,
"shared_network_table": shared_networks, "shared_network_table": shared_networks,
"host_name": host_name,
"display_subnets_table": display_subnets "display_subnets_table": display_subnets
}; };