Hobbit(3pm) | User Contributed Perl Documentation | Hobbit(3pm) |
Hobbit.pm -- Perl module to easily write Hobbit/Xymon tests
use Hobbit; my $bb = new Hobbit('testname'); if (somethings_is_not_so_good) { $bb->color_line('yellow', 'Something is not so good'); } if (somethings_is_really_bad) { $bb->color_line('red', 'Something is really bad'); } $bb->send();
Hobbit.pm is part of the Debian package hobbit-plugins and was written to gather common tasks needed when writing tests for the Xymon monitoring system (formerly known as Hobbit).
Out of two colors, returns the color with the highest severity.
Creates a new Hobbit object.
Common use cases
my $bb = new Hobbit('sometest'); my $bb = new Hobbit({ test => 'testname', color => 'green', hostname => 'host.example.com', text => 'Test successful', title => 'Some Test', ttl => 60, type => 'status', dont_moan => 1 });
Available parameters
The default value is set on the xymon server and is 300 seconds by default.
Values without unit are interpreted as minutes. Valid units are h for hours, d for days, and w for weeks. No space between value and unit allowed.
May not yet work with all of these types properly. Please report bugs via the Debian Bug Tracking system.
Creates a new Hobbit trends object. This is a shorthand for new Hobbit({ type = 'data', test = 'trends', hostname = $hostname, dont_moan => 1 });
Common use case
my $trends = Hobbit::trends; $trends->print ("[$bb->{test},extralabel.rrd]\n"); $trends->print ("DS:lambda:GAUGE:600:U:U $value\n"); $trends->send;
Minutes that a sub test caused the given color state. Adjusts the overall resulting color accordingly.
Adds the given text to the end of the current report without changing the current color.
Like the print() method, but using sprintf() with format string and arguments.
Adds the given text to the end of the current report and minutes that a sub test caused the given color state. Adjusts the overall resulting color accordingly.
Adds the given text to the end of the current report and minutes that a sub test caused the given color state. Prepends that text with an accordingly colored Xymon icon and adjusts the overall resulting color accordingly.
Adds HTML for showing a graph. Xymon itself can only show a single graph per test (others can be added to the "trends" column). This method works around that limitation by manually linking to the graph CGI.
Sends the report to the xymon server.
Run a xymongrep (bbhostgrep) query and return an array reference of hashes with keys ip (string), hostname (string), and tags (array reference).
my $list = Hobbit::grep('foobar'); foreach my $host (@$list) { print "$host->{ip} $host->{hostname}\n"; }
If the check issues a Perl warning, this warning is added to the report with color state "yellow".
Set dont_moan to 1 to disable this feature.
If the check issues a Perl error, this error is added to the report with color state "red".
Set dont_moan to 1 to disable this feature.
Copyright (C) 2008-2011 Christoph Berg <myon@debian.org> Copyright (C) 2011 Axel Beckert <abe@debian.org>
2019-01-29 | perl v5.28.1 |