NAME
YATG::Store::Memcached - Back-end module to store polled data to a Memcached
VERSION
version 5.140510
DESCRIPTION
This module implements part of a callback handler used to store SNMP data into a memcached service. It will be faster than storing to disk, and so is recommended if you do not require historical data.
The module will die if it cannot connect to your memcached server, so see below for the configuration guidelines. Note that all example keys here use the namespace prefix of yatg:
although this is configurable.
One data structure is passed in, which represents a set of results for a set of polled OIDs on some devices. It looks a bit like this:
$results->{$device}->{$leaf}->{$port} = {value}
In your memcached server, a few well-known keys store lists of polled devices and so on, to help you bootstrap to find stored results.
The key yatg:yatg_devices
will contain an array reference containing all device IPs provided in the results data.
Further, each key of the form yatg:ports_for:$device
will contain an array reference containing all ports polled on that device. The port name is not munged in any way. The "port" entity might in fact just be an index value, or 1
if this OID is not Interface Indexed.
Finally, the result of a poll is stored in memcached with a key of the following format:
yatg:$device:$leaf:$port
Note that the $leaf
is the SNMP leaf name and not the OID. That key will be munged to remove whitespace, as that is not permitted in memcached keys.
All of the above values are stored with a TTL of the polling interval as gathered from the main yatg_updater
configuration.
With all this information it is possible to write a script to find all the data stored in the memcache using the two lookup tables and then retrieving the desired keys. There is an example of this in the examples/
folder of this distribution, called check_interfaces
. It is a Nagios2 check script.
REQUIREMENTS
Install the following additonal module to use this plugin:
CONFIGURATION
In the main yatg_updater
configuration, you must provide details of the location of your memcached server. Follow the example (yatg.yml
) file in this distribution. Remember you can override the namespace used from the default of yatg:
, like so:
cache_memcached:
namespace: 'my_space:'
SEE ALSO
AUTHOR
Oliver Gorwits <oliver@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by University of Oxford.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.