package Smokeping::probes::EchoPingPlugin; =head1 301 Moved Permanently This is a Smokeping probe module. Please use the command C to view the documentation or the command C to generate the POD document. =cut sub pod_hash { return { name => < < <<'DOC', Niko Tyni DOC notes => <<'DOC', The I, I and I EchoPing variables are not valid by default for EchoPingPlugin -derived probes. Plugins are available starting with echoping version 6. DOC see_also => <, L, L, L DOC } } use strict; use base qw(Smokeping::probes::EchoPing); use Carp; sub _init { my $self = shift; # plugins don't generally fit with filling, size or udp. my $arghashref = $self->features; delete $arghashref->{size}; delete $arghashref->{fill}; delete $arghashref->{udp}; } sub post_args { my $self = shift; my $target = shift; return $self->plugin_args($target); } # derived classes should override this sub plugin_args { my $self = shift; my $target = shift; return (); } sub proto_args { my $self = shift; my $target = shift; my $plugin = $target->{vars}{plugin}; return ("-m", $plugin); } sub test_usage { my $self = shift; my $bin = $self->{properties}{binary}; # is there anything smarter to do? croak("Your echoping binary doesn't support plugins. At least version 6 is required.") if `$bin -m improbable_plugin_name 0.0.0.1 2>&1` =~ /invalid option/i; $self->SUPER::test_usage; return; } sub ProbeDesc($) { return "Pings using an echoping(1) plugin"; } sub targetvars { my $class = shift; my $h = $class->SUPER::targetvars; delete $h->{udp}; delete $h->{fill}; delete $h->{size}; return $class->_makevars($h, { _mandatory => [ 'plugin' ], plugin => { _doc => < "random", }, pluginargs => { _doc => < variable. These are generally provided by the subclass probe. DOC _example => "-p plugin_specific_arg", }, }, ); } 1;