rsbperfmondbadapter

Module containing the real worker logic.

Code author: jwienke

Functions

get_logger_by_class(klass[, instance]) Gets a python logger instance based on a class instance.
positive_int(candidate) Checks a command line argument value for being a positive integer.

Classes

CopyableObject([name]) Generic data holder class with deep copy and dynamic assignment support.
DatabaseBackend Interface class for database backends which store processed data somehow.
GraphiteBackend(host, port, process_prefix, ...) A backend to submit data to a graphite installation.
InfluxdbBackend(client, process_prefix, ...) A backend for the timeseries database InfluxDB.
NetworkState(**kwargs)
Processor(backend[, do_threads, ...]) Controller to accept raw data, pre-processes it, and passes it to backends.
TimeseriesDbBackend(process_prefix, host_prefix) Abstract base class for adapters which put data into timeseries databases that are structured by series and associated measurement names.
class rsbperfmondbadapter.CopyableObject(name=None)

Bases: object

Generic data holder class with deep copy and dynamic assignment support.

clone()
class rsbperfmondbadapter.DatabaseBackend

Bases: object

Interface class for database backends which store processed data somehow.

Apart from implementing the abstract methods, also the two static methods prepare_arguments() and create() need to be implemented. The former will be first called to request command line options to present to the user and the latter one will be called afterwards as a factory method to create an instance of the backend from the parsed options.

static create(args)

Factory method called to create a new instance of the backend.

Parameters:args (argparse.Namespace) – parsed command line arguments
Returns:newly created backend according to the user options.
Return type:DatabaseBackend
static prepare_arguments(group)

Provide command line parsing arguments to the provided argparse group.

Always use a consistent naming with a prefix identifying the backend to provide name clashes.

shutdown()

Shutdown the backend so that this instance can be deleted safely.

submit_host_information(host_information, timestamp)

Store the provided host information in the database.

submit_process_data(process_cues, timestamp, do_subprocesses)

Store the provided data for a process in the database.

class rsbperfmondbadapter.GraphiteBackend(host, port, process_prefix, host_prefix)

Bases: rsbperfmondbadapter.TimeseriesDbBackend

A backend to submit data to a graphite installation.

COMPONENT_SEPARATOR = '.'
HOST_CONNECTION_SERIES_PATTERN = '{prefix}{separator}{name}{separator}network{separator}connections{separator}{protocol}{separator}{family}'
HOST_CPU_SERIES_PATTERN = '{prefix}{separator}{name}{separator}cpus{separator}cpu{index}'
HOST_DISK_SERIES_PATTERN = '{prefix}{separator}{name}{separator}disk{separator}devices{separator}{device}'
HOST_NIC_SERIES_PATTERN = '{prefix}{separator}{name}{separator}network{separator}nics{separator}{nic}'
HOST_PARTITION_SERIES_PATTERN = '{prefix}{separator}{name}{separator}disk{separator}partitions{separator}{partition}'
HOST_SERIES_PATTERN = '{prefix}{separator}{name}'
HOST_TCP_SERIES_PATTERN = '{prefix}{separator}{name}{separator}network{separator}connections{separator}tcp'
HOST_UDP_SERIES_PATTERN = '{prefix}{separator}{name}{separator}network{separator}connections{separator}udp'
INVALID_KEY_CHARS = <_sre.SRE_Pattern object>
PROCESS_SERIES_PATTERN = '{prefix}{separator}{name}'
REPLACE_KEY_CHAR = '_'
static create(args)
static prepare_arguments(group)
shutdown()
submit_host_information(host_information, timestamp)
submit_process_data(process_cues, timestamp, do_subprocesses)
class rsbperfmondbadapter.InfluxdbBackend(client, process_prefix, host_prefix, version)

Bases: rsbperfmondbadapter.TimeseriesDbBackend

A backend for the timeseries database InfluxDB.

COMPONENT_SEPARATOR = '.'
HOST_CONNECTION_SERIES_PATTERN = '{prefix}{separator}{name}{separator}network{separator}connections{separator}{protocol}{separator}{family}'
HOST_CPU_SERIES_PATTERN = '{prefix}{separator}{name}{separator}cpus{separator}cpu{index}'
HOST_DISK_SERIES_PATTERN = '{prefix}{separator}{name}{separator}disk{separator}devices{separator}{device}'
HOST_NIC_SERIES_PATTERN = '{prefix}{separator}{name}{separator}network{separator}nics{separator}{nic}'
HOST_PARTITION_SERIES_PATTERN = '{prefix}{separator}{name}{separator}disk{separator}partitions{separator}{partition}'
HOST_SERIES_PATTERN = '{prefix}{separator}{name}'
HOST_TCP_SERIES_PATTERN = '{prefix}{separator}{name}{separator}network{separator}connections{separator}tcp'
HOST_UDP_SERIES_PATTERN = '{prefix}{separator}{name}{separator}network{separator}connections{separator}udp'
INVALID_KEY_CHARS = <_sre.SRE_Pattern object>
PROCESS_SERIES_PATTERN = '{prefix}{separator}{name}'
REPLACE_KEY_CHAR = '_'
static create(args)
static prepare_arguments(group)
shutdown()

Shutdown the backend so that this instance can be deleted safely.

submit_host_information(host_information, timestamp)
submit_process_data(process_cues, timestamp, do_subprocesses)
class rsbperfmondbadapter.Processor(backend, do_threads=False, aggregate_subprocesses=False, derive_cues=False)

Bases: object

Controller to accept raw data, pre-processes it, and passes it to backends.

insert_host(host_information, timestamp)

Process new host-related measurements.

Parameters:
insert_process(process_cues, timestamp)

Processes new measurements for a monitored process.

Parameters:
  • process_cues (rst.monitoring.ProcessCues) – the new measurement data as an RST type
  • timestamp (float) – the timestamp of the measurements as a unix timestamp in seconds
class rsbperfmondbadapter.TimeseriesDbBackend(process_prefix, host_prefix)

Bases: rsbperfmondbadapter.DatabaseBackend

Abstract base class for adapters which put data into timeseries databases that are structured by series and associated measurement names.

Subclasses need to ensure that the __init__() is called correctly and need to override _submit().

COMPONENT_SEPARATOR = '.'
HOST_CONNECTION_SERIES_PATTERN = '{prefix}{separator}{name}{separator}network{separator}connections{separator}{protocol}{separator}{family}'
HOST_CPU_SERIES_PATTERN = '{prefix}{separator}{name}{separator}cpus{separator}cpu{index}'
HOST_DISK_SERIES_PATTERN = '{prefix}{separator}{name}{separator}disk{separator}devices{separator}{device}'
HOST_NIC_SERIES_PATTERN = '{prefix}{separator}{name}{separator}network{separator}nics{separator}{nic}'
HOST_PARTITION_SERIES_PATTERN = '{prefix}{separator}{name}{separator}disk{separator}partitions{separator}{partition}'
HOST_SERIES_PATTERN = '{prefix}{separator}{name}'
HOST_TCP_SERIES_PATTERN = '{prefix}{separator}{name}{separator}network{separator}connections{separator}tcp'
HOST_UDP_SERIES_PATTERN = '{prefix}{separator}{name}{separator}network{separator}connections{separator}udp'
INVALID_KEY_CHARS = <_sre.SRE_Pattern object>
PROCESS_SERIES_PATTERN = '{prefix}{separator}{name}'
REPLACE_KEY_CHAR = '_'
create(args)

Factory method called to create a new instance of the backend.

Parameters:args (argparse.Namespace) – parsed command line arguments
Returns:newly created backend according to the user options.
Return type:DatabaseBackend
prepare_arguments(group)

Provide command line parsing arguments to the provided argparse group.

Always use a consistent naming with a prefix identifying the backend to provide name clashes.

shutdown()

Shutdown the backend so that this instance can be deleted safely.

submit_host_information(host_information, timestamp)
submit_process_data(process_cues, timestamp, do_subprocesses)
rsbperfmondbadapter.positive_int(candidate)

Checks a command line argument value for being a positive integer.