1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Initial work on traffic graph.

This commit is contained in:
Ylian Saint-Hilaire 2021-05-05 17:08:50 -07:00
parent 56d0f2aafc
commit b349b83ef1
2 changed files with 49 additions and 2 deletions

View file

@ -1665,6 +1665,7 @@ function CreateMeshCentralServer(config, args) {
}
// Start collecting server stats every 5 minutes
obj.trafficStats = obj.webserver.getTrafficStats();
setInterval(function () {
obj.serverStatsCounter++;
var hours = 720; // Start with all events lasting 30 days.
@ -1676,6 +1677,10 @@ function CreateMeshCentralServer(config, args) {
var expire = new Date();
expire.setTime(expire.getTime() + (60 * 60 * 1000 * hours));
// Get traffic data
var trafficStats = obj.webserver.getTrafficDelta(obj.trafficStats);
obj.trafficStats = trafficStats.current;
var data = {
time: new Date(),
expire: expire,
@ -1686,7 +1691,8 @@ function CreateMeshCentralServer(config, args) {
cu: Object.keys(obj.webserver.wssessions).length,
us: Object.keys(obj.webserver.wssessions2).length,
rs: obj.webserver.relaySessionCount
}
},
traffic: trafficStats.delta
};
if (obj.mpsserver != null) {
data.conn.am = 0;