Custom Probe/Sensor Windows Video Cards

doug_schulze
ServiceNow Employee
ServiceNow Employee

Have a customer that do alot of design work so they needed to track their video adapters so here you go!

Note you will need to create a custom table (I extended cmdb_ci) then on that table create a reference field back to cmdb_ci called it 'u_installed_on' and of course all your new fields below

WMI Probe... (WMI Fields)

***************

Win32_VideoController.CurrentHorizontalResolution
Win32_VideoController.InstalledDisplayDrivers
Win32_VideoController.Description
Win32_VideoController.DriverVersion
Win32_VideoController.CurrentVerticalResolution

**************

Then the sensor

**************


new DiscoverySensor({
         dataArray: [],

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

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

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

                       dataArrayDef.name                         = element.Description;
                       dataArrayDef.driverversion       = element.DriverVersion;
                       dataArrayDef.verticalresolution = element.CurrentVerticalResolution;
                       dataArrayDef.horizontalresolution       = element.CurrentHorizontalResolution;
                       dataArrayDef.driverdate             = element.DriverDate;
                       dataArrayDef.installeddrivers         = element.InstalledDisplayDrivers;
                   

                       this.dataArray.push(dataArrayDef);
               }

               this.addToRelatedList('u_video_adapter', this.dataArray, 'u_installed_on', 'name');
       },

       type: "DiscoverySensor"
});


***********

Enjoy!

Remember sharing is caring? Doing anything cool in your environment?
5 REPLIES 5

krantimundhe
Kilo Contributor

Hi Doug,

I am trying to map the 'Application Name' next to 'Running Processes' in the CI form when that particular CI is discovered.

For ex- Whenever we find 'AccuRate Diagnostics Service.exe' running on a box, We should name it as 'AccuRate'.

For this purpose, I have created a table 'AppName' which extends 'cmdb_ci' table and have also created a field 'AppName' in the related list of the CI form for running process.

Here are my WMI fields for the Probe-

Win32_Process.CreationDate
Win32_Process.ParentProcessId
Win32_Process.Description
Win32_Process.ExecutablePath
Win32_Process.Caption
Win32_Process.Name
Win32_Process.ProcessId
Win32_Process.Priority
Win32_Process.CommandLine

And here is my Sensor for the same-

--------------------------------------------------------------------------------
new DiscoverySensor({
mapProcesses: function(result) {
var procs = [];
var proclist = g_array_util.ensureArray(result.Win32_Process);

for (var i = 0; i < proclist.length; i++) {
var Win32_Process = proclist;

var name = Win32_Process.Name;

if (name == "AccuRate Diagnostics Service.exe")
{
current.u_appname = "AccuRate";
break;
}

}

return procs;
},

type: "DiscoverySensor"
});
--------------------------------------------------------------------------------

I am getting the required information from the Probe payload but unable to Display value 'AccuRate' on the CI form under 'App name' field.

Can you please let me know if I am missing anything here? Also, apart from the System logs, Is there any other way to test if my Sensor is working as expected or there are any issues in it?

Kranti Mundhe


Kranti, I would think that you would want to create an application process classifier that maps that existing .exe to the common name of accurate and relate that to the computer.. No need to modify the sensor


Hi Doug,



I am facing issue while creating SAP Application from running process received after discovery.


I am using filter SAPSTARTSRV on command , but this is resulting in multiple records and with multiple process id, and classifier is creating multiple Application for that, Please suggest how to deal with this scenario.



Regards


Manish


You can see if there might be specific parameters that these processes are running with that might help you get more specific on the single process you want to map or perhaps Process Handlers might be of service here..



Process Classifications - ServiceNow Wiki