NetXMS Support Forum

English Support => General Support => Topic started by: sharpspro on September 07, 2015, 12:07:24 PM

Title: Scan for a certain service across all servers
Post by: sharpspro on September 07, 2015, 12:07:24 PM
GOAL: My goal is to be able to scan for a service like MSSQLServer and get a report back on all servers running that service.

I created a DCI table (Services) and applied it to all server nodes. I would like to run a DCI summary table or a Dashboard to scan for a certain service running across all servers in my environment.

I thought a DCI Table for services would collect all services running. Next would be a DCI Summary Table or Dashboard to run across the whole Infrastructure Services. Then I can take that info and make sure the proper templates are being applied.

What would be the best way to accomplish this? Any ideas would be awesome.

Thanks Guys!
Title: Re: Scan for a certain service across all servers
Post by: Victor Kirhenshtein on September 08, 2015, 10:06:57 AM
Hi,

so ultimately you only need some mark that MS SQL is running on node to be able to apply templates? Then it could be accomplished much easier using configuration poll hook:

1. Create script in script library named Hook::ConfigurationPoll like this:


if ($node->isAgent)
{
   state = AgentReadParameter($node, "System.ServiceState(mssqlserver)");
   if (state == 0)
   {
      SetCustomAttribute($node, "sqlServer", "true");
   }
}


it will set custom attribute sqlServer to true if service is running. Please note that service name might be different, I cannot remember correct name for SQL Server service.

2. To auto apply templates, use the following auto-apply filter script:


return GetCustomAttribute($node, "sqlServer") == "true";


Best regards,
Victor
Title: Re: Scan for a certain service across all servers
Post by: sharpspro on October 16, 2015, 06:34:24 PM
This worked great thanks Victor.  :)

Cheers!