mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-04-14 00:09:44 -04:00
Added secondary agent id to events.
This commit is contained in:
parent
1b44eb8403
commit
c8161aedc3
14
meshagent.js
14
meshagent.js
@ -907,10 +907,8 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||||||
//console.log('recoveryAgentCoreIsStable()');
|
//console.log('recoveryAgentCoreIsStable()');
|
||||||
|
|
||||||
// Fetch the the real agent nodeid
|
// Fetch the the real agent nodeid
|
||||||
db.Get('da' + obj.dbNodeKey, function (err, nodes, self)
|
db.Get('da' + obj.dbNodeKey, function (err, nodes, self) {
|
||||||
{
|
if ((nodes != null) && (nodes.length == 1)) {
|
||||||
if ((nodes != null) && (nodes.length == 1))
|
|
||||||
{
|
|
||||||
self.realNodeKey = nodes[0].raid;
|
self.realNodeKey = nodes[0].raid;
|
||||||
|
|
||||||
// Get agent connection state
|
// Get agent connection state
|
||||||
@ -919,8 +917,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||||||
if (state) { agentConnected = ((state.connectivity & 1) != 0) }
|
if (state) { agentConnected = ((state.connectivity & 1) != 0) }
|
||||||
|
|
||||||
self.send(JSON.stringify({ action: 'diagnostic', value: { command: 'query', value: self.realNodeKey, agent: agentConnected } }));
|
self.send(JSON.stringify({ action: 'diagnostic', value: { command: 'query', value: self.realNodeKey, agent: agentConnected } }));
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
self.send(JSON.stringify({ action: 'diagnostic', value: { command: 'query', value: null } }));
|
self.send(JSON.stringify({ action: 'diagnostic', value: { command: 'query', value: null } }));
|
||||||
}
|
}
|
||||||
}, obj);
|
}, obj);
|
||||||
@ -1243,8 +1240,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||||||
switch (command.value.command) {
|
switch (command.value.command) {
|
||||||
case 'register': {
|
case 'register': {
|
||||||
// Only main agent can do this
|
// Only main agent can do this
|
||||||
if (((obj.agentInfo.capabilities & 0x40) == 0) && (typeof command.value.value == 'string') && (command.value.value.length == 64))
|
if (((obj.agentInfo.capabilities & 0x40) == 0) && (typeof command.value.value == 'string') && (command.value.value.length == 64)) {
|
||||||
{
|
|
||||||
// Store links to diagnostic agent id
|
// Store links to diagnostic agent id
|
||||||
var daNodeKey = 'node/' + domain.id + '/' + db.escapeBase64(command.value.value);
|
var daNodeKey = 'node/' + domain.id + '/' + db.escapeBase64(command.value.value);
|
||||||
db.Set({ _id: 'da' + daNodeKey, domain: domain.id, time: obj.connectTime, raid: obj.dbNodeKey }); // DiagnosticAgent --> Agent
|
db.Set({ _id: 'da' + daNodeKey, domain: domain.id, time: obj.connectTime, raid: obj.dbNodeKey }); // DiagnosticAgent --> Agent
|
||||||
@ -1276,7 +1272,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||||||
case 'log': {
|
case 'log': {
|
||||||
if (((obj.agentInfo.capabilities & 0x40) != 0) && (typeof command.value.value == 'string') && (command.value.value.length < 256)) {
|
if (((obj.agentInfo.capabilities & 0x40) != 0) && (typeof command.value.value == 'string') && (command.value.value.length < 256)) {
|
||||||
// If this is a diagnostic agent, log the event in the log of the main agent
|
// If this is a diagnostic agent, log the event in the log of the main agent
|
||||||
var event = { etype: 'node', action: 'diagnostic', nodeid: obj.realNodeKey, domain: domain.id, msg: command.value.value };
|
var event = { etype: 'node', action: 'diagnostic', nodeid: obj.realNodeKey, snodeid: obj.dbNodeKey, domain: domain.id, msg: command.value.value };
|
||||||
parent.parent.DispatchEvent(parent.CreateMeshDispatchTargets(obj.dbMeshKey, [obj.dbNodeKey]), obj, event);
|
parent.parent.DispatchEvent(parent.CreateMeshDispatchTargets(obj.dbMeshKey, [obj.dbNodeKey]), obj, event);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "meshcentral",
|
"name": "meshcentral",
|
||||||
"version": "0.5.1-g",
|
"version": "0.5.1-h",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Remote Management",
|
"Remote Management",
|
||||||
"Intel AMT",
|
"Intel AMT",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user