protected void updateModel(IProgressMonitor monitor) throws CoreException {
    IPluginBase plugin = model.getPluginBase();
    IPluginModelFactory factory = model.getPluginFactory();

    String sigarArg = getStringOption(KEY_SIGAR_ARG_NAME);

    IPluginElement metrics = factory.createElement(plugin);
    //		IHQMetrics metrics = factory.createMetrics();
    metrics.setName("metrics");
    metrics.setAttribute("name", "multi-process-metrics");

    IPluginElement metric = factory.createElement(metrics);
    metric.setName("metric");
    metric.setAttribute("name", "Availability");
    metric.setAttribute("template", "sigar:Type=MultiProcCpu,Arg=%" + sigarArg + "%:Availability");
    metric.setAttribute("category", "AVAILABILITY");
    metric.setAttribute("indicator", "true");
    metric.setAttribute("units", "percentage");
    metric.setAttribute("collectionType", "dynamic");
    metrics.add(metric);

    metric = factory.createElement(metrics);
    metric.setName("metric");
    metric.setAttribute("name", "Number of Processes");
    metric.setAttribute("alias", "NumProcesses");
    metric.setAttribute("template", "sigar:Type=MultiProcCpu,Arg=%" + sigarArg + "%:Processes");
    metric.setAttribute("category", "UTILIZATION");
    metric.setAttribute("units", "none");
    metric.setAttribute("collectionType", "dynamic");
    metrics.add(metric);

    metric = factory.createElement(metrics);
    metric.setName("metric");
    metric.setAttribute("name", "Memory Size");
    metric.setAttribute("alias", "MemSize");
    metric.setAttribute("template", "sigar:Type=MultiProcMem,Arg=%" + sigarArg + "%:Size");
    metric.setAttribute("category", "UTILIZATION");
    metric.setAttribute("units", "B");
    metric.setAttribute("collectionType", "dynamic");
    metrics.add(metric);

    metric = factory.createElement(metrics);
    metric.setName("metric");
    metric.setAttribute("name", "Resident Memory Size");
    metric.setAttribute("alias", "ResidentMemSize");
    metric.setAttribute("template", "sigar:Type=MultiProcMem,Arg=%" + sigarArg + "%:Resident");
    metric.setAttribute("category", "UTILIZATION");
    metric.setAttribute("units", "B");
    metric.setAttribute("collectionType", "dynamic");
    metrics.add(metric);

    metric = factory.createElement(metrics);
    metric.setName("metric");
    metric.setAttribute("name", "Cpu System Time");
    metric.setAttribute("alias", "SystemTime");
    metric.setAttribute("template", "sigar:Type=MultiProcCpu,Arg=%" + sigarArg + "%:Sys");
    metric.setAttribute("category", "UTILIZATION");
    metric.setAttribute("units", "ms");
    metric.setAttribute("collectionType", "trendsup");
    metrics.add(metric);

    metric = factory.createElement(metrics);
    metric.setName("metric");
    metric.setAttribute("name", "Cpu User Time");
    metric.setAttribute("alias", "UserTime");
    metric.setAttribute("template", "sigar:Type=MultiProcCpu,Arg=%" + sigarArg + "%:User");
    metric.setAttribute("category", "UTILIZATION");
    metric.setAttribute("units", "ms");
    metric.setAttribute("collectionType", "trendsup");
    metrics.add(metric);

    metric = factory.createElement(metrics);
    metric.setName("metric");
    metric.setAttribute("name", "Cpu Total Time");
    metric.setAttribute("alias", "TotalTime");
    metric.setAttribute("template", "sigar:Type=MultiProcCpu,Arg=%" + sigarArg + "%:Total");
    metric.setAttribute("category", "UTILIZATION");
    metric.setAttribute("units", "ms");
    metric.setAttribute("collectionType", "trendsup");
    metrics.add(metric);

    metric = factory.createElement(metrics);
    metric.setName("metric");
    metric.setAttribute("name", "Cpu Usage");
    metric.setAttribute("alias", "Usage");
    metric.setAttribute("template", "sigar:Type=MultiProcCpu,Arg=%" + sigarArg + "%:Percent");
    metric.setAttribute("category", "UTILIZATION");
    metric.setAttribute("indicator", "true");
    metric.setAttribute("units", "percentage");
    metric.setAttribute("collectionType", "dynamic");
    metrics.add(metric);

    // we need to know the parent tag where
    // to place these metrics.
    if (fParent != null && fParent instanceof PluginParentNode) {
      PluginParentNode parent = (PluginParentNode) fParent;
      parent.add(metrics);
    } else {
      plugin.add(metrics);
    }
  }
  private IHQServer getWithFilters() throws CoreException {
    IPluginModelFactory factory = model.getPluginFactory();
    IHQServer server = factory.createServer();

    server.setName("Windows Performance Counters");
    server.setPlatforms("Win32");

    IPluginElement element = factory.createElement(server);
    element.setName("plugin");
    element.setAttribute("type", "measurement");
    element.setAttribute("class", "org.hyperic.hq.product.MeasurementPlugin");
    server.add(element);

    element = factory.createElement(server);
    element.setName("metric");
    element.setAttribute("name", "Availability");
    element.setAttribute("template", "win32:Service=Eventlog:Availability");
    element.setAttribute("indicator", "true");
    server.add(element);

    element = factory.createElement(server);
    element.setName("filter");
    element.setAttribute("name", "template");
    element.setAttribute("value", "win32:Object=${object}:${alias}");
    server.add(element);

    element = factory.createElement(server);
    element.setName("filter");
    element.setAttribute("name", "object");
    element.setAttribute("value", "Memory");
    server.add(element);

    element = factory.createElement(server);
    element.setName("metric");
    element.setAttribute("name", "Memory pages/sec");
    element.setAttribute("alias", "Pages/sec");
    server.add(element);

    element = factory.createElement(server);
    element.setName("metric");
    element.setAttribute("name", "Memory avail bytes");
    element.setAttribute("alias", "Available Bytes");
    server.add(element);

    element = factory.createElement(server);
    element.setName("filter");
    element.setAttribute("name", "object");
    element.setAttribute("value", "System");
    server.add(element);

    element = factory.createElement(server);
    element.setName("metric");
    element.setAttribute("name", "Processor queue length");
    element.setAttribute("alias", "Processor Queue Length");
    server.add(element);

    element = factory.createElement(server);
    element.setName("filter");
    element.setAttribute("name", "object");
    element.setAttribute("value", "Processor");
    server.add(element);

    element = factory.createElement(server);
    element.setName("filter");
    element.setAttribute("name", "instance");
    element.setAttribute("value", "_Total");
    server.add(element);

    element = factory.createElement(server);
    element.setName("filter");
    element.setAttribute("name", "template");
    element.setAttribute("value", "win32:Object=${object},Instance=${instance}:${alias}");
    server.add(element);

    element = factory.createElement(server);
    element.setName("metric");
    element.setAttribute("name", "Processor idle time");
    element.setAttribute("alias", "% Idle Time");
    server.add(element);

    return server;
  }
 public void add(IPluginElement element) throws CoreException {
   fElements.add(element);
   ((IPluginElement) element).setInTheModel(true);
   //		((IPluginElement)element).setParent(this);
   fireStructureChanged(element, IModelChangedEvent.INSERT);
 }