rpms/vhostmd/devel vhostmd.conf,1.4,1.5 vhostmd.spec,1.8,1.9

Richard W.M. Jones rjones at fedoraproject.org
Thu Dec 10 17:27:56 UTC 2009


Author: rjones

Update of /cvs/pkgs/rpms/vhostmd/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv10540

Modified Files:
	vhostmd.conf vhostmd.spec 
Log Message:
Fix the PagedOutMemory and PagedInMemory stats to report MB instead of pages (fixes supplied by Joachim Schneider).


Index: vhostmd.conf
===================================================================
RCS file: /cvs/pkgs/rpms/vhostmd/devel/vhostmd.conf,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -r1.4 -r1.5
--- vhostmd.conf	17 Nov 2009 11:16:24 -0000	1.4
+++ vhostmd.conf	10 Dec 2009 17:27:55 -0000	1.5
@@ -43,12 +43,18 @@ within the vm element.
     </metric>
     <metric type="string" context="host">
       <name>VirtualizationVendor</name>
-      <action>rpm -qi libvirt| grep Vendor: |awk '{print substr($0, index($0,$5)) }'</action>
+      <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>
+      <action>
+        virsh -r CONNECT version | grep API   \
+          | gawk -F': ' '{print $2}'
+      </action>
     </metric>
     <!-- SAP "CIM"  -->
     <metric type="string" context="host">
@@ -58,61 +64,84 @@ within the vm element.
     <!-- SAP "CIM"  -->
     <metric type="uint32" context="host">
       <name>NumberOfPhysicalCPUsUtilized</name>
-      <action>virsh -r CONNECT nodeinfo | grep 'CPU(s):' | gawk -F': +' '{print $2}'</action>
+      <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>
+      <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:)'                          \
-        |awk 'BEGIN { sum = 0; }
+        free|egrep -i '^[[:space:]]*(Mem:)'   \
+          | gawk 'BEGIN { sum = 0; }
               { sum += $4; }
-              END { printf "%10d\n", sum/1024; }'
+              END { printf "%d\n", sum/1024; }'
       </action>
     </metric>
     <metric type="uint64" context="host">
       <name>UsedPhysicalMemory</name>
       <action>
-        free|egrep -i '^[[:space:]]*(Mem:)'                          \
-        |awk 'BEGIN { sum = 0; }
+        free|egrep -i '^[[:space:]]*(Mem:)'   \
+          | gawk 'BEGIN { sum = 0; }
               { sum += $3; }
-              END { printf "%10d\n", sum/1024; }'
+              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:)'                    \
-        |awk 'BEGIN { sum = 0; }
+        free|egrep -i '^[[:space:]]*(Mem:|Swap:)'   \
+          | gawk 'BEGIN { sum = 0; }
               { sum += $4; }
-              END { printf "%10d\n", sum/1024; }'
+              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:)'                    \
-        |awk 'BEGIN { sum = 0; }
+        free|egrep -i '^[[:space:]]*(Mem:|Swap:)'   \
+          | gawk 'BEGIN { sum = 0; }
               { sum += $3; }
-              END { printf "%10d\n", sum/1024; }'
+              END { printf "%d\n", sum/1024; }'
       </action>
     </metric>
     <metric type="uint64" context="host">
       <name>PagedInMemory</name>
-      <action>echo "$((`vmstat -s | gawk '/pages paged in/ {print $1}'` / 1024))"</action>
+      <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">
-      <!-- TODO:  CHECK -->
       <name>PagedOutMemory</name>
-      <action>echo "$((`vmstat -s | gawk '/pages paged out/ {print $1}'` / 1024))"</action>
+      <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>
@@ -123,32 +152,45 @@ within the vm element.
     </metric>
     <!--<metric type="real64" context="host">
       <name>TotalCPUTime</name>
-      <action>virsh -r CONNECT dominfo 0 | sed 's/: */:/' | \
-                  gawk -F: '/CPU time/ {print $2;}'</action>
+      <action>
+        virsh -r CONNECT dominfo 0 | sed 's/: */:/'   \
+          | gawk -F: '/CPU time/ {print $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>
+      <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>
+      <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>
+      <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>
+      <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:
+  vi:ts=2:sw=2:expandtab:ignorecase:nu:ruler
 -->
 <!-- EOF -->


Index: vhostmd.spec
===================================================================
RCS file: /cvs/pkgs/rpms/vhostmd/devel/vhostmd.spec,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -p -r1.8 -r1.9
--- vhostmd.spec	9 Dec 2009 15:33:09 -0000	1.8
+++ vhostmd.spec	10 Dec 2009 17:27:55 -0000	1.9
@@ -8,7 +8,7 @@
 Summary:       Virtualization host metrics daemon
 Name:          vhostmd
 Version:       0.4
-Release:       1%{?dist}
+Release:       2%{?dist}
 License:       GPLv2+
 Group:         System Environment/Daemons
 BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root
@@ -183,6 +183,10 @@ exit 0
 
 
 %changelog
+* Thu Dec 10 2009 Richard W.M. Jones <rjones at redhat.com> - 0.4-2
+- Fix the PagedOutMemory and PagedInMemory stats to report MB instead
+  of pages (fixes supplied by Joachim Schneider).
+
 * Wed Dec  9 2009 Richard W.M. Jones <rjones at redhat.com> - 0.4-1
 - vhostmd didn't chdir ("/") when daemonizing.  Fixed in this 0.4 release.
 




More information about the scm-commits mailing list