Name

global.ProbeHandlerWMI

Description

Gets called when a probe is going to be created that is WMI

Script

// Discovery Probe Handler for the WMI probes

gs.include("PrototypeServer");

var ProbeHandlerWMI = Class.create();

ProbeHandlerWMI.prototype = {
  initialize: function(probe) {
      this.probe = probe;
  },

  run: function() {
      this.probe.setTopic("WMIRunner");
      var params = this.getParameters();
      this.setProbeParameters(params);
  },

  /*
   * Returns a hash map of the parameters added by this probe handler.
   */
  getParameters: function() {
      var result = {};
      result['WMI_FetchData'] = this.getWMIFields();
      return result;
  },

  setProbeParameters: function(params) {
      for (var name in params)
          this.probe.addParameter(name, params[name]);
  },

  /*
   * Generate a string containing the WMI fields to fetch
   */
  getWMIFields: function() {
      var wmiFields = [];
      var fgr = new GlideRecord("discovery_probes_wmi_field");
      fgr.addQuery("probe", this.probe.getId());
      fgr.addActiveQuery();
      fgr.query();
      while (fgr.next())
          wmiFields.push('' + fgr.wmi_path);

      return wmiFields.join();
  },

  type: 'ProbeHandlerWMI'
}

Sys ID

e5199a800a0a0ba500718c6cc21a19b3

Offical Documentation

Official Docs: