Big Brother

Big Brother, bb4.org, monitors computers and peripherals with a mixture of C based programs, shell scripts, Perl, HTML, and PHP. The PHP bit is the focus of this page. UpdateBig brother used to be a low cost way to monitor your computing infrastructure, especially Web sites and Web servers. Now all the useful features are in a commercial version and the free version is almost dead. Look at Web site monitoring for modern alternatives.

Download Big Brother from bb4.org.

Web sites

Web sites are built on layer after layer of software and hardware. Any layer can break for a dozen reasons. Big brother can detect when some of those layers are approaching some of those breaking points.

You can only monitor all the breaking points if you have Big brother running in a local network attached to your server. Big Brother is almost useless to you for hosted Web sites and Virtual Private servers because the hosting company have to run the monitoring program. They might run Big Brother, an open alternative, or software provided by their hardware or operating system supplier. Make sure they have some monitoring and find out how often they monitor.

Servers depend on power, cool air, and the engineer sent in to fix a hardware problem will need light. A backup power supply that keeps the computer going but not the air conditioning is useless. You do not have a way of fixing the problem and someone to fix the problem outside of normal operating hours. There is a distinct advantage of detecting things approaching a breaking point so you can repair the problem on your schedule. You set the monitor to disks running out of space then clean or replace the disks before they fill up. Smart air conditioners can tell you when filters are starting to clog up. Emergency power supplies can report failing batteries.

To get the maximum advantage of system monitoring, you have to work backward from your web site to the concrete foundations of your data centre looking for breaking points and ways to predict them. Life is far easier if you use a professional data centre with complete infrastructure monitoring for power, air conditioning, fire, and disk failures. You rent their servers or supply your own with them hooking their monitor in to monitor your server hardware.

Central monitor

The C based central monitor, named bbd, is supplied as source or binaries for various operating systems. The software is free for non commercial use. There is a client written in C and named bb. Bb talks to bbd across your network using network port 1984. The monitor scripts feed data in to bb and bb passes the data to bbd. bbd converts the data to HTML for display in your Web browser.

Setup is easy if you know your systems in great detail and are an expert at shell scripts. You cannot easily monitor application activity with shell scripts so it makes sense to reproduce some of the monitoring in other languages. I contributed some PHP code for people already using PHP.

PHP is used as a Web scripting language and a conventional programming language across many operating systems. I use PHP on NT, Solaris, Linux, Windows 2000, and several variations of Unix. PHP release 4 is as fast as the best of Perl and Java while remaining a lot easier to learn.

If you have not used PHP outside of a Web server, install the PHP CGI module, write a quick PHP script, then try

/php/php.exe -q smallpage.html

Change php.exe to the name of your PHP CGI module. Change /php/ to the path to the PHP CGI module. Use -q to remove the default HTTP headers. Change smallpage.html to the name of the file containing your PHP script. The script couple be as simple as

<?php print('hello'); ?>

The enclosed PHP scripts for Big Brother require the socket functions in PHP 4.1.2 or later. You probably already have at least release 4.1.2 as 4.1.2 has a useful security update.

The scripts also use POSIX commands available in most distributions of Unix and Linux. For NT and Windows 2000, just install the POSIX commands from Cygwin.

Install Big Brother on a server that contains a Web server. Get the basic Big Brother displaying the introductory screens then click on the information screens. There is a big page on configuration and writing your own monitors. The enclosed PHP code fits the requirements described in the help pages.

You will see that monitoring can be extended from the first server to other computers by installing a program named bb on the other computers. You then install or write shell scripts to feed data through bb to the central server. The enclosed PHP code replaces some of those shell scripts. The enclosed bbsend.class is a PHP class to replace the bb program so you can have a pure PHP based solution anywhere PHP is installed.

The BB example scripts cover hardware and system basics including disk space, CPU time, and service availability. The quickest way to collect that type of data is to run a system command then process the output of the system command through a script. The PHP performs the same work as a shell script, is easier to learn, does not require external programs to process the text, and in the later releases can write direct to the BB server without requiring the bb program. That means one less language to learn and less processing overheads.

If you do have a shell script writer handy, let them install the central BB monitor then deploy PHP on all the other machines.

Now for the brilliant part. Shell scripts are of no use when you are deep within a PHP application and you find a file has a problem. That is a good time to let PHP talk direct to BB. Take a PHP script that performs administration of passwords and has a master passwords that expire every week. You could write the password access code so it sends a message to BB saying the passwords are working. When the passwords are within days of expiring, send BB an alert warning that the passwords are close to expiring. BB will pop up a yellow screen and optionally send out email messages alerting people. When the passwords are within a few hours of expiring, send out a code red alert. BB responds to code red alerts with more email and steps up to SMS messages to wake people up.

You program or Web page can call your Help desk via BB. Your application problems become as important as any hardware problem. Do you wonder why the help desk people dive in to the computer room at the first sign of smoke rising from an over worked server but ignore your application problems for days? Watch them react when your application alert makes BB calls them on their mobile phone every five minutes all day and all night.

BB lacks historical charting of trends but there is software you can add on to produce the charts. There are a wide variety of extra shell scripts at deadcat.net.

Here are some PHP files you need. Download big_brother_bbsend.class (3.69 KB) to add the equivalent of the bb client to your PHP code. Download big_brother_df.zip (656 bytes) to get df.php, a PHP script that transforms the output from the df command then transmits the result via bbsend.class. df.php is a good example of using bbsend.class. Download big_brother_procs.zip (2.9 KB) to get procs.php, a PHP script that lists processes using ps then transmits the result via bbsend.class. There are options to highlight processes that are running or not running.

You will notice bbsend.class looks a lot like the PHP mail function. That was a design decision based on the fact that many applications currently send email to help desks but cannot perform escalation or create trouble tickets. I made bbsend.class an easy replacement for the email. BB escalates a problem if an alert receives no response so BB adds value to a straight email based alert system. BB could create a trouble ticket in a PHP based trouble ticket system. phpGroupWare has an easy to use trouble ticket system.

Send your questions about BB to the BB mailing lists mentioned at their site. Send questions about shell scripts to whoever wrote the shell scripts. You can send email about my PHP scripts via the following form. Note that I no longer work on a BB server project so will not be able to test scripts for a while.

Conclusion

Big Brother is the best value system monitor for mixed systems. If you all your servers are from IBM or from HP, you might want to use their monitoring systems. For everyone else, there is Big Brother.

Comments

What about Nagios? I've seen some ISP and others that use it quite effectively. Would you say that Big Brother is better? If so, why do you think so?

Nagios looks like a good choice today. I have not used it as it was not ready for production use when I needed a product and it did not support monitoring of Windows based computers from within those computers, which was a limitation in a mixed environment.