[hobbit] vmstat graphing with CPU io wait

Henrik Stoerner henrik at hswn.dk
Wed Jan 26 18:15:14 CET 2005


On Wed, Jan 26, 2005 at 11:47:30AM -0500, Tom Georgoulias wrote:

> So, my first question:  I was looking at the patch and wasn't sure the 
> array order is correct.  (I'm not a programmer by any means, so if I'm 
> wrong just say so).
> 
> on RHEL3, vmstat's CPU info columns are in this order:
> 
> 
> user -12th
> system - 13th
> IO wait - 14th
> idle - 15th

Argh! They swapped the order of the IO wait and idle counters!

Well, the simple way of fixing that is to just switch them around
in hobbitgraph.cfg. But cpu_idl is used in a lot of graphs, so that 
does get rather messy.

So it's probably better to define RHEL3 as a new OS type, and
setup it's own table for mapping the numbers to the RRD data.

Patch - on top of the previous one - attached. It compiles, but
I haven't tested it. It assumes your vmstat data sends in
"rhel3" as the name of the OS.


Henrik
-------------- next part --------------
--- lib/misc.c	2005/01/20 22:02:23	1.23
+++ lib/misc.c	2005/01/26 17:11:14
@@ -43,6 +43,7 @@
 	else if (strcmp(osname, "debian3") == 0)     result = OS_DEBIAN3;
 	else if (strcmp(osname, "debian") == 0)      result = OS_DEBIAN;
 	else if (strcmp(osname, "linux") == 0)       result = OS_LINUX;
+	else if (strcmp(osname, "rhel3") == 0)       result = OS_RHEL3;
 	else if (strcmp(osname, "snmp") == 0)        result = OS_SNMP;
 	else if (strcmp(osname, "snmpnetstat") == 0) result = OS_SNMP;
 
--- lib/misc.h	2005/01/17 23:13:41	1.10
+++ lib/misc.h	2005/01/26 17:11:36
@@ -13,7 +13,7 @@
 
 #include <stdio.h>
 
-enum ostype_t { OS_UNKNOWN, OS_SOLARIS, OS_OSF, OS_FREEBSD, OS_LINUX, OS_REDHAT, OS_DEBIAN3, OS_DEBIAN, OS_HPUX, OS_AIX, OS_SCO, OS_SNMP, OS_WIN32 } ;
+enum ostype_t { OS_UNKNOWN, OS_SOLARIS, OS_OSF, OS_FREEBSD, OS_LINUX, OS_REDHAT, OS_DEBIAN3, OS_DEBIAN, OS_HPUX, OS_AIX, OS_SCO, OS_SNMP, OS_WIN32, OS_RHEL3 } ;
 
 extern enum ostype_t get_ostype(char *osname);
 extern int hexvalue(unsigned char c);
--- hobbitd/larrd/do_vmstat.c	2005/01/25 17:53:45	1.9
+++ hobbitd/larrd/do_vmstat.c	2005/01/26 17:10:26
@@ -119,6 +119,31 @@
 	{ -1, NULL }
 };
 
+/*
+ * This one is for Red Hat Enterprise Linux 3. Identical to the "linux" layout,
+ * except Red Hat for some reason decided to swap the cpu_wait and cpu_idle columns.
+ */
+static vmstat_layout_t vmstat_rhel3_layout[] = {
+	{ 0, "cpu_r" },
+	{ 1, "cpu_b" },
+	{ -1, "cpu_w" },
+	{ 2, "mem_swpd" },
+	{ 3, "mem_free" },
+	{ 4, "mem_buff" },
+	{ 5, "mem_cach" },
+	{ 6, "mem_si" },
+	{ 7, "mem_so" },
+	{ 8, "dsk_bi" },
+	{ 9, "dsk_bo" },
+	{ 10, "cpu_int" },
+	{ 11, "cpu_csw" },
+	{ 12, "cpu_usr" },
+	{ 13, "cpu_sys" },
+	{ 14, "cpu_wait" },
+	{ 15, "cpu_idl"  },
+	{ -1, NULL }
+};
+
 /* This one is for Debian 3.0 (Woody), and possibly others with a Linux 2.2 kernel */
 static vmstat_layout_t vmstat_debian3_layout[] = {
 	{ 0, "cpu_r" },
@@ -218,8 +243,9 @@
 	  case OS_LINUX:
 	  case OS_REDHAT:
 	  case OS_DEBIAN:
-		layout = vmstat_linux_layout;
-		break;
+		layout = vmstat_linux_layout; break;
+	  case OS_RHEL3:
+		layout = vmstat_rhel3_layout; break;
 	  case OS_DEBIAN3:
 		layout = vmstat_debian3_layout; break;
 	  case OS_FREEBSD:


More information about the Xymon mailing list