have the below groovy script which will list all the agents along with its status.
We have defined a Registry variable SYB_ONCALL_PAGER and I would also like to get the value of the variable along with the agent details.
Basically, how do I find the value of the above registry variable for that agent or host, if defined.
In the script below, I am using registry function which always returns the global default value.
import com.quest.nitro.service.sl.interfaces.agent.*
def agentSvc = server.get(AgentService);
def agentInfo = ;
agentList = agentSvc.findAll();
for (agent in agentList)
{
name = agent.getName();
isActive = agent.getIsActive();
isCollectingData = agent.getIsCollectingData();
oncallPager = registry(SYB_ONCALL_PAGER);
agentInfo += $name, $isActive, $isCollectingData, $oncallPager \n;
}
return agentInfo;
The changes to the original script are highlighted below which provide the scoped registry values for the registry value SYB_ONCALL_PAGER.
import com.quest.nitro.service.sl.interfaces.agent.*
def agentSvc = server.get(AgentService);
def agentInfo = "";
agentList = agentSvc.findAll();
agentsById = [:];
for (a in #! Agent#.getTopologyObjects()) {
agentsById.put(a.get(agentID).toString(), a);
}
for (agent in agentList)
{
agentObj = agentsById.get(agent.getId());
if (agentObj == null) {
continue;
}
hostObj = agentObj.get(monitoredHost);
name = agent.getName();
isActive = agent.getIsActive();
isCollectingData = agent.getIsCollectingData();
oncallPager = registry(agentObj,"SYB_ONCALL_PAGER", hostObj);
agentInfo += $name, $isActive, $isCollectingData, $oncallPager \n;
}
return agentInfo;
© ALL RIGHTS RESERVED. Feedback Terms of Use Privacy Cookie Preference Center