254 z/VM and Linux on IBM System z: The Virtualization Cookbook for Red Hat Enterprise Linux 6.0
14.3 Monitoring Linux
Measurements can show resource consumption of the Linux guest as measured and
dispatched by the VM host. It is also possible to measure performance data from within the
Linux guest itself. To monitor Linux performance data at this level, a data gatherer process
must be running within each Linux guest you want to monitor. There are different ways of
gathering this data. The data should be gathered in the kernel. All modern Linux distributions
have been enabled for the kernel to gather performance data.
14.3.1 Monitoring Linux performance data from the kernel
To monitor Linux performance data directly from the kernel, the following items must be true:
1. The APPLMON option must be set in the user directory.
2. Applmon data monitoring must be built into the kernel.
The first requirement should be true, as the OPTION APPLMON was set for the cloner, the
golden image, and for Linux user IDs in earlier sections.
For the second requirement, refer to Chapter 13, “Writing kernel APPLDATA records”, in
Linux on System z Device Drivers, Features and Commands on Red Hat Enterprise Linux 6,
found at the following address:
http://www.ibm.com/developerworks/linux/linux390/documentation_red_hat.html
A quick description about how to use this built-in monitoring function follows.
Perform the following steps:
1. Start an SSH session to a Linux system. In this example, LINUX01 is used.
2. There are three modules that are built into the kernel but are not loaded by default. They
are named appldata_mem, appldata_os, and appldata_net_sum. You can verify that they
are not loaded by using the lsmod and grep commands:
# lsmod | grep appldata
3. There is no output, so no modules with the appldata string are loaded. Load those
modules by using the modprobe command and verify that they have been loaded:
# modprobe appldata_mem
# modprobe appldata_os
# modprobe appldata_net_sum
Now if you repeat the lsmod command, you should see the following output:
# lsmod | grep appldata
appldata_net_sum 1844 0
appldata_os 2987 0
appldata_mem 1966 0
4. The directory in the virtual /proc/ file system where the monitoring variables exist is
/proc/sys/appldata/. In this directory, there are five files:
timer Controls whether any data gathering is in effect.
interval Sets the interval, in milliseconds, that samples will be taken.
mem Controls the memory data gathering module.
os Controls the CPU data gathering module.
net_sum Controls the net data gathering module.
Commenti su questo manuale