I'm trying to get the Windows Services probe and sensor working.

mikeb5
Kilo Contributor

There's an OOB probe called Windows Services. We don't have it configured to run, and it would be useful to look at what services were configured on a server.

I've configured our dev instance so that the probe and sensor run. I can see them running, and I can see that the sensor processes a list of services on the server.

But I don't understand how the CMDB gets updated by the sensor.

Specifically, what does this statement do?

this.addToRelatedList('cmdb_ci_windows_service', this.dataArray, 'cmdb_ci', 'name');


What have I not done? The service data doesn't get added to the server CI. I can't see the data anywhere in the CMDB.

This is the complete sensor. It all makes sense until the addrelatedlits statement!

new DiscoverySensor({
      dataArray: [],

      process: function(result) {
              this.parseResult(result);
      },

      parseResult: function(result) {
              var dataArrayList = g_array_util.ensureArray(result.Win32_Service);

              for (var i = 0; i < dataArrayList.length; i++) {
                      var element = dataArrayList[i];
                      var dataArrayDef = {};

                      dataArrayDef.name                         = element.Name;
                      dataArrayDef.display_name         = element.DisplayName;
                      dataArrayDef.path_name               = element.PathName;
                      dataArrayDef.service_state       = element.State;
                      dataArrayDef.start_mode             = element.StartMode;
                      dataArrayDef.service_type         = element.ServiceType;
                      dataArrayDef.process_id             = element.ProcessId;
                      dataArrayDef.can_be_paused       = element.AcceptPause;
                      dataArrayDef.can_be_stopped     = element.AcceptStop;
                      dataArrayDef.desktop_interact = element.DesktopInteract;
                      dataArrayDef.account                   = element.StartName;

                      this.dataArray.push(dataArrayDef);
              }

              this.addToRelatedList('cmdb_ci_windows_service', this.dataArray, 'cmdb_ci', 'name');
      },

      type: "DiscoverySensor"
});

1 ACCEPTED SOLUTION

doug_schulze
ServiceNow Employee
ServiceNow Employee

Mike,



Perhaps its because you are running a powershell script to collect the values and not the OOB WMI queries that come with the product.   While you can absolutely do this, you want to build a new sensor that just deals with the pure data array and not expect to see a result from win_32.service..



Or you can just add the OOB Windows services probe to the classifier and see if that meets your need...


View solution in original post

8 REPLIES 8

Are you seeing results in probe xml payload? It doesn't really matter what your sensor is doing if your probe provides it zero data.


Hi Andrew, thanks for the replies. Yes, I can see the services in the XML, probe "input"



<?xml version="1.0" encoding="UTF-8" ?>


- <results probe_time="28009">


- <result>


<output>Name StartName State ---- --------- ----- AdtAgent NT AUTHORITY\NetworkService Stopped AeLookupSvc localSystem Running ALG NT AUTHORITY\LocalService Stopped AppHostSvc LocalSystem Running AppIDSvc NT Authority\LocalService Stopped Appinfo LocalSystem Stopped AppMgmt LocalSystem Stopped aspnet_state NT AUTHORITY\NetworkService Stopped AudioEndpointBuilder LocalSystem Stopped AudioSrv NT AUTHORITY\LocalService Stopped BFE NT AUTHORITY\LocalService Running BITS LocalSystem Running Browser LocalSystem Stopped CcmExec LocalSystem Running CertPropSvc LocalSystem Running clr_optimization_v2.0.50727_32 LocalSystem Stopped clr_optimization_v2.0.50727_64 LocalSystem Stopped clr_optimization_v4.0.30319_32 LocalSystem Stopped clr_optimization_v4.0.30319_64 LocalSystem Stopped CmRcService LocalSystem Stopped COMSysApp LocalSystem Running CryptSvc NT Authority\NetworkService Running ctmag LocalSystem Running ctmfw_service LocalSystem Stopped DcomLaunch LocalSystem Running defragsvc localSystem Stopped Dhcp NT Authority\LocalService Running Dnscache NT AUTHORITY\NetworkService Running dot3svc localSystem


doug_schulze
ServiceNow Employee
ServiceNow Employee

Mike,



Perhaps its because you are running a powershell script to collect the values and not the OOB WMI queries that come with the product.   While you can absolutely do this, you want to build a new sensor that just deals with the pure data array and not expect to see a result from win_32.service..



Or you can just add the OOB Windows services probe to the classifier and see if that meets your need...


Thanks Doug