NAME
Monitoring::Livestatus::Class::Lite - Object-Oriented interface for Monitoring::Livestatus
DESCRIPTION
This module is an object-oriented interface for Monitoring::Livestatus. Just like Monitoring::Livestatus::Class but without Moose.
SYNOPSIS
use Monitoring::Livestatus::Class::Lite;
my $class = Monitoring::Livestatus::Class::Lite->new({
peer => '/var/lib/nagios3/rw/livestatus.sock'
});
my $hosts = $class->table('hosts');
my @data = $hosts->columns('display_name')->filter(
{ display_name => { '-or' => [qw/test_host_47 test_router_3/] } }
)->hashref_array();
use Data::Dumper;
print Dumper \@data;
ATTRIBUTES
peer
Connection point to the livestatus addon. This can be a unix domain or tcp socket.
Socket
my $class = Monitoring::Livestatus::Class->new(
peer => '/var/lib/nagios3/rw/livestatus.sock'
);
TCP Connection
my $class = Monitoring::Livestatus::Class->new(
peer => '192.168.1.1:2134'
);
ENVIRONMENT VARIABLES
MONITORING_LIVESTATUS_CLASS_TRACE
Print tracer output from this object.
MONITORING_LIVESTATUS_CLASS_TEST_PEER
Set peer for live tests.
METHODS
new
new($options)
create new Class module
table
table($tablename)
return instance for this table
columns
columns($columns)
list of columns to fetch
options
options($options)
set query options
filter
filter($filter)
filter result set
stats
stats($statsfilter)
set stats filter
hashref_pk
hashref_pk($key)
return result as hash ref by key
hashref_array
hashref_array()
return result as array
reset_filter
reset_filter()
removes all current filter
save_filter
save_filter($name)
save this filter with given name which can be reused later.
apply_filter
apply_filter($name)
returns true if a filter with this name has been applied. returns false if filter does not exist.
statement
statement($filter_only)
return query as text.
REPOSITORY
Git: http://github.com/sni/Monitoring-Livestatus-Class-Lite
AUTHOR
Sven Nierlein, 2009-present, <sven@nierlein.org>
Robert Bohne, <rbo at cpan.org>
COPYRIGHT & LICENSE
Sven Nierlein, 2009-present, <sven@nierlein.org>
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.