seperate intel amt + amt cira in serverstats and monitoring #6549

Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
si458 2025-03-25 19:42:50 +00:00
parent 23bee3b987
commit 36b5af7ad4
6 changed files with 313 additions and 253 deletions

View File

@ -2084,14 +2084,18 @@ function CreateMeshCentralServer(config, args) {
ca: Object.keys(obj.webserver.wsagents).length,
cu: Object.keys(obj.webserver.wssessions).length,
us: Object.keys(obj.webserver.wssessions2).length,
rs: obj.webserver.relaySessionCount
rs: obj.webserver.relaySessionCount,
am: 0
},
traffic: trafficStats.delta
};
try { data.cpu = require('os').loadavg(); } catch (ex) { }
if (obj.mpsserver != null) {
data.conn.am = 0;
for (var i in obj.mpsserver.ciraConnections) { data.conn.am += obj.mpsserver.ciraConnections[i].length; }
data.conn.amc = 0;
for (var i in obj.mpsserver.ciraConnections) { data.conn.amc += obj.mpsserver.ciraConnections[i].length; }
}
for (var i in obj.connectivityByNode) {
if (obj.connectivityByNode[i].connectivity == 4) { data.conn.am++; }
}
if (obj.firstStats === true) { delete obj.firstStats; data.first = true; }
if (obj.multiServer != null) { data.s = obj.multiServer.serverid; }

View File

@ -503,12 +503,16 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
ConnectedUsers: Object.keys(parent.wssessions).length,
UsersSessions: Object.keys(parent.wssessions2).length,
RelaySessions: parent.relaySessionCount,
RelayCount: Object.keys(parent.wsrelays).length
RelayCount: Object.keys(parent.wsrelays).length,
ConnectedIntelAMT: 0
};
if (parent.relaySessionErrorCount != 0) { serverStats.RelayErrors = parent.relaySessionErrorCount; }
if (parent.parent.mpsserver != null) {
serverStats.ConnectedIntelAMT = 0;
for (var i in parent.parent.mpsserver.ciraConnections) { serverStats.ConnectedIntelAMT += parent.parent.mpsserver.ciraConnections[i].length; }
serverStats.ConnectedIntelAMTCira = 0;
for (var i in parent.parent.mpsserver.ciraConnections) { serverStats.ConnectedIntelAMTCira += parent.parent.mpsserver.ciraConnections[i].length; }
}
for (var i in parent.parent.connectivityByNode) {
if (parent.parent.connectivityByNode[i].connectivity == 4) { serverStats.ConnectedIntelAMT++; }
}
// Take a look at agent errors

View File

@ -33,7 +33,8 @@ module.exports.CreateMonitoring = function (parent, args) {
blockedAgents: { description: "Blocked Agents" }, // blockedAgents
};
obj.gaugeMetrics = { // Gauge Metrics always start at 0 and can increase and decrease
ConnectedIntelAMT: { description: "Connected Intel AMT" }, // parent.mpsserver.ciraConnections[i].length
ConnectedIntelAMT: { description: "Connected Intel AMT" }, // parent.parent.connectivityByNode[i].connectivity == 4
ConnectedIntelAMTCira: { description: "Connected Intel AMT CIRA" }, // parent.mpsserver.ciraConnections[i].length
UserAccounts: { description: "User Accounts" }, // Object.keys(parent.webserver.users).length
DeviceGroups: { description: "Device Groups" }, // parent.webserver.meshes (ONLY WHERE deleted=null)
AgentSessions: { description: "Agent Sessions" }, // Object.keys(parent.webserver.wsagents).length
@ -79,10 +80,14 @@ module.exports.CreateMonitoring = function (parent, args) {
ConnectedIntelAMT: 0
};
if (parent.mpsserver != null) {
gauges.ConnectedIntelAMTCira = 0;
for (var i in parent.mpsserver.ciraConnections) {
gauges.ConnectedIntelAMT += parent.mpsserver.ciraConnections[i].length;
gauges.ConnectedIntelAMTCira += parent.mpsserver.ciraConnections[i].length;
}
}
for (var i in parent.connectivityByNode) {
if (parent.connectivityByNode[i].connectivity == 4) { gauges.ConnectedIntelAMT++; }
}
for (const key in gauges) { obj.gaugeMetrics[key].prometheus.set(gauges[key]); }
// Take a look at agent errors
var agentstats = parent.webserver.getAgentStats();

File diff suppressed because it is too large Load Diff

View File

@ -18174,6 +18174,7 @@
InvalidDeviceGroupType: "Invalid Device Group Type",
DuplicateAgent: "Duplicate Agent",
ConnectedIntelAMT: "Connected Intel&reg; AMT",
ConnectedIntelAMTCira: "Connected Intel&reg; AMT CIRA",
RelayErrors: "Relay Errors",
UserAccounts: "User Accounts",
DeviceGroups: "Device Groups",
@ -18260,7 +18261,8 @@
serverTimelineConfig.data.datasets[1].data.push({ x: stats.time, y: stats.conn.cu });
serverTimelineConfig.data.datasets[2].data.push({ x: stats.time, y: stats.conn.us });
serverTimelineConfig.data.datasets[3].data.push({ x: stats.time, y: stats.conn.rs });
if (stats.conn.am != null) { serverTimelineConfig.data.datasets[4].data.push({ x: stats.time, y: stats.conn.am }); }
serverTimelineConfig.data.datasets[4].data.push({ x: stats.time, y: stats.conn.am });
if (stats.conn.amc != null) { serverTimelineConfig.data.datasets[5].data.push({ x: stats.time, y: stats.conn.amc }); }
} else if (chartType == 1) { // Memory
serverTimelineConfig.data.datasets[0].data.push({ x: stats.time, y: stats.mem.external / (1024 * 1024) });
serverTimelineConfig.data.datasets[1].data.push({ x: stats.time, y: stats.mem.heapUsed / (1024 * 1024) });
@ -18307,7 +18309,8 @@
{ label: "Users", data: [], backgroundColor: 'rgba(16, 84, 158, .1)', borderColor: 'rgb(16, 84, 158)', fill: true },
{ label: "User Sessions", data: [], backgroundColor: 'rgba(255, 99, 132, .1)', borderColor: 'rgb(255, 99, 132)', fill: true },
{ label: "Relay Sessions", data: [], backgroundColor: 'rgba(39, 158, 16, .1)', borderColor: 'rgb(39, 158, 16)', fill: true },
{ label: "Intel AMT", data: [], backgroundColor: 'rgba(134, 16, 158, .1)', borderColor: 'rgb(134, 16, 158)', fill: true }
{ label: "Intel AMT", data: [], backgroundColor: 'rgba(134, 16, 158, .1)', borderColor: 'rgb(134, 16, 158)', fill: true },
{ label: "Intel AMT CIRA", data: [], backgroundColor: 'rgba(255, 155, 0, .1)', borderColor: 'rgb(255, 155, 0)', fill: true }
]
};
for (var i = 0; i < serverTimelineStats.length; i++) {
@ -18324,13 +18327,15 @@
data.datasets[2].data.push({ x: serverTimelineStats[i].time - 1, y: NaN });
data.datasets[3].data.push({ x: serverTimelineStats[i].time - 1, y: NaN });
data.datasets[4].data.push({ x: serverTimelineStats[i].time - 1, y: NaN });
data.datasets[5].data.push({ x: serverTimelineStats[i].time - 1, y: NaN });
}
if (serverTimelineStats[i].conn) {
data.datasets[0].data.push({ x: serverTimelineStats[i].time, y: serverTimelineStats[i].conn.ca });
data.datasets[1].data.push({ x: serverTimelineStats[i].time, y: serverTimelineStats[i].conn.cu });
data.datasets[2].data.push({ x: serverTimelineStats[i].time, y: serverTimelineStats[i].conn.us });
data.datasets[3].data.push({ x: serverTimelineStats[i].time, y: serverTimelineStats[i].conn.rs });
if (serverTimelineStats[i].conn.am != null) { data.datasets[4].data.push({ x: serverTimelineStats[i].time, y: serverTimelineStats[i].conn.am }); }
data.datasets[4].data.push({ x: serverTimelineStats[i].time, y: serverTimelineStats[i].conn.am });
if (serverTimelineStats[i].conn.amc != null) { data.datasets[5].data.push({ x: serverTimelineStats[i].time, y: serverTimelineStats[i].conn.amc }); }
}
}
} else if (chartType == 1) { // Memory

View File

@ -19450,6 +19450,7 @@
InvalidDeviceGroupType: "Invalid Device Group Type",
DuplicateAgent: "Duplicate Agent",
ConnectedIntelAMT: "Connected Intel&reg; AMT",
ConnectedIntelAMTCira: "Connected Intel&reg; AMT CIRA",
RelayErrors: "Relay Errors",
UserAccounts: "User Accounts",
DeviceGroups: "Device Groups",
@ -19538,7 +19539,8 @@
serverTimelineConfig.data.datasets[1].data.push({ x: stats.time, y: stats.conn.cu });
serverTimelineConfig.data.datasets[2].data.push({ x: stats.time, y: stats.conn.us });
serverTimelineConfig.data.datasets[3].data.push({ x: stats.time, y: stats.conn.rs });
if (stats.conn.am != null) { serverTimelineConfig.data.datasets[4].data.push({ x: stats.time, y: stats.conn.am }); }
serverTimelineConfig.data.datasets[4].data.push({ x: stats.time, y: stats.conn.am });
if (stats.conn.amc != null) { serverTimelineConfig.data.datasets[5].data.push({ x: stats.time, y: stats.conn.amc }); }
} else if (chartType == 1) { // Memory
serverTimelineConfig.data.datasets[0].data.push({ x: stats.time, y: stats.mem.external / (1024 * 1024) });
serverTimelineConfig.data.datasets[1].data.push({ x: stats.time, y: stats.mem.heapUsed / (1024 * 1024) });
@ -19585,7 +19587,8 @@
{ label: "Users", data: [], backgroundColor: 'rgba(16, 84, 158, .1)', borderColor: 'rgb(16, 84, 158)', fill: true },
{ label: "User Sessions", data: [], backgroundColor: 'rgba(255, 99, 132, .1)', borderColor: 'rgb(255, 99, 132)', fill: true },
{ label: "Relay Sessions", data: [], backgroundColor: 'rgba(39, 158, 16, .1)', borderColor: 'rgb(39, 158, 16)', fill: true },
{ label: "Intel AMT", data: [], backgroundColor: 'rgba(134, 16, 158, .1)', borderColor: 'rgb(134, 16, 158)', fill: true }
{ label: "Intel AMT", data: [], backgroundColor: 'rgba(134, 16, 158, .1)', borderColor: 'rgb(134, 16, 158)', fill: true },
{ label: "Intel AMT CIRA", data: [], backgroundColor: 'rgba(255, 155, 0, .1)', borderColor: 'rgb(255, 155, 0)', fill: true }
]
};
for (var i = 0; i < serverTimelineStats.length; i++) {
@ -19602,13 +19605,15 @@
data.datasets[2].data.push({ x: serverTimelineStats[i].time - 1, y: NaN });
data.datasets[3].data.push({ x: serverTimelineStats[i].time - 1, y: NaN });
data.datasets[4].data.push({ x: serverTimelineStats[i].time - 1, y: NaN });
data.datasets[5].data.push({ x: serverTimelineStats[i].time - 1, y: NaN });
}
if (serverTimelineStats[i].conn) {
data.datasets[0].data.push({ x: serverTimelineStats[i].time, y: serverTimelineStats[i].conn.ca });
data.datasets[1].data.push({ x: serverTimelineStats[i].time, y: serverTimelineStats[i].conn.cu });
data.datasets[2].data.push({ x: serverTimelineStats[i].time, y: serverTimelineStats[i].conn.us });
data.datasets[3].data.push({ x: serverTimelineStats[i].time, y: serverTimelineStats[i].conn.rs });
if (serverTimelineStats[i].conn.am != null) { data.datasets[4].data.push({ x: serverTimelineStats[i].time, y: serverTimelineStats[i].conn.am }); }
data.datasets[4].data.push({ x: serverTimelineStats[i].time, y: serverTimelineStats[i].conn.am });
if (serverTimelineStats[i].conn.amc != null) { data.datasets[5].data.push({ x: serverTimelineStats[i].time, y: serverTimelineStats[i].conn.amc }); }
}
}
} else if (chartType == 1) { // Memory