[Xymon] Patch: 2 extra counters CPU counter for AIX

Stef Coene stef.coene at docum.org
Thu Feb 11 09:47:23 CET 2016


Hi,

I have some patches that I apply when a new xymon version comes out.
Maybe some of them are handy and can be included by default.


All new IBM Power CPU's has 2 extra counters for CPU: Physical CPU used and 
entitled capacity used (in %).
This patch will add them to the vmstat.rrd.
BUT this will change the rrd and add 2 data sources. So this means that 
rrdtool tune must be used to manually add the 2 new data sources to the rrd!


Relevant graph definitions:
[vmstat-ec]
   TITLE Used Entitled CPU Capacity
   YAXIS ec %
   -b 1000
   DEF:ect=vmstat.rrd:cpu_ec:AVERAGE
   CDEF:ec=ect,10,/
   LINE2:ec#00CC00
   GPRINT:ec:LAST:ec \: %5.1lf%s%% (cur)
   GPRINT:ec:MAX: \: %5.1lf%s%% (max)
   GPRINT:ec:MIN: \: %5.1lf%s%% (min)
   GPRINT:ec:AVERAGE: \: %5.1lf%s%% (avg)\n

[vmstat-ec-multi]
   FNPATTERN vmstat.rrd
   TITLE Used Entitled CPU Capacity
   YAXIS ec %
   -b 1000
   DEF:ect at RRDIDX@=@RRDFN@:cpu_ec:AVERAGE
   CDEF:ec at RRDIDX@=ect at RRDIDX@,10,/
   LINE1:ec at RRDIDX@#@COLOR@:@RRDPARAM@
   GPRINT:ec at RRDIDX@:LAST:ec \: %5.1lf%s (cur)
   GPRINT:ec at RRDIDX@:MAX: \: %5.1lf%s (max)
   GPRINT:ec at RRDIDX@:MIN: \: %5.1lf%s (min)
   GPRINT:ec at RRDIDX@:AVERAGE: \: %5.1lf%s (avg)\n

[vmstat-pc]
   TITLE Used Physical CPU
   YAXIS pc (100 = 1 CPU)
   -b 1000
   DEF:pc=vmstat.rrd:cpu_pc:AVERAGE
   LINE2:pc#00CC00
   GPRINT:pc:LAST:pc \: %5.1lf%s (cur)
   GPRINT:pc:MAX: \: %5.1lf%s (max)
   GPRINT:pc:MIN: \: %5.1lf%s (min)
   GPRINT:pc:AVERAGE: \: %5.1lf%s (avg)\n
   
[vmstat-pc-multi]
   FNPATTERN vmstat.rrd
   TITLE Used Physical CPU (Stacked)
   YAXIS pc (100 = 1 CPU)
   -b 1000
   DEF:pc at RRDIDX@=@RRDFN@:cpu_pc:AVERAGE
   LINE1:pc at RRDIDX@#@COLOR@:@RRDPARAM@:STACK
   GPRINT:pc at RRDIDX@:LAST:pc \: %5.1lf%s (cur)
   GPRINT:pc at RRDIDX@:MAX: \: %5.1lf%s (max)
   GPRINT:pc at RRDIDX@:MIN: \: %5.1lf%s (min)
   GPRINT:pc at RRDIDX@:AVERAGE: \: %5.1lf%s (avg)\n


Stef
-------------- next part --------------
diff -Naur xymon-4.3.25.ori/xymond/rrd/do_vmstat.c xymon-4.3.25/xymond/rrd/do_vmstat.c
--- xymon-4.3.25.ori/xymond/rrd/do_vmstat.c  2014-01-07 22:52:08.000000000 +0100
+++ xymon-4.3.25/xymond/rrd/do_vmstat.c   2016-02-11 08:42:14.241435824 +0100
@@ -76,6 +76,8 @@
   { 14, "cpu_sys" },
   { 15, "cpu_idl" },
   { 16, "cpu_wait" },
+        { 17, "cpu_pc" },
+        { 18, "cpu_ec" },
   { -1, NULL }
 };

@@ -370,6 +372,17 @@
   p = strchr(datapart, '\n'); if (p) *p = '\0';
   p = strtok(datapart, " "); datacount = 0;
   while (p && (datacount < MAX_VMSTAT_VALUES)) {
+ 
+         /* Removing . and , from the numbers */
+         char *p1;
+         while ( (p1 = strchr(p,'.')) != NULL ) {
+            strcpy (p1, p1+1) ;
+         }
+         char *p2;
+         while ( (p2 = strchr(p,',')) != NULL ) {
+            strcpy (p2, p2+1) ;
+         }
+ 
      values[datacount++] = atoi(p);
      p = strtok(NULL, " ");
   }


More information about the Xymon mailing list