AHA
view release on metacpan or search on metacpan
example/lava_lamp.pl view on Meta::CPAN
#!/usr/bin/perl
=head1 NAME
lava_lamp.pl --mode [watch|list|notify] --type [problem|recovery] \
--name [AIN|switch name] --label <label> --debug \
--config <path-to-perl-config>
=head1 DESCRIPTION
Simple example how to use L<"AHA"> for controlling AVM AHA switches. I.e.
it is used for using a Lava Lamp as a Nagios Notification handler.
It also tries to check that:
=over
example/lava_lamp.pl view on Meta::CPAN
# End of configuration
use Storable qw(fd_retrieve store_fd store retrieve);
use Data::Dumper;
use feature qw(say);
use Fcntl qw(:flock);
use Getopt::Long;
use strict;
my %opts = ();
GetOptions(\%opts, 'type=s','mode=s','debug!','name=s','label=s','config=s');
my $DEBUG = $opts{debug};
read_config_file($opts{config}) if $opts{config};
init_status();
my $mode = $opts{'mode'} || "list";
# List mode doesnt need a connection
list() and exit if $mode eq "list";
# Open status and lock
my $status = fetch_status();
use strict;
use LWP::UserAgent;
use AHA::Switch;
use Encode;
use Digest::MD5;
use Data::Dumper;
use vars qw($VERSION);
$VERSION = "0.55";
# Set to one if some debugging should be printed
my $DEBUG = 0;
=item $aha = new AHA({host => "fritz.box", password => "s!cr!t", user => "admin"})
=item $aha = new AHA("fritz.box","s!cr!t","admin")
Create a new AHA object for accessing a Fritz Box via the HTTP interface. The
parameters can be given as a hashref (for named parameters) or in a simple form
with host, password and user (optional) as unnamed arguments.
( run in 1.600 second using v1.01-cache-2.11-cpan-49f99fa48dc )