Samurize ....The power is in your hands or in the display?
Information is vital and it is the foundation on which we as testers base our actions. Easily accessible information makes our job a bit easier. One such important piece of information is the status of test environments. This information becomes vital when there is more than one environment in use and many factors are affecting them. Any type of heads up display which gives information on the status of environments becomes extremely useful in such case.
I felt the need for such display when there were four different environments and frequent infrastructure changes were affecting stability of those environments. To make situation a bit more difficult, it was responsibility of the team to ensure that environments are always up. In the absence of any form of monitoring tool, an email or a phone call from the users was the only indication of any problem with these environments.
To solve this issue one of the developers suggested using some monitoring tools for test environments. This made me curious and I started searching on the net for some effective way of monitoring. I came across some server monitoring scripts for Mac. Those users had combined it with GeekTool on Mac to ensure display of the status on the desktop. This was a Eureka moment for me and something that would be extremely useful for us.
I wanted a similar solution for windows and came across Samurize. In case you are not familiar with this tool - Samurize is a freeware system monitoring and desktop enhancement engine for Microsoft Windows. Samurize works on config files and meters. These config files are saved as .INI files and are used to display information on the desktop.
With Samurize you can use any scripting language and since we were on windows / .NET environment - I created a simple VBScript. This script was simply sending a ‘HTTP’ request to a server URL and checking for any responses and errors. My goal was to run this script after every 1minute to check status of the servers and display it promptly.
To achieve this, I followed following steps – • I created config file in Samurize and added a meter. • I renamed this meter as ‘UAT- Server-Status’. • In the ‘source’ tab of the meter I specified the script I was executing to monitor server. Samurize was not able to locate this script and I realised that script should be present in the ‘scripts’ folder where Samurize was installed. • I set the timer to execute this script after every 1 minute.
And hurrah.. display for the status of server was now available on my desktop!!.
Once the basic monitoring was in place, I wanted to improvise it - • I wanted the same script to be executed for different servers and services by just changing the URL. • I wanted the color and text to change on failure. • I wanted some background color to be added to the text appearing on my screen. • I wanted to have meaningful message for the status instead of default text as Active Script
I found that there was an option in the meters to parametrize the script. That was easy and this parameter was then provided from the Samurize config file and I could use same script for different servers as shown below.
To achieve my second goal - I used ‘Alerts’ in Samurize. These alerts actually check the return values of the functions and then take action accordingly. I then set the return values of the function to some text and then set an alert which was triggered when the value equalled ‘SERVER DOWN’. The alert then simply changed the text to be displayed and also the color of the text. So now whenever the server was down the alert on my desktop changed color to red from green and displayed the text as ‘EMERGENY SERVER MAY BE DOWN’. I also created another alert for error condition when the connection to server could not be established.
To change background colour, I created a background object (a rectangle to be precise) from ‘Edit Graphics’ tab. I just placed all the meters on the scripts and then loaded the config file.
For my last goal, I figured out that this information was read from Meter text properties of Display tab. I changed it to something meaningful as ‘UAT Server Status : ’.
Final result of all this work was a status display for 4 servers on my desktop. This status was refreshed every minute. Here is how it looked on my desktop.
This was very much similar to the ‘Heads Up Display’ James Whittaker had talked about in GTAC 2008. Samurize is an interesting tool and Evil tester and Automated tester have also used Samurize for Heads up display.
On the theme of monitoring – we have recently launched iCheckWebsite.com to Check and monitor content of a webpage for SEO, accessibility and quality related issues. If you are working in web application testing domain, you will find iCheckWebsite very useful.
Do you like this post?
Subscribe to receive new posts via RSS or email. Join!

