212 lines
6.3 KiB
XML
212 lines
6.3 KiB
XML
<?xml version="1.0" ?>
|
|
<!DOCTYPE vhostmd SYSTEM "vhostmd.dtd">
|
|
|
|
<!--
|
|
|
|
Configuration file for virtual host metrics daemon (vhostmd).
|
|
|
|
A better, less noisy, more minimal configuration file
|
|
which doesn't depend on Xen.
|
|
|
|
Supported metric types are: int32, uint32, int64, uint64, real32,
|
|
real64, and string.
|
|
|
|
A metric's value is set to the output produced by executing its action.
|
|
|
|
'action' can include the special token NAME, in which case the name of
|
|
the vm currently under inspection is substituted for NAME. Only useful
|
|
within the vm element.
|
|
|
|
-->
|
|
|
|
<vhostmd>
|
|
<globals>
|
|
<disk>
|
|
<name>host-metrics-disk</name>
|
|
<path>/dev/shm/vhostmd0</path>
|
|
<!-- must be between [128 KB, 256 MB] in size -->
|
|
<size unit="k">256</size>
|
|
</disk>
|
|
<update_period>60</update_period>
|
|
<path>/bin:/sbin:/usr/bin:/usr/sbin:/usr/share/vhostmd/scripts</path>
|
|
<transport>vbd</transport>
|
|
<!-- <transport>xenstore</transport> -->
|
|
</globals>
|
|
<metrics>
|
|
<metric type="string" context="host">
|
|
<name>HostName</name>
|
|
<action>hostname</action>
|
|
</metric>
|
|
<metric type="uint64" context="host">
|
|
<name>Time</name>
|
|
<action>date +%s</action>
|
|
</metric>
|
|
<metric type="string" context="host">
|
|
<name>VirtualizationVendor</name>
|
|
<action>
|
|
rpm -qi libvirt| grep Vendor: \
|
|
| gawk '{print substr($0, index($0,$5)) }'
|
|
</action>
|
|
</metric>
|
|
<!-- SAP "CIM" -->
|
|
<metric type="string" context="host">
|
|
<name>VirtProductInfo</name>
|
|
<action>
|
|
virsh -r CONNECT version | grep API \
|
|
| gawk -F': ' '{print $2}'
|
|
</action>
|
|
</metric>
|
|
<!-- SAP "CIM" -->
|
|
<metric type="string" context="host">
|
|
<name>HostSystemInfo</name>
|
|
<action>hostname -s</action>
|
|
</metric>
|
|
<!-- SAP "CIM" -->
|
|
<metric type="uint32" context="host">
|
|
<name>NumberOfPhysicalCPUsUtilized</name>
|
|
<action>
|
|
virsh -r CONNECT nodeinfo | grep 'CPU(s):' \
|
|
| gawk -F': +' '{print $2}'
|
|
</action>
|
|
</metric>
|
|
<!-- SAP "CIM" -->
|
|
<metric type="uint64" context="host">
|
|
<name>MemoryAllocatedToVirtualServers</name>
|
|
<action>
|
|
virsh -r CONNECT nodeinfo | grep 'Memory size:' \
|
|
| gawk -F' +' '{ printf "%d\n", $3/1024 }'
|
|
</action>
|
|
</metric>
|
|
<!-- SAP "CIM" -->
|
|
<metric type="uint64" context="host">
|
|
<name>FreePhysicalMemory</name>
|
|
<action>
|
|
free|egrep -i '^[[:space:]]*(Mem:)' \
|
|
| gawk 'BEGIN { sum = 0; }
|
|
{ sum += $4; }
|
|
END { printf "%d\n", sum/1024; }'
|
|
</action>
|
|
</metric>
|
|
<metric type="uint64" context="host">
|
|
<name>UsedPhysicalMemory</name>
|
|
<action>
|
|
free|egrep -i '^[[:space:]]*(Mem:)' \
|
|
| gawk 'BEGIN { sum = 0; }
|
|
{ sum += $3; }
|
|
END { printf "%d\n", sum/1024; }'
|
|
</action>
|
|
</metric>
|
|
<!-- SAP "CIM" -->
|
|
<metric type="uint64" context="host">
|
|
<name>FreeVirtualMemory</name>
|
|
<action>
|
|
free|egrep -i '^[[:space:]]*(Mem:|Swap:)' \
|
|
| gawk 'BEGIN { sum = 0; }
|
|
{ sum += $4; }
|
|
END { printf "%d\n", sum/1024; }'
|
|
</action>
|
|
</metric>
|
|
<!-- SAP "CIM" -->
|
|
<metric type="uint64" context="host">
|
|
<name>UsedVirtualMemory</name>
|
|
<action>
|
|
free|egrep -i '^[[:space:]]*(Mem:|Swap:)' \
|
|
| gawk 'BEGIN { sum = 0; }
|
|
{ sum += $3; }
|
|
END { printf "%d\n", sum/1024; }'
|
|
</action>
|
|
</metric>
|
|
<metric type="uint64" context="host">
|
|
<name>PagedInMemory</name>
|
|
<action>
|
|
vmstat -s | gawk 'BEGIN {
|
|
cmd = "getconf PAGESIZE";
|
|
cmd | getline pagesize;
|
|
close(cmd);
|
|
}
|
|
/pages swapped in/ {
|
|
printf "%d\n", $1 / 1024 * pagesize / 1024;
|
|
}'
|
|
</action>
|
|
</metric>
|
|
<!-- SAP "CIM" -->
|
|
<metric type="uint64" context="host">
|
|
<name>PagedOutMemory</name>
|
|
<action>
|
|
vmstat -s | gawk 'BEGIN {
|
|
cmd = "getconf PAGESIZE";
|
|
cmd | getline pagesize;
|
|
close(cmd);
|
|
}
|
|
/pages swapped out/ {
|
|
printf "%d\n", $1 / 1024 * pagesize / 1024;
|
|
}'
|
|
</action>
|
|
</metric>
|
|
<metric type="group" context="host">
|
|
<name>PageRates</name>
|
|
<action>pagerate.pl</action>
|
|
<!-- SAP "CIM" -->
|
|
<variable name="PageInRate" type="uint64"/>
|
|
<variable name="PageFaultRate" type="uint64"/>
|
|
</metric>
|
|
<metric type="real64" context="host">
|
|
<name>TotalCPUTime</name>
|
|
<action>
|
|
gawk 'BEGIN {
|
|
getline < "/proc/uptime";
|
|
idle_sec = $2;
|
|
while ( 0 <= (getline < "/proc/stat") )
|
|
{
|
|
if ( "cpu" == $1 )
|
|
{
|
|
USER_HZ = $5/idle_sec;
|
|
#printf "USER_HZ = %f\n", USER_HZ | "cat 1>&2"
|
|
TotalCPUTime = ($2 + $3 + $4)/USER_HZ;
|
|
printf "%f\n", TotalCPUTime;
|
|
|
|
break;
|
|
}
|
|
}
|
|
#close("cat 1>&2");
|
|
}'
|
|
</action>
|
|
</metric>
|
|
<!-- SAP "CIM" -->
|
|
<metric type="real64" context="vm">
|
|
<name>TotalCPUTime</name>
|
|
<action>
|
|
virsh -r CONNECT dominfo NAME | sed 's/: */:/' \
|
|
| gawk -F: '/CPU time/ {print $2;}'
|
|
</action>
|
|
</metric>
|
|
<metric type="uint32" context="vm">
|
|
<name>NumberOfAssignedPhysicalCPUs</name>
|
|
<action>
|
|
virsh -r CONNECT dominfo NAME | grep 'CPU(s):' \
|
|
| gawk -F': +' '{print $2}'
|
|
</action>
|
|
</metric>
|
|
<!-- SAP "CIM" -->
|
|
<metric type="uint64" context="vm">
|
|
<name>PhysicalMemoryAllocatedToVirtualSystem</name>
|
|
<action>
|
|
virsh -r CONNECT dominfo NAME | grep 'Max memory:' \
|
|
| gawk -F' +' '{printf "%d\n", $3/1024}'
|
|
</action>
|
|
</metric>
|
|
<!-- will only be supported by Fedora -->
|
|
<!-- <metric type="uint64" context="vm">
|
|
<name>UsedMem</name>
|
|
<action>
|
|
virsh -r CONNECT dominfo NAME | grep 'Used memory:' \
|
|
| gawk -F' +' '{printf "%d\n", $3/1024}'
|
|
</action>
|
|
</metric> -->
|
|
</metrics>
|
|
</vhostmd>
|
|
<!--
|
|
vi:ts=2:sw=2:expandtab:ignorecase:nu:ruler
|
|
-->
|
|
<!-- EOF -->
|