| YATG documentation | view source | Contained in the YATG distribution. |
YATG::Store::Memcached - Back-end module to store polled data to a Memcached
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.
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:'
Oliver Gorwits <oliver.gorwits@oucs.ox.ac.uk>
Copyright (c) The University of Oxford 2007.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| YATG documentation | view source | Contained in the YATG distribution. |