Learnosity Logo
Learnosity Banner Image

Remote collection of vmstat log files

We've been doing a lot of load testing recently and are planning on doing a lot more, so we've developed a simple little script to make the collection of the vmstat (performance statistics) a bit quicker.

multivmstat is a php command line script which makes it easy to collect the statistics. Download the script

To run it you specify a list of servers to check:

./multivmstat server1,server2,server3 5

This will run vmstat on each of the servers with a 5 second interval between samples.

It will create the following files:

server1-vmstat.log
server2-vmstat.log
server3-vmstat.log

Note: You mush have ssh access to each machine - ideally with a certificate so that no interactive authentication is required.

Download the script

CakePHP whitespace gotcha

I've been playing around with CakePHP again (I looked at it a couple of years ago) for a small site I'm working on.

I came across this lovely error though when trying to do a redirect:

Warning (2): Cannot modify header information - headers already sent by (output started at /.../tests_controller.php:35) [CORE/cake/libs/controller/controller.php, line 587]

I couldn't see anything wrong with the code - but a quick google found the solution - I had extra whitespace in the controller which was causing the problem.

Removing the extra whitespace after the closing ?> tag fixed it up.

Update: As Danilo pointed out below - this is not a cakephp issue, but a general php one, which occurs if you try to send headers after anything has been output to the browser.

Cheers, Mark

Ubuntu Server upgrade howto

One of the nice things about Ubuntu is how easy it makes it to upgrade between versions - typically start up update-manager and it will prompt you if there is a new version available and handle all the details of the upgrade for you. I've done numerous upgrades this way and never had any issues.

However, I have a number of ubuntu servers which I manage and previously I have upgraded them by changing the /etc/apt/sources.list and then running "sudo apt-get dist-upgrade"

Today I discovered that there is an automated script to handle it - which I presume is what powers the gui version behind the scenes.

You need to make sure you have update-manager-core installed:

sudo apt-get install update-manager-core

Then you simply run do-release-upgrade

sudo do-release-upgrade

I've just upgraded two different servers from Feisty as it has recently stopped being supported. I upgraded them to Gutsy and then to Hardy which is a Long Term Supported version. The whole process took about an hour of which it took about 5 minutes of my attention to answer a few simple questions.

Who said Linux is hard :-) Cheers, Mark

Choppy sound on Twinkle Softphone on Ubuntu Linux - Solved

I just reinstalled my system with the latest Ubuntu 8.10 x64 and one of the apps I use regularly for testing and developing Asterisk applications is Twinkle, which is a great VOIP softphone.

It works great, but when I tried it in my new install the sound was all choppy, i.e. I would get every half of each second of the audio.

A bit of fiddling about with the settings and I got it solved. Posting it here so when I forget about it and run into the same problem again I'll know how to fix it.

The solutions is as simple as:

  • From the menu select Edit -> System Settings.
  • Select Audio on the left
  • Change the audio devices to use the most approriate device that is NOT "ALSA: default: Default Device" - in my case it was "ALSA: plughw:0,0: HDA Intel (AD193x Analog)"

I do like the very friendly naming scheme for devices :-) Hope it helps, Mark