CPU Monitor 0.1

I’ve been pretty quiet lately but that’s purely down to my current workload (my proper job). That’s not to say I haven’t been busy in my spare time and you should expect a flurry of releases in the near term. The first of these is a simply utility that I put together for some benchmarks I’ve been doing, its called “CPU Monitor”.

I know not an original title.... but it pretty much describes what its designed to do. I also know there are plenty of tools like these on the market but I wanted something that was trivial to set up and configure and could look at lots of machines at the same time. I intend to extend it in a number of directions.

Its primary aim is to support monitoring clusters of machines (I’ve been working on Exadata pretty much exclusively for the last 6 months) in near real time and record the stats for later analysis.

I hope to make a few changes shortly

  • Removal of clear text passwords in the config file
  • Support for Solaris, and AIX.
  • A "Mini" mode
  • A Character mode
  • A Table Mode
  • Network Monitoring
  • Further statistics collection
  • Source code for information scraping. Allowing improvements on current statistic collection or support for new OS's

You can find it here . Let me know if you find it useful.

New build of swingbench

I’ve uploaded a new build of swingbench 422 to the website, I’d recommend upgrading to this build its pretty stable and includes a lot of bug fixes. It includes some new functionality relating to specifying window sizes and positions for minibench and clusteroverview. This means its now possible to maximise the real estate used by swingbench without having to move things around after you’ve started it up. The following example illustrates what’s possible.

./coordinator -g &sleep 2./minibench -co localhost -cm -pos 0,0 -dim 500,400 -min 300 -max 800 -a -cs //node1/rac1 -g RAC1 &./minibench -co localhost -cm -pos 500,0 -dim 500,400 -min 300 -max 800 -a -cs //node2/rac2 -g RAC2 &./minibench -co localhost -cm -pos 0,400 -dim 500,400 -min 300 -max 800 -a -cs //node3/rac3 -g RAC3 &./minibench -co localhost -cm -pos 500,400 -dim 500,400 -min 300 -max 800 -a -cs //node4/rac4 -g RAC4 &sleep 2./clusteroverview -pos 1000,0 -dim 400,800

This script start swingbench in graphical mode, sleeps to let it start, then starts 4 minibenches at different postions on the screen. The new “-cm” maximises minibench’s charts. The rest of the parameters describe what database they are connecting to and what load group they are in. The script then sleeps for 2 seconds before starting clusteroverview in a specific position. You end up with some thing that looks like this

Hope you find this useful. I intend to shortly publish a new webcast on how to set up and use clusteroverview.

New Datagenerator Screencast

I’ve uploaded a datagenerator screen cast here that explains its functionality and provides a quick walkthrough. Let me know if its useful.

New Swingbench Screencast

I’ve just uploaded a new screen cast on defining your own transactions, I get asked a lot of questions about it. I’ve also updated the website to enable me to do more of them quicker. I enjoy doing them I hope they help you.

Why wont it work...

Ok... So if your not interested in Java ignore what follows.

So the problem can be summarized as follows. I have a call out to the operating system from Java to obtain the value of “vmstat” which returns a value from every “x” seconds based on the refresh rate. To do This I use a command similar to this

Runtime rt = Runtime.getRuntime();String[] comm = new String[] {"vmstat","1"};Process proc = rt.exec(comm);
I can then loop around capturing the output and parsing it. Simple.... This approach works on Linux, Mac OS, HP-UX, AIX and Solaris however it fails under Windows. It sits there and simply waits. Now this appears to be a common problem based on the number of postings on it. This article suggests a number of approaches to solve the problem. I’ve tried them all and the good news is that they appear to work for a single atomic call that returns all of its output then exits. However commands such as “vmstat/iostat/sar” etc. return output periodically based on their refresh rates and don’t seem to work at all.

There are plenty of hits in google but no one really seems to suggest a solution. Now Im sure this worked in the past and Im almost certain that I haven’t changed the code.

I’ve tried calling

java myexec cmd /c "c:\\cygwin\\bin\\ls.exe"

Which returns the first line of the directory and then exits.

java myexec cmd /c "c:\\cygwin\\bin\\ls.exe"

simply hangs.... whilst

java myexec cmd /c dir

Works fine.... So my believe its the combination of java and cygwin and the way io is redirected. If anyone has a chance to look at it.... I’ll be very grateful. Code for simple testcase below.

import java.util.*;import java.io.*;class StreamGobbler extends Thread { InputStream is; String type; StreamGobbler(InputStream is, String type) { this.is = is; this.type = type; } public void run() { try { InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line = null; while (true) { if (is.available() == 0) { try { Thread.sleep(10); } catch (InterruptedException ie) { } continue; } line = br.readLine(); if (line == null) { System.out.println("Error"); } else { System.out.println(line); } } } catch (IOException ioe) { ioe.printStackTrace(); } }}public class myexec { public static void main(String[] args) { try { String osName = System.getProperty("os.name"); System.out.println(osName); Runtime rt = Runtime.getRuntime(); Process proc = rt.exec(args); // any error message? StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR"); // any output? StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), "OUTPUT"); // kick them off errorGobbler.start(); outputGobbler.start(); // any error??? int exitVal = proc.waitFor(); System.out.println("ExitValue: " + exitVal); } catch (Throwable t) { t.printStackTrace(); } }}

Busy, Busy, Busy

Back again..... Hoping to get things moving again. Sadly I’ve been so busy at work (and at home) that I’ve had little or no time to update code. I’ve been answering a lot of questions lately so the good news is that people are still using swingbench, Thankyou.

I have come across one or two annoying features (read bugs if you wish Happy). The first of which appears to be that CPU monitoring on Windows (and solaris but Im fixing this) appears to be broken. Previously I had this working in conjunction with Cygwin but even this is now broken. Windows appears to process a piece of code (used for calling out) differently than any other platform. I’ll post some examples shortly so the Java heads amongst you can figure it out and I can get it working again. I can’t promise anything other than my gratitude.

I’ve also started to twitter (very occasionally) but for those that want to follow me you can do it here...

For those on a Mac and are looking for an alternative iWeb... try out RapidWeaver. Its getting better every release. Also use the Stacks plugin... it rounds it off brilliantly.

Back shortly with that darn Java problem....

New Comments Page

I’ve updated the comments page to add a little more security. I was being overrun by spam and so took advantage of the RapdWeaver’s plugin “FormLoom” to try and stop it. It also allows me to support attachment uploads which is a big improvement. Let me know what you think.

I’ll also be updating the website and adding some new screen casts.

Happy New Year... and a fix to datagenerator

Sorry for the delay... My DSL router has been bust for the last week and so Im behind in everything.

So first things first.... Happy new year.

Second I’ve uploaded a new build of datagenerator it appears that I had a broken link in the last build. This new version fixes a few minor bugs with dates. You can find it in the usual place here

Thirdly stick with me over the coming months I’ve got a big workload (my proper job) on at present and Im going to have to squeeze everything else in when I can. So this means delays in bug fixes and doc. Sorry.