Archive for September, 2005

kdb+ Server Monitor

Friday, September 16th, 2005

It’s a common requirement to have server monitoring in an enterprise system. Most companies already have their own favourite tools for monitoring system resources (memory, cpu, disk, etc) and they are likely to have log file scanners and also process monitors too. So what’s the best way to monitor kdb+?

A standard process monitor can check that the kdb+ instance is present, and the log file scanners can check for error messages in the kdb+ log file.

This is fine, but supposing that you dont have those tools in place, or they are too much hassle to configure. You could have a monitoring process that checks that the server’s port is listening, and by leaving the connection open you can detect when the server process goes down, or the system becomes unreachable via the network. It’s probably best to do this in q itself, but if you don’t have an enterprise license to run it anywhere you can get by with Java, as the following code shows

import java.net.Socket;
import java.io.IOException;
public class Monitor {
public static void main(String []args) {
try{new Socket(args[0],Integer.parseInt(args[1])).getInputStream().read();}
catch( IOException e) {System.err.println(\”Server down/disconnected\”);}
}
}

Some people will look at the code and shake their heads. Others will look at it and accept that it does nothing more than is needed. Too many “programmers” these days over engineer a solution and clutter their code with drivel.

The above script could be used in combination with a log file monitor or extended to send an email or trigger a pager when a kdb+ process is no longer running.

Studio License Expiry

Saturday, September 10th, 2005

Some EAP users whose licenses expired today will have noticed that there is no automated way to update the license. This can be done manually however -

Studio stores config and license info in the users home directory under a directory called .studioforkdb

To locate this on windows, open a command prompt, and type

echo %USERPROFILE%

There should be a .studioforkdb sub-directory. Within that sub directory you can find the license.txt file. If you download

license.txt

and copy it to

%USERPROFILE%/.studioforkdb/license.txt

then studio should continue running until Sept 2005 under the EAP license conditions. This should allow enough enough time to locate and source an alternate product.