2.15.5 Adding Metrics to vmetrics

You can add your own metric to be collected by the vmetrics service.

  1. In /opt/oracle.SupportTools/vmetrics/vmetrics.conf, add the new metric and the system commands to retrieve and parse that metric. For example:
    <metric type="uint32" context="host">
     <name>NumCPUs</name>
     <action>grep -c processor /proc/cpuinfo</action>
     <action2>xm list | grep '^Domain-0' |awk '{print $4}'</action2>
    </metric>
    

    In the <name> element, enter the name of the new metric.

    In the <action> and <action2> elements, specify the system command for the new metric. You only need to have <action2>, but you can use <action> as a fallback in case <action2> does not work on some systems.

    Note that any action that needs the name of the vm should be done with scas07client07vm01. When vmetrics runs, it swaps out this dummy name for the actual domU names that are running in the dom0.

  2. In /opt/oracle.SupportTools/vmetrics/vmetrics, add the metric in the list gFieldsList. Prefix the metric name with "host" if the metric is about the host (dom0) or with "vm" if the metric is about the vm (domU). For example:

    Suppose the gFieldsList looks like this:

    gFieldsList = [ 'host.VirtualizationVendor',
        'host.VirtProductInfo',
        'host.PagedInMemory',
        'vm.ResourceProcessorLimit' ]
    

    If you are adding a new metric called "NumCPUs" (as shown in the example in step 1), and this metric is intended to tell the domU how many cpu's the dom0 has available, then gFieldsList would now look like:

     gFieldsList = [ 'host.VirtualizationVendor',
        'host.VirtProductInfo',
        'host.PagedInMemory',
        'vm.ResourceProcessorLimit',
        'host.NumCPUs']
    
  3. (optional) In /opt/oracle.SupportTools/vmetrics/vm-dump-metrics, add the new metric if you want the new metric to be included in the XML output.

    If you skip this step, you can view the new metric using the ovmd -g vmhost command.