SmokePing
smokeping_extendOVERVIEWThis document is intended to guide prospective authors in writing new Smokeping probes. It mostly describes the interface between Smokeping and its probe modules. If it seems too complicated to understand, look at the existing modules for examples. Comments and proposed changes or additions are welcome. Please send them to the smokeping-users mailing list. Patches against the POD source of this document are most appreciated. CHOOSING A BASE CLASSThe first thing you should decide is which base class you should use for your probe. For most (if not all) uses it's a choice between Smokeping::probes::base and Smokeping::probes::basefork. The former is intended for probes that can measure their targets all in one go, while the latter is for probing them one at a time, possibly in several concurrent subprocesses. At the moment,
the only probes that use SKELETON FILEThe Smokeping::probes::skel module is a non-functional probe that is intended to make a good basis for a new probe module.
Copy the file,
PROBE DOCUMENTATIONThe probe documentation is generated from the source code with the smokeping arguments You should provide the method The special sections Note that if you use 'here documents' ('<<') that have POD markup inside, you should escape the markup so that it doesn't show up in the embedded POD documentation. Most probes do it like this: my $e = "="; my $doc = <<DOC; ${e}head1 SECTION TITLE DOC PROBE DESCRIPTIONThe probe should offer the VARIABLESAll Smokeping probes must define their variables by implementing a (The probes that are derived from The base classes offer these methods too to provide the variables that are common to all the probes (eg. the probe-specific When you do supply your own sub probevars { my $class = shift; return $class->_makevars($class->SUPER::probevars, { # your variables go here } } The variables are declared in a syntax that comes from the module used for parsing the configuration file, For reference, here are the keys the hash should have. Much of this is taken straight from the
The INITIALIZATIONIf you must do something at probe initialization time, like check that the external program you're going to use behaves as you expect, you should do it in the PINGINGAll the real action happens in the You can access the probe-specific variables here via the You should return a sorted array of the latency times measured. If a ping fails, don't put anything in the array. That's it, you're done! EXAMPLE CONFIGURATIONSIf you would like to provide a documented example configuration for your probe (in addition to the automatically generated SYNOPSIS section in the probe manual), you can do so by adding it to the Smokeping::Examples module. Look for the 'examples' subroutine and add your example there. Future versions of Smokeping might provide a way to embed examples in the probe modules too. The author's motivation for implementing this would be greatly increased by even a single demand for it, so please speak up if you think you'd use it. TIMEOUT HANDLINGIf you deal with timeouts (for example because your program offers a parameter for specifying the timeout for the pings), you should know a few things. First, there's timeout logic in sub probevars { my $class = shift; my $h = $class->SUPER::probevars; $h->{timeout}{_default} = 10; # override the superclass default return $class->_makevars($h, { # your variables go here } } If you want to provide a target-specific Providing a target-specific COPYRIGHTCopyright 2005 by Niko Tyni. LICENSEThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. AUTHORNiko Tyni <ntyni@iki.fi> BUGSThis document makes writing new probes look much harder than it really is. SEE ALSOThe other Smokeping documents, especially smokeping_config. |
|
08/30/2007 | Niko Tyni | OETIKER+PARTNER AG
|
NOTE: The content of this website is accessible with any browser. The graphical design though relies completely on CSS2 styles. If you see this text, this means that your browser does not support CSS2. Consider upgrading to a standard conformant browser like Mozilla Firefox or Opera but also Apple's Safari or KDE's Konqueror for example. It may also be that you are looking at a mirror page which did not copy the CSS for this page.