CMDP Module#
SPDX-FileCopyrightText: 2024 DESY and the Constellation authors SPDX-License-Identifier: EUPL-1.2
Module implementing the Constellation Monitoring Distribution Protocol.
- class core.cmdp.CMDP1Header(name: str)#
Bases:
objectClass implementing a Constellation CMDP1 message header.
- decode(header: Any) tuple[str, Timestamp, dict[str, Any] | None]#
Decode header string and return host, timestamp and meta map.
- encode(meta: dict[str, Any] | None = None) memoryview#
Generate and return a header as list.
Additional keyword arguments are required for protocols specifying additional fields.
- protocol = 'CMDP\x01'#
- class core.cmdp.CMDPPublisher(name: str, socket: Socket | None)#
Bases:
CMDPTransmitterClass for publishing Constellation monitoring messages via ZMQ.
- has_log_subscribers(record: LogRecord) bool#
Return whether or not we have subscribers for the given log topic.
- has_metric_subscribers(metric_name: str) bool#
Return whether or not we have subscribers for the given metric data topic.
- register_log(topic: str, description: str | None = '') None#
Register a LOG topic that subscribers should be notified about.
- class core.cmdp.CMDPTransmitter(name: str, socket: Socket | None)#
Bases:
objectClass for sending Constellation monitoring messages via ZMQ.
- recv(flags: int = 0) LogRecord | Metric | Notification | None#
Receive a Constellation monitoring message and return log or metric.
- class core.cmdp.Metric(name: str, unit: str, value: Any = None)#
Bases:
objectClass to hold information for a Constellation metric.
- class core.cmdp.Notification(prefix: str)#
Bases:
objectClass to hold information for a Constellation CMDP notification.
- core.cmdp.decode_log(name: str, topic: str, msg: list[bytes]) LogRecord#
Receive a Constellation log message.