-
Notifications
You must be signed in to change notification settings - Fork 9
Collectors
This page contains information about all Collectors included with MOM including the data collected and configuration information. The most up to date information on Collector fields will always be in the source code itself but this page will be kept as up to date as possible.
When writing MOM policies, use the data fields described here to access host and guest statistics. The fields may only be accessed in a policy if the corresponding Collector is loaded. When two Collectors provide the same field, the Collector listed first in the mom configuration file will supersede the others.
Host statistics are accessed using the following syntax:
Host.<field> |
Access the latest value for <field> |
(Host.StatAvg "<field>") |
Access the moving average of <field> |
Guest statistics are accessed in a similar fashion using the iterator given by the with
construct (see Policy for details):
(with Guests guest { (defvar foo guest.<field>) (defvar bar (guest.StatAvg "<field>")) })
This collector gathers general memory statistics about the host.
Setup: To use this Collector, simply enable it in the mom configuration file
For example:
[host]
collectors: HostMemory
Data: This Collector provides the following host data
mem_available | The total amount of available memory (kB) |
mem_unused | The amount of memory that is not being used for any purpose (kB) |
mem_free | The amount of free memory including some caches (kB) |
swap_in | The amount of memory swapped in since the last collection (pages) |
swap_out | The amount of memory swapped out since the last collection (pages) |
anon_pages | The amount of memory used for anonymous memory areas (kB) |
This collector exposes host KSM statistics as reported in sysfs.
Setup: Enable in the mom config file. If your host does not support KSM this Collector will raise a Fatal Error.
[host]
collectors: HostMemory, HostKSM
Data: This Collector provides the following host data
ksm_run | Status of the KSM daemon: 0 – Stopped, 1 – Running |
ksm_sleep_millisecs | The amount of idle time between scans (ms) |
ksm_pages_shared | The number of pages being shared |
ksm_pages_sharing | The number of sites where a shared page is in use |
ksm_pages_unshared | The number of pages that are scanned but not shared |
ksm_pages_to_scan | The number of pages to scan in each work interval |
ksm_pages_volatile | The number of pages that are changing too fast to be shared |
ksm_full_scans | The number of times all mergeable memory areas have been scanned |
ksm_shareable | Estimated amount of host memory that is eligible for sharing |
A collector that uses libvirt to gather information about running guests.
Setup: Enable in the mom configuration file
[guest]
collectors: GuestLibvirt
Data: This Collector always provides the following guest data
libvirt_state | The domain state defined by libvirt as: |
VIR_DOMAIN_NOSTATE = 0 : no state |
|
VIR_DOMAIN_RUNNING = 1 : the domain is running |
|
VIR_DOMAIN_BLOCKED = 2 : the domain is blocked on resource |
|
VIR_DOMAIN_PAUSED = 3 : the domain is paused by user |
|
VIR_DOMAIN_SHUTDOWN = 4 : the domain is being shut down |
|
VIR_DOMAIN_SHUTOFF = 5 : the domain is shut off |
|
VIR_DOMAIN_CRASHED = 6 : the domain is crashed |
|
libvirt_maxmem | The maximum amount of memory the guest may use |
libvirt_curmem | The current memory limit (set by ballooning) |
If libvirt memory statistics are enabled on the host and guest then the following guest statistics are provided:
mem_available | Total amount of memory available (kB) |
mem_unused | Amount of free memory not including caches (kB) |
major_fault | Total number of major page faults |
minor_fault | Total number of minor page faults |
swap_in | Total amount of memory swapped in (kB) |
swap_out | Total amount of memory swapped out (kB) |
This Collector returns statistics for the qemu process representing a guest.
Setup: Enable in the mom configuration file
[guest]
collectors: GuestLibvirt, GuestQemuProc
Data: This Collector provides the following guest data
host_minor_faults | The number of host minor faults a guest’s qemu process caused since the last collection. |
host_major_faults | The number of host major faults a guest’s qemu process caused since the last collection. |
rss | The resident set size counts the number of resident pages associated with this qemu process. |
NOTE: Host major faults generally require host disk IO to satisfy, host minor faults do not.
This collector communicates over the network with a program running on the guest to gather guest memory statistics.
Setup: Since this Collector depends on a server program in the guest and a network connection to this server, the setup for this Collector is more involved. In short, you need to set up the following to use this Collector:
- Guest name to guest IP address mapping
- The MOM guest daemon (mom-guestd) must be running in the guest
There is no standardized way to determine a guest’s IP address since network setup is site-specific. In order to connect to guests, MOM relies on a helper program to map libvirt guest names to IP addresses. You must customize a name-to-ip program (see the example in the documentation) to fit your environment and set the path to that program in the mom configuration file. Here is an example:
Sample name-to-ip script
#!/bin/bash
# name-to-ip: Map a guest name to an IP address
#
# There is no standard method of determining the IP address of a given guest.
# Therefore, MOM makes use of a helper program that can be customized according
# to the host network configuration.
#
# This script will be called with the domain name (as returned by the
# virDomainGetName() libvirt API). The output should be an IPv4 IP address
# only. On error, return nothing.
NAME=$1
# Example 1: The name is the IP address
# echo -n $NAME
# Example 2: The name is a valid hostname
# nslookup $NAME | grep '^Server' | awk '{print $2}'
# Example 3: The name contains a sequence number which maps directly to a range
# of local IP addresses
NUM=${NAME##*-}
IP="192.168.123.$[ $NUM + 1 ]"
echo $IP
MOM configuration file entry
[guest]
...
name-to-ip-helper: /usr/local/bin/name-to-ip
Data: This Collector provides the following guest data
mem_available | The total amount of available memory (kB) |
mem_unused | The amount of memory that is not being used for any purpose (kB) |
major_fault | Total number of major page faults |
minor_fault | Total number of minor page faults |
swap_in | The amount of memory swapped in since the last collection (pages) |
swap_out | The amount of memory swapped out since the last collection (pages) |