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)[source]¶ Bases:
object
Generic data holder class with deep copy and dynamic assignment support.
-
class
rsbperfmondbadapter.
DatabaseBackend
[source]¶ 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()
andcreate()
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)[source]¶ 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)[source]¶ 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.
-
static
-
class
rsbperfmondbadapter.
GraphiteBackend
(host, port, process_prefix, host_prefix)[source]¶ 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
= '_'¶
-
submit_host_information
(host_information, timestamp)¶
-
submit_process_data
(process_cues, timestamp, do_subprocesses)¶
-
-
class
rsbperfmondbadapter.
InfluxdbBackend
(client, process_prefix, host_prefix, version)[source]¶ 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
= '_'¶
-
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)[source]¶ Bases:
object
Controller to accept raw data, pre-processes it, and passes it to backends.
-
insert_host
(host_information, timestamp)[source]¶ Process new host-related measurements.
Parameters: - host_information (rst.devices.generic.HostInformation) – new measurements
- timestamp (float) – timestamp of the measurements as unix timestamp in seconds
-
insert_process
(process_cues, timestamp)[source]¶ 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)[source]¶ 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
= '.'¶ Character to use for separating the provider from the cue.
-
HOST_CONNECTION_SERIES_PATTERN
= '{prefix}{separator}{name}{separator}network{separator}connections{separator}{protocol}{separator}{family}'¶ Format string to generate the series name for a network controller
-
HOST_CPU_SERIES_PATTERN
= '{prefix}{separator}{name}{separator}cpus{separator}cpu{index}'¶ Format string to generate the series name for a cpu
-
HOST_DISK_SERIES_PATTERN
= '{prefix}{separator}{name}{separator}disk{separator}devices{separator}{device}'¶ Format string to generate the series name for a storage device
-
HOST_NIC_SERIES_PATTERN
= '{prefix}{separator}{name}{separator}network{separator}nics{separator}{nic}'¶ Format string to generate the series name for a network controller
-
HOST_PARTITION_SERIES_PATTERN
= '{prefix}{separator}{name}{separator}disk{separator}partitions{separator}{partition}'¶ Format string to generate the series name for a disk partition
-
HOST_SERIES_PATTERN
= '{prefix}{separator}{name}'¶ Format string to generate the series name for general host information
-
HOST_TCP_SERIES_PATTERN
= '{prefix}{separator}{name}{separator}network{separator}connections{separator}tcp'¶ Format string to generate the series name for the utility tcp series
-
HOST_UDP_SERIES_PATTERN
= '{prefix}{separator}{name}{separator}network{separator}connections{separator}udp'¶ Format string to generate the series name for the utility udp series
-
INVALID_KEY_CHARS
= <_sre.SRE_Pattern object>¶ A regex to find all characters in keys that somehow create troubles with timeseries names, e.g. by being confused with an operator.
-
PROCESS_SERIES_PATTERN
= '{prefix}{separator}{name}'¶ Format string to generate the series name for process information
-
REPLACE_KEY_CHAR
= '_'¶ Characters to use as a substitute for invalid ones in influxdb keys.
-
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.
-