Name
sn_agent.AgentNowCapabilities
Description
No description available
Script
var AgentNowCapabilities = Class.create();
AgentNowCapabilities.prototype = {
initialize: function() {
},
grabAgentLog: function(current, action) {
var agentNowHandler = new AgentNowHandler();
var agentId = current.agent_id;
var agents = {};
agents[agentId] = {};
var agentInfoGr = new GlideRecord("sn_agent_ci_extended_info");
agentInfoGr.addQuery("sys_id", current.agent_extended_info);
agentInfoGr.query();
agentInfoGr.next();
// agent default log path has moved down to agent level in the ruby script
check = {
"checkDefId": "028fcd5067c80010b7b72dbd2685ef4f"
};
var requestId = agentNowHandler.runCheckForAgentPerMid(check,
agentNowHandler.getPolicyPerMid(agents), 0, 180);
if (!gs.nil(action)) { // if not nil, then called from ui action
gs.addInfoMessage(gs.getMessage('Grabbing agent-client-collector log'));
var url = 'ecc_queue_list.do?sysparm_query=topic%3D';
url += "MonitoringProbe";
url += '^agent_correlator%3D';
url += requestId;
action.setRedirectURL(url);
}
return requestId;
},
grabAccYml: function(current, action) {
var agentNowHandler = new AgentNowHandler();
var agentId = current.agent_id;
var agents = {};
agents[agentId] = {};
var agentInfoGr = new GlideRecord("sn_agent_ci_extended_info");
agentInfoGr.addQuery("sys_id", current.agent_extended_info);
agentInfoGr.query();
agentInfoGr.next();
var isWindows = agentInfoGr.getValue("is_windows");
var accFilePath = "/servicenow/agent-client-collector/acc.yml";
var accConfigPath = "AGENT_CONFIG_ROOT";
if (isWindows == 1) {
accFilePath = "\\ServiceNow\\agent-client-collector\\config\\acc.yml";
accConfigPath = "PROGRAMDATA";
}
check = {
"checkDefId": "723ea902b7fe2010ff78dc55ce11a98b",
"params": {
"file_path": accFilePath,
"config_path": accConfigPath
}
};
var requestId = agentNowHandler.runCheckForAgentPerMid(check,
agentNowHandler.getPolicyPerMid(agents), 0, 180);
gs.addInfoMessage(gs.getMessage('Attaching acc.yml. Refresh the form in a few seconds to see the attached file.'));
if(action)
action.setRedirectURL(current);
},
type: 'AgentNowCapabilities'
};
Sys ID
3625652a67080010b7b72dbd2685ef28