rpms/vhostmd/devel vhostmd.conf,1.6,1.7 vhostmd.spec,1.13,1.14

Richard W.M. Jones rjones at fedoraproject.org
Tue Jul 6 16:39:42 UTC 2010


Author: rjones

Update of /cvs/pkgs/rpms/vhostmd/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv14318

Modified Files:
	vhostmd.conf vhostmd.spec 
Log Message:
Updated vhostmd.conf from Dr. Joachim Schneider at SAP.


Index: vhostmd.conf
===================================================================
RCS file: /cvs/pkgs/rpms/vhostmd/devel/vhostmd.conf,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -p -r1.6 -r1.7
--- vhostmd.conf	27 Apr 2010 10:39:00 -0000	1.6
+++ vhostmd.conf	6 Jul 2010 16:39:41 -0000	1.7
@@ -19,6 +19,59 @@ within the vm element.
 
 -->
 
+
+<!--     1         2         3         4         5         6         -->
+<!-- 678901234567890123456789012345678901234567890123456789012345678 -->
+
+
+<!--
+We sometimes use the following awk form to filter the output of the
+virsh command (mostly `virsh -r CONNECT dominfo NAME' - use
+`virsh -r dominfo <dom id>' to test on the commandline) into a standard
+format like
+
+  ID:6
+  NAME:ls3055v0
+  UUID:955c3b65-d013-547f-321b-9fea65439c40
+  OS_TYPE:hvm
+  STATE:running
+  CPU(S):4
+  CPU_TIME:433016.4:S
+  MAX_MEMORY:20000000:KB
+  USED_MEMORY:16384000:KB
+  AUTOSTART:disable
+
+We do this to extract numbers out of physical quantities in a reliable
+way.
+-->
+<!--
+          |awk -F ':' '
+          function mkvarnam(s)  { # UPPER_CASE_UNDERSCORE
+            sub("(^[[:space:]]+|[[:space:]]+$)", "", s);  # trim
+            gsub("[[:space:]]+", "_", s); s = toupper(s);
+            return s;
+          }
+          function filt_phys(s, sep,    num, unit) {  # 42.0 KM
+            sub("(^[[:space:]]+|[[:space:]]+$)", "", s);  # trim
+            if ( s ~ /^[0-9]*\.?[0-9]+[[:space:]]*[[:alpha:]]+$/ )
+            {
+              num = s; unit = s;
+              sub("[[:space:]]*[[:alpha:]]+$", "", num);
+              sub("^[0-9]*[.]?[0-9]+[[:space:]]*", "", unit);
+              return num sep toupper(unit);
+            }
+            else
+            {
+              return s;
+            }
+          }
+          /:/ {
+            d1    = substr($0, 1, index($0, ":") - 1);
+            rest  = substr($0, index($0, ":") + 1);
+            printf("%s:%s\n", mkvarnam(d1), filt_phys(rest, ":"));
+          }'                                  \
+-->
+
 <vhostmd>
   <globals>
     <disk>
@@ -45,15 +98,40 @@ within the vm element.
       <name>VirtualizationVendor</name>
       <action>
         rpm -qi libvirt| grep Vendor:   \
-          | gawk '{print substr($0, index($0,$5)) }'
+          | awk '{ print substr($0, index($0, $5)); }' | sort -u
       </action>
     </metric>
     <!-- SAP "CIM"  -->
     <metric type="string" context="host">
       <name>VirtProductInfo</name>
       <action>
-        virsh -r CONNECT version | grep API   \
-          | gawk -F': ' '{print $2}'
+        virsh -r CONNECT version        \
+          |awk -F ':' '
+          function mkvarnam(s)  { # UPPER_CASE_UNDERSCORE
+            sub("(^[[:space:]]+|[[:space:]]+$)", "", s);  # trim
+            gsub("[[:space:]]+", "_", s); s = toupper(s);
+            return s;
+          }
+          function filt_phys(s, sep,    num, unit) {  # 42.0 KM
+            sub("(^[[:space:]]+|[[:space:]]+$)", "", s);  # trim
+            if ( s ~ /^[0-9]*\.?[0-9]+[[:space:]]*[[:alpha:]]+$/ )
+            {
+              num = s; unit = s;
+              sub("[[:space:]]*[[:alpha:]]+$", "", num);
+              sub("^[0-9]*[.]?[0-9]+[[:space:]]*", "", unit);
+              return num sep toupper(unit);
+            }
+            else
+            {
+              return s;
+            }
+          }
+          /:/ {
+            d1    = substr($0, 1, index($0, ":") - 1);
+            rest  = substr($0, index($0, ":") + 1);
+            printf("%s:%s\n", mkvarnam(d1), filt_phys(rest, ":"));
+          }'                                  \
+          | awk -F: '$1 == "USING_API" { print $2; }'
       </action>
     </metric>
     <!-- SAP "CIM"  -->
@@ -61,20 +139,56 @@ within the vm element.
       <name>HostSystemInfo</name>
       <action>hostname -s</action>
     </metric>
-    <!-- SAP "CIM"  -->
+    <!-- SAP "XCIM" -->
     <metric type="uint32" context="host">
-      <name>NumberOfPhysicalCPUsUtilized</name>
-      <action>
-        virsh -r CONNECT nodeinfo | grep 'CPU(s):'    \
-          | gawk -F': +' '{print $2}'
+      <name>NumberOfPhysicalCPUs</name>
+      <!-- physical CPUs usable by the virtual machines -->
+      <!-- SAP "CIM" uses "NumberOfPhysicalCPUsUtilized"  -->
+      <!-- which means something different, i.e.          -->
+      <!--  "physical CPUs used by the virtual machines"  -->
+      <!-- but may be calculated (on client side) by      -->
+      <!-- Delta TotalCPUTime / Delta ElapsedTime         -->
+      <action>
+        virsh -r CONNECT nodeinfo       \
+          |awk -F ':' '
+          function mkvarnam(s)  { # UPPER_CASE_UNDERSCORE
+            sub("(^[[:space:]]+|[[:space:]]+$)", "", s);  # trim
+            gsub("[[:space:]]+", "_", s); s = toupper(s);
+            return s;
+          }
+          function filt_phys(s, sep,    num, unit) {  # 42.0 KM
+            sub("(^[[:space:]]+|[[:space:]]+$)", "", s);  # trim
+            if ( s ~ /^[0-9]*\.?[0-9]+[[:space:]]*[[:alpha:]]+$/ )
+            {
+              num = s; unit = s;
+              sub("[[:space:]]*[[:alpha:]]+$", "", num);
+              sub("^[0-9]*[.]?[0-9]+[[:space:]]*", "", unit);
+              return num sep toupper(unit);
+            }
+            else
+            {
+              return s;
+            }
+          }
+          /:/ {
+            d1    = substr($0, 1, index($0, ":") - 1);
+            rest  = substr($0, index($0, ":") + 1);
+            printf("%s:%s\n", mkvarnam(d1), filt_phys(rest, ":"));
+          }'                                  \
+          | awk -F: '$1 == "CPU(S)" { print $2; }'
       </action>
     </metric>
     <!-- SAP "CIM"  -->
     <metric type="uint64" context="host">
       <name>MemoryAllocatedToVirtualServers</name>
+      <!-- physical memory used by the virtual machines,      -->
+      <!-- (_not_ physical memory usable by the virtual       -->
+      <!-- machines)                                          -->
       <action>
-        virsh -r CONNECT nodeinfo | grep 'Memory size:'   \
-          | gawk -F' +' '{ printf "%d\n", $3/1024 }'
+        free|egrep -i '^[[:space:]]*(Mem:)'   \
+          | awk 'BEGIN { sum = 0; }
+              { sum += $3; }
+              END { printf "%d\n", sum/1024; }'
       </action>
     </metric>
     <!-- SAP "CIM"  -->
@@ -82,26 +196,17 @@ within the vm element.
       <name>FreePhysicalMemory</name>
       <action>
         free|egrep -i '^[[:space:]]*(Mem:)'   \
-          | gawk 'BEGIN { sum = 0; }
+          | awk '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; }
+          | awk 'BEGIN { sum = 0; }
               { sum += $4; }
               END { printf "%d\n", sum/1024; }'
       </action>
@@ -111,15 +216,16 @@ within the vm element.
       <name>UsedVirtualMemory</name>
       <action>
         free|egrep -i '^[[:space:]]*(Mem:|Swap:)'   \
-          | gawk 'BEGIN { sum = 0; }
+          | awk 'BEGIN { sum = 0; }
               { sum += $3; }
               END { printf "%d\n", sum/1024; }'
       </action>
     </metric>
+    <!-- SAP "XCIM" -->
     <metric type="uint64" context="host">
       <name>PagedInMemory</name>
       <action>
-        vmstat -s | gawk 'BEGIN {
+        vmstat -s | awk 'BEGIN {
                         cmd = "getconf PAGESIZE";
                         cmd | getline pagesize;
                         close(cmd);
@@ -133,7 +239,7 @@ within the vm element.
     <metric type="uint64" context="host">
       <name>PagedOutMemory</name>
       <action>
-        vmstat -s | gawk 'BEGIN {
+        vmstat -s | awk 'BEGIN {
                         cmd = "getconf PAGESIZE";
                         cmd | getline pagesize;
                         close(cmd);
@@ -143,31 +249,40 @@ within the vm element.
                       }'
       </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>
+    <!-- SAP "CIM"  -->
     <metric type="real64" context="host">
       <name>TotalCPUTime</name>
       <action>
-        gawk 'BEGIN {
-          getline &lt; "/proc/uptime";
-          idle_sec  = $2;
-          while ( 0 &lt;= (getline &lt; "/proc/stat") )
+        awk '
+        function user_hz(   hz)
+        {
+          cmd = "getconf CLK_TCK";
+          cmd | getline;
+          hz  = $1;
+          close(cmd);
+
+          return hz;
+        }
+
+        BEGIN {
+          USER_HZ      = user_hz();
+          TotalCPUTime = 0;
+
+          while ( 0 &lt; ( getline &lt; "/proc/stat" ) )
           {
             if ( "cpu" == $1 )
             {
-              USER_HZ = $5/idle_sec;
-              #printf "USER_HZ = %f\n", USER_HZ | "cat 1&gt;&amp;2"
-              TotalCPUTime = ($2 + $3 + $4)/USER_HZ;
-              printf "%f\n", TotalCPUTime;
+              TotalCPUTime = $2 + $3 + $4;
 
               break;
             }
           }
+          close("/proc/stat");
+
+          #printf "USER_HZ = %d\n", USER_HZ  | "cat 1&gt;&amp;2";
+          TotalCPUTime /= USER_HZ;
+          printf "%f\n", TotalCPUTime;
+
           #close("cat 1&gt;&amp;2");
         }'
       </action>
@@ -176,33 +291,134 @@ within the vm element.
     <metric type="real64" context="vm">
       <name>TotalCPUTime</name>
       <action>
-        virsh -r CONNECT dominfo NAME | sed 's/: */:/'    \
-          | gawk -F: '/CPU time/ {print $2;}'
+        virsh -r CONNECT dominfo NAME   \
+          |awk -F ':' '
+          function mkvarnam(s)  { # UPPER_CASE_UNDERSCORE
+            sub("(^[[:space:]]+|[[:space:]]+$)", "", s);  # trim
+            gsub("[[:space:]]+", "_", s); s = toupper(s);
+            return s;
+          }
+          function filt_phys(s, sep,    num, unit) {  # 42.0 KM
+            sub("(^[[:space:]]+|[[:space:]]+$)", "", s);  # trim
+            if ( s ~ /^[0-9]*\.?[0-9]+[[:space:]]*[[:alpha:]]+$/ )
+            {
+              num = s; unit = s;
+              sub("[[:space:]]*[[:alpha:]]+$", "", num);
+              sub("^[0-9]*[.]?[0-9]+[[:space:]]*", "", unit);
+              return num sep toupper(unit);
+            }
+            else
+            {
+              return s;
+            }
+          }
+          /:/ {
+            d1    = substr($0, 1, index($0, ":") - 1);
+            rest  = substr($0, index($0, ":") + 1);
+            printf("%s:%s\n", mkvarnam(d1), filt_phys(rest, ":"));
+          }'                                  \
+          | awk -F: '$1 == "CPU_TIME" { print $2; }'
       </action>
     </metric>
+    <!-- SAP "CIM"  -->
     <metric type="uint32" context="vm">
-      <name>NumberOfAssignedPhysicalCPUs</name>
+      <name>ResourceProcessorLimit</name>
       <action>
-        virsh -r CONNECT dominfo NAME | grep 'CPU(s):'    \
-          | gawk -F': +' '{print $2}'
+        virsh -r CONNECT dominfo NAME   \
+          |awk -F ':' '
+          function mkvarnam(s)  { # UPPER_CASE_UNDERSCORE
+            sub("(^[[:space:]]+|[[:space:]]+$)", "", s);  # trim
+            gsub("[[:space:]]+", "_", s); s = toupper(s);
+            return s;
+          }
+          function filt_phys(s, sep,    num, unit) {  # 42.0 KM
+            sub("(^[[:space:]]+|[[:space:]]+$)", "", s);  # trim
+            if ( s ~ /^[0-9]*\.?[0-9]+[[:space:]]*[[:alpha:]]+$/ )
+            {
+              num = s; unit = s;
+              sub("[[:space:]]*[[:alpha:]]+$", "", num);
+              sub("^[0-9]*[.]?[0-9]+[[:space:]]*", "", unit);
+              return num sep toupper(unit);
+            }
+            else
+            {
+              return s;
+            }
+          }
+          /:/ {
+            d1    = substr($0, 1, index($0, ":") - 1);
+            rest  = substr($0, index($0, ":") + 1);
+            printf("%s:%s\n", mkvarnam(d1), filt_phys(rest, ":"));
+          }'                                  \
+          | awk -F: '$1 == "CPU(S)" { print $2; }'
       </action>
     </metric>
     <!-- SAP "CIM"  -->
     <metric type="uint64" context="vm">
-      <name>PhysicalMemoryAllocatedToVirtualSystem</name>
+      <name>ResourceMemoryLimit</name>
       <action>
-        virsh -r CONNECT dominfo NAME | grep 'Max memory:'    \
-          | gawk -F' +' '{printf "%d\n", $3/1024}'
+        virsh -r CONNECT dominfo NAME   \
+          |awk -F ':' '
+          function mkvarnam(s)  { # UPPER_CASE_UNDERSCORE
+            sub("(^[[:space:]]+|[[:space:]]+$)", "", s);  # trim
+            gsub("[[:space:]]+", "_", s); s = toupper(s);
+            return s;
+          }
+          function filt_phys(s, sep,    num, unit) {  # 42.0 KM
+            sub("(^[[:space:]]+|[[:space:]]+$)", "", s);  # trim
+            if ( s ~ /^[0-9]*\.?[0-9]+[[:space:]]*[[:alpha:]]+$/ )
+            {
+              num = s; unit = s;
+              sub("[[:space:]]*[[:alpha:]]+$", "", num);
+              sub("^[0-9]*[.]?[0-9]+[[:space:]]*", "", unit);
+              return num sep toupper(unit);
+            }
+            else
+            {
+              return s;
+            }
+          }
+          /:/ {
+            d1    = substr($0, 1, index($0, ":") - 1);
+            rest  = substr($0, index($0, ":") + 1);
+            printf("%s:%s\n", mkvarnam(d1), filt_phys(rest, ":"));
+          }'                                  \
+          | awk -F: '$1 == "MAX_MEMORY" { print int($2/1024); }'
       </action>
     </metric>
-    <!-- will only be supported by Fedora -->
-    <!-- <metric type="uint64" context="vm">
-      <name>UsedMem</name>
+    <!-- SAP "CIM"  -->
+    <metric type="uint64" context="vm">
+      <name>PhysicalMemoryAllocatedToVirtualSystem</name>
       <action>
-        virsh -r CONNECT dominfo NAME | grep 'Used memory:'   \
-          | gawk -F' +' '{printf "%d\n", $3/1024}'
+        virsh -r CONNECT dominfo NAME   \
+          |awk -F ':' '
+          function mkvarnam(s)  { # UPPER_CASE_UNDERSCORE
+            sub("(^[[:space:]]+|[[:space:]]+$)", "", s);  # trim
+            gsub("[[:space:]]+", "_", s); s = toupper(s);
+            return s;
+          }
+          function filt_phys(s, sep,    num, unit) {  # 42.0 KM
+            sub("(^[[:space:]]+|[[:space:]]+$)", "", s);  # trim
+            if ( s ~ /^[0-9]*\.?[0-9]+[[:space:]]*[[:alpha:]]+$/ )
+            {
+              num = s; unit = s;
+              sub("[[:space:]]*[[:alpha:]]+$", "", num);
+              sub("^[0-9]*[.]?[0-9]+[[:space:]]*", "", unit);
+              return num sep toupper(unit);
+            }
+            else
+            {
+              return s;
+            }
+          }
+          /:/ {
+            d1    = substr($0, 1, index($0, ":") - 1);
+            rest  = substr($0, index($0, ":") + 1);
+            printf("%s:%s\n", mkvarnam(d1), filt_phys(rest, ":"));
+          }'                                  \
+          | awk -F: '$1 == "USED_MEMORY" { print int($2/1024); }'
       </action>
-    </metric> -->
+    </metric>
   </metrics>
 </vhostmd>
 <!--


Index: vhostmd.spec
===================================================================
RCS file: /cvs/pkgs/rpms/vhostmd/devel/vhostmd.spec,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -p -r1.13 -r1.14
--- vhostmd.spec	27 Apr 2010 10:39:00 -0000	1.13
+++ vhostmd.spec	6 Jul 2010 16:39:42 -0000	1.14
@@ -8,7 +8,7 @@
 Summary:       Virtualization host metrics daemon
 Name:          vhostmd
 Version:       0.4
-Release:       6%{?dist}
+Release:       7%{?dist}
 License:       GPLv2+
 Group:         System Environment/Daemons
 BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root
@@ -192,6 +192,9 @@ exit 0
 
 
 %changelog
+* Tue Jul  6 2010 Richard W.M. Jones <rjones at redhat.com> - 0.4-7
+- Updated vhostmd.conf from Dr. Joachim Schneider at SAP.
+
 * Tue Apr 27 2010 Richard W.M. Jones <rjones at redhat.com> - 0.4-6
 - Updated vhostmd.conf file which enables TotalCPUTime metric.
 



More information about the scm-commits mailing list