NAME

Nagios::MKLivestatus - access nagios runtime data from check_mk livestatus Nagios addon

SYNOPSIS

use Nagios::MKLivestatus;
my $nl = Nagios::MKLivestatus->new( socket => '/var/lib/nagios3/rw/livestatus.sock' );
my $hosts = $nl->selectall_arrayref("GET hosts");

DESCRIPTION

This module connects via socket to the check_mk livestatus nagios addon. You first have to install and activate the livestatus addon in your nagios installation.

CONSTRUCTOR

new ( [ARGS] )

Creates an Nagios::MKLivestatus object. new takes at least the socketpath. Arguments are in key-value pairs.

socket                    path to the unix socket of check_mk livestatus
verbose                   verbose mode
line_seperator            ascii code of the line seperator, defaults to 10, (newline)
column_seperator          ascii code of the column seperator, defaults to 0 (null byte)
list_seperator            ascii code of the list seperator, defaults to 44 (comma)
host_service_seperator    ascii code of the host/service seperator, defaults to 124 (pipe)

If the constructor is only passed a single argument, it is assumed to be a the socket specification.

METHODS

do

send a single statement without fetching the result

selectall_arrayref($statement)

send a query an get a array reference of arrays

my $arr_refs = $nl->selectall_arrayref("GET hosts");

to get a array of hash references do something like

my $hash_refs = $nl->selectall_arrayref("GET hosts", { slice => {} });
selectall_hashref($statement, $key_field);

send a query an get a hashref

my $hashrefs = $nl->selectall_hashref("GET hosts", "name");

SEE ALSO

For more information see the Livestatus page: http://mathias-kettner.de/checkmk_livestatus.html

AUTHOR

Sven Nierlein, <nierlein@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2009 by Sven Nierlein

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.