Skip to content
Snippets Groups Projects
Verified Commit c17d2ef5 authored by Miroslav Hanak's avatar Miroslav Hanak
Browse files

Improve ZabbixMetrics

parent 8dde158c
No related merge requests found
Pipeline #107605 failed with stages
in 31 seconds
......@@ -2,9 +2,16 @@ import json
import socket
import struct
from .exceptions import InvalidMetricsHostError, InvalidMetricsKeyError, InvalidMetricsValueError
class ZabbixMetrics:
def __init__(self, host, key, value, clock=None, ns=None):
def __init__(self, host: str, key: str, value: str | int | float, clock=None, ns=None):
if not host:
raise InvalidMetricsHostError("")
if not key:
raise InvalidMetricsKeyError("")
if value is None:
raise InvalidMetricsValueError("")
self.host = host
self.key = key
self.value = value
......@@ -14,8 +21,7 @@ class ZabbixMetrics:
self.ns = ns
def __repr__(self):
result = json.dumps(self.__dict__, ensure_ascii=False)
return result
return json.dumps(self.__dict__, ensure_ascii=False)
class ZabbixResponse:
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment