BBPerl - Perl module for the ease of writing Perl based big brother monitors.
use BBPerl;
$bbmonitor = new BBPerl ('My_Monitor');
$bbmonitor->debugLevel(1);
$bbmonitor->testName('My_Monitor');
$bbmonitor->status('red');
$bbmonitor->addMsg('Something is very wrong');
$bbmonitor->send;
This module is designed to ease the ability to send Big Brother style monitor messages.
It will check to make sure it is running with a proper environment by making sure the environment variables BBHOME and BBTMP are set. If they are not, it will cause the program to abort with a message explaining the reason for the failure.
$bbmonitor->debugLevel()
When called with a parameter, this sets the debug level. When no argument is used, returns the debug level.
$bbmonitor->testName("My_Test")
When called with a parameter, this sets the name of the test, or otherwise known as the column name under which to report the results of the monitor test. When no arguement is used, it returns the name of the test.
$bbmonitor->status("red")
While anything can be set here, the only valid stati for Big Brother are (green, yellow, red, purple). When called with a parameter, this sets the status of the report. When no arguement is used, it returns the current status.
$bbmonitor->addMsg("I have something else to report")
Adds more information to the report sent back to the Big Brother server. Each time this is called, the message is appended with an automatic line feed. Currently, this reporting tool only allows up to 75 lines to be reported. Most BB servers only allow 50 lines, then show a DATA TRUNCATED message.
$bbmonitor->getMsgCount()
This will return the number of lines that are in the current message buffer. This can be useful to see if during a long report, you are coming close to the maximum number of lines that BB is allowed to accept.
$bbmonitor->bbdisp
This method will tell you what the BB Display server is set to, or if you call it with a parameter, it will override what the current BB environment has set for the Big Brother Pager.
$bbmonitor->hostname
This method will tell you what will be reported to the Big Brother server as the originating host name. If you set this, it will report to big brother as if it were coming from the host name specified. If you set this value, it will set the useFQDN to 0.
$bbmonitor->useFQDN()
This method will instruct the BB monitor to report the full FQDN of the host. If set to 1, the domain name of the host will be included in the report. If set to 0, only the hostname will be reported to the BB server. Setting this value will override the hostname set using the $bbmonitor->hostname function and set it either to the hostname or the hostfqdn. Checking this value will let you know if the monitor will report the FQDN.
$bbmonitor->bbhome
This method will tell you what the BBHOME environment variable is set to. You can change this by passing a parameter with a new path, but this is HIGHLY not recommended.
$bbmonitor->bbcmd
This method will tell you the full path to the big brother client executable. You can change this by passing a parameter with a new path. I saw no need for this, however in the spirit of flexibility, I put this in here.
$bbmonitor->bbtmp
This method will tell you the full path to Big Brother temp directory. You can change the temp directory by setting this parameter, however it is highly discouraged.
$bbmonitor->send
This method should be called last to send the message to the Big Brother server.
Eirik Toft (grep_boy@yahoo.com) with thanks to Kenneth T Dreyer who created more platform independancy in the code.
To install BBPerl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm BBPerl
CPAN shell
perl -MCPAN -e shell install BBPerl
For more information on module installation, please visit the detailed CPAN module installation guide.