| Ganglia::Gmetric::PP - Pure Perl emitter/parser of Ganglia gmetric monitoring |
Ganglia::Gmetric::PP - Pure Perl emitter/parser of Ganglia gmetric monitoring packets
my $gmetric = Ganglia::Gmetric::PP->new(host => 'localhost', port => 8649);
$gmetric->send($type, $name, $value, $units, $slope, $tmax, $dmax);
This module constructs Ganglia packets in the manner of the gmetric program and sends them via UDP to a gmond. Additionally it can receive and/or parse gmetric packets which is useful for constructing proxies. Though written in pure Perl with no non-core dependencies, it tries to be fast.
Constructs a new object which sends gmetric packets to the specified host
and UDP port. If omitted, they default to localhost and 8649, respectively.
Constructs a new object which receives gmetric packets (e.g. in a gmond replacement).
If the $gmetric will be used for receiving packets, listen_host and
listen_port may be specified as well.
Sends a Ganglia message. The parameters are:
The type of data being sent. Must be one of these importable constants:
The name of the metric.
The current value of the metric.
A string describing the units of measure for the metric.
A description of how the metric tends to change over time. Must be one of these importable constants:
Data is fixed, mostly unchanging.
Value is always increasing (counter).
Value is always decreasing.
Value can be anything.
The maximum time in seconds between gmetric calls.
The lifetime in seconds of this metric.
receive()
Waits for a single gmetric packet on the UDP listen port and returns the parsed
metric (see parse).
parse($packet_data)
Parses a gmetric packet, which is typically received by a UDP server.
The elements returned match the arguments to send:
($type, $name, $value, $units, $slope, $tmax, $dmax) = @metric;
This function may die if the given data does not resemble a gmetric packet.
Adam Thomason, <athomason@cpan.org
Copyright (C) 2007-2009 by Six Apart, <cpan@sixapart.com>
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.6 or, at your option, any later version of Perl 5 you may have available.
| Ganglia::Gmetric::PP - Pure Perl emitter/parser of Ganglia gmetric monitoring |