OneAgent Memcached plugin

Gathers Memcached stats. The full description of stats is described at https://github.com/memcached/memcached/blob/master/doc/protocol.txt.

Supported communication protocols are below:

  • TCP - simple text lines
  • Unix sockets - simple text lines
  • UDP - text lines with binary header

All needed configuration is retrieved from parsing process command line.

class ruxit_memcached.MemcachedPlugin(**kwargs)[source]

Bases: ruxit.api.base_plugin.BasePlugin

Memcached plugin class. This plugin is stateful - initialize and close methods are defined in order to maintain one server connection for the lifetime of the plugin.

__init__ should not be overridden without a call to super.

Parameters:
  • config (Dict[str, str]) -- plugin configuration
  • results_builder (ResultsBuilder) -- instance for this plugin,
  • json_config -- parsed plugin.json contents,
  • plugin_info (PluginInfo) -- json data of the plugin exposed in a more convenient way,
  • associated_entity -- monitored entity associated with the plugin, if any (deprecated).
  • activation_context -- activation context for the plugin,
  • process_snapshot (ProcessSnapshot) -- latest available at method call,
  • entity_resolver (EntityResolver) -- exposes additional methods for querying snapshot
  • logger -- plugin specific logger for plugin development, set to None only in unit tests
absolute_values = {'curr_connections', 'bytes', 'limit_maxbytes'}

Values retrieved from Memcached and send to Ruxit server as absolute values.

per_second_values = {'bytes_written', 'cmd_get', 'evictions', 'cmd_set', 'get_hits', 'bytes_read', 'get_misses'}

Values retrieved from Memcached and send to Ruxit server as per second values.

SOCKET_TIMEOUT_SECONDS = 10
set_communication_data(command_line)[source]

Parse command line and set communication protocol data. Memcached command parameters are described at http://linux.die.net/man/1/memcached

Following data are discovered:

  • TCP interface: IP address and port
  • UDP interface: IP address and port
  • Unix socket: Unix socket name
initialize(**kwargs)[source]

Initializes Memcached plugin.

Raises:ruxit.api.exceptions.ConfigException there is no Memcached process or command line isn't recognized
query(**kwargs)[source]

Calls specific communication protocol request, parses response and send data to Ruxit server.