The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Munin::Node::Client - Client module for munin nodes.

SYNOPSIS

  use Munin::Node::Client;

  my $node = Munin::Node::Client->connect(Host => '127.0.0.1',
                                          Port => '4949');

  my $version    = $node->version;
  my @hostnames  = $node->nodes;   # get the hostnames
  my @items      = $node->list();  # or $node->list($hostnames[0]);

  $node->quit;

DESCRIPTION

Munin::Node::Client is a client module for munin nodes. This helps simple scripts to talk to munin nodes.

FUNCTIONS

Here all functions are specified, for all functions that return in list context (such as with hashes), the scalar context is undocumented and might get a function in the future.

connect(host => $hostname, port => $port)

Connects to a node and returns an Munin::Node::Client object. Currently only support plain connections, ssl and tls are planned. Returns undef if connection fails (and $! probably contains something useful). Returns false if connection is not a munin connection. my $node = Munin::Node::Client->connect(Host => '127.0.0.1:4949');

error();

Returns the last error message. print $node->error();

version()

Returns the node's version my $version = $node->version();

nodes()

Returns the available hostnames on this 'node' in a list. my @hosts = $node->nodes(); print "$_\n" for(@plugins);

hosts()
list($node)

Returns the list of plugins for a host (or default host when left out) my @plugins = $node->list($host); print "$_\n" for(@plugins);

config($plugin)

Returns the configuration settings of a plugin as a hash with hasrefs my %config = config($plugin); my $globals = $config{globals}; my $datasrc = $config{datasource}; print $globals{graph_title}; print $datasrc{system}->{label};

fetch($plugin)

Returns the values of a plugin as a hash my %value = fetch($plugin); print $value{system};

quit()

quits/disconnects the connection to the node. $node->quit();

disconnect()

alias for quit

SEE ALSO

IO::Socket::INET

AUTHOR

Sebastian Stellingwerff <sebastian@expr42.net>

COPYRIGHT AND LICENSE

Copyright (C) 2008 by Sebastian Stellingwerff

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.0 or, at your option, any later version of Perl 5 you may have available.