no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | monitors:bbsmokeping [2009/11/23 05:34] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Monitor ====== | ||
+ | |||
+ | ^ Author | [[ nathanh@manu.com.au | Nathan Hand ]] | | ||
+ | ^ Compatibility | Xymon 4.2 | | ||
+ | ^ Requirements | Perl, unix, smokeping | | ||
+ | ^ Download | None | | ||
+ | ^ Last Update | 2007-01-01 | | ||
+ | |||
+ | ===== Description ===== | ||
+ | |||
+ | This server/ext script walks the FPing targets from your existing Smokeping installation and alerts if the packet loss exceeds a threshold. It's similar in concept to the bbmrtg.pl script. | ||
+ | |||
+ | ===== Installation ===== | ||
+ | - Make sure your Xymon/BB hostnames and Smokeping hostnames are in agreement, eg. < | ||
+ | / | ||
+ | 10.20.30.40 | ||
+ | |||
+ | / | ||
+ | ++ myrouter | ||
+ | menu = myrouter | ||
+ | title = This Is My Router | ||
+ | host = 10.20.30.40 | ||
+ | </ | ||
+ | - Then drop this ext script into / | ||
+ | | ||
+ | ENVFILE / | ||
+ | NEEDS hobbitd | ||
+ | CMD $BBHOME/ | ||
+ | LOGFILE $BBSERVERLOGS/ | ||
+ | INTERVAL 3m | ||
+ | </ | ||
+ | |||
+ | ===== Source ===== | ||
+ | ==== bbsmokeping.pl ==== | ||
+ | <hidden onHidden=" | ||
+ | <code perl> | ||
+ | # | ||
+ | # | ||
+ | # bbsmokeping.pl: | ||
+ | # exceeds thresholds. | ||
+ | # | ||
+ | # Author: | ||
+ | # Version: | ||
+ | # License: | ||
+ | # | ||
+ | # Make sure your Xymon/BB hostnames and Smokeping hostnames are in agreement, eg. | ||
+ | # | ||
+ | # / | ||
+ | # | ||
+ | # | ||
+ | # / | ||
+ | # ++ myrouter | ||
+ | # menu = myrouter | ||
+ | # title = This Is My Router | ||
+ | # host = 10.20.30.40 | ||
+ | # | ||
+ | # Then drop this ext script into / | ||
+ | # launcher, eg add this to / | ||
+ | # | ||
+ | # [bbsmokeping] | ||
+ | # | ||
+ | # NEEDS hobbitd | ||
+ | # CMD $BBHOME/ | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | use strict; | ||
+ | |||
+ | # Configure location of BB | ||
+ | my $BB="/ | ||
+ | my $BBDISP=" | ||
+ | |||
+ | # Adjust the thresholds | ||
+ | my $LOSSRED = 3; | ||
+ | my $LOSSYELLOW = 1; | ||
+ | |||
+ | # Adjust these paths and versions as necessary. | ||
+ | use lib qw(/ | ||
+ | use lib qw(/ | ||
+ | use lib qw(/ | ||
+ | |||
+ | # Define the full path to the Smokeping config file. | ||
+ | my $SMOKEPINGCFG = '/ | ||
+ | |||
+ | # Define the full URL to the smokeping images. | ||
+ | my $SMOKEPINGURL = ' | ||
+ | |||
+ | ################################## | ||
+ | # Nothing to touch below this line | ||
+ | ################################## | ||
+ | |||
+ | use Smokeping; | ||
+ | use Data:: | ||
+ | |||
+ | my $date = localtime(); | ||
+ | my $cfg = Smokeping:: | ||
+ | |||
+ | sub walktree($$$$); | ||
+ | sub walktree($$$$) { | ||
+ | my $cfg = shift; | ||
+ | my $tree = shift; | ||
+ | my $name = shift; | ||
+ | my $target = shift; | ||
+ | |||
+ | foreach my $prop (keys %{$tree}) { | ||
+ | if (ref $tree-> | ||
+ | walktree $cfg, $tree-> | ||
+ | } | ||
+ | |||
+ | if ($prop eq ' | ||
+ | my $last = RRDs:: | ||
+ | my ($start, $step, $names, $data) = RRDs::fetch "-s $last", | ||
+ | |||
+ | if (@$names[1] eq ' | ||
+ | my $loss = @{@$data[0]}[1]; | ||
+ | |||
+ | if ($loss > $LOSSRED) { | ||
+ | my $stats = << | ||
+ | $tree-> | ||
+ | < | ||
+ | < | ||
+ | ECHO | ||
+ | system($BB, $BBDISP, " | ||
+ | } | ||
+ | elsif ($loss > $LOSSYELLOW) { | ||
+ | my $stats = << | ||
+ | $tree-> | ||
+ | < | ||
+ | < | ||
+ | ECHO | ||
+ | system($BB, $BBDISP, " | ||
+ | } | ||
+ | else { | ||
+ | my $stats = << | ||
+ | $tree-> | ||
+ | < | ||
+ | ECHO | ||
+ | system($BB, $BBDISP, " | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | walktree $cfg, $cfg-> | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== Known Bugs and Issues ===== | ||
+ | |||
+ | No known bugs. | ||
+ | |||
+ | ===== To Do ===== | ||
+ | |||
+ | ===== Credits ===== | ||
+ | |||
+ | ===== Changelog ===== | ||
+ | |||
+ | * **2007-01-01** | ||
+ | * Initial release | ||