From 9f9464d13b297a5b84d0b40a2ba5c9c19b29448d Mon Sep 17 00:00:00 2001 From: Christian Neubauer Date: Fri, 3 Mar 2023 14:51:22 +0100 Subject: [PATCH] =?UTF-8?q?[add]=20#1=20=C3=9Cberwachung=20von=20Speicherp?= =?UTF-8?q?latzverbrauch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/test.hmdl.json | 19 ++++++++----------- source/localization/de.json | 3 ++- source/localization/en.json | 3 ++- source/logic/lib.py | 2 +- source/logic/main.py | 1 + tools/build | 1 + 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/examples/test.hmdl.json b/examples/test.hmdl.json index d3e2051..37ac4e4 100644 --- a/examples/test.hmdl.json +++ b/examples/test.hmdl.json @@ -8,26 +8,23 @@ "annoy": false, "schedule": { "regular_interval": 15, - "attentive_interval": 5 + "attentive_interval": 1 }, "notifications": [ { "kind": "console", "parameters": { } - }, - { - "kind": "libnotify", - "parameters": { - } } ], - "kind": "file_state", + "kind": "generic_remote", "parameters": { - "path": "/tmp/test", - "exist": true, - "age_threshold": 60, - "size_threshold": 1 + "host" : "iks-vvd-cn.greenscale.lan", + "user" : "root", + "ssh_key" : "/home/christiann/.ssh/id_ed25519.pub", + "mount_point" : "/", + "threshold" : 95, + "strict" : false } } ] diff --git a/source/localization/de.json b/source/localization/de.json index 3dd8db2..ff9280c 100644 --- a/source/localization/de.json +++ b/source/localization/de.json @@ -21,5 +21,6 @@ "checks.http_request.header_value_mismatch": "Header-Wert für Schlüssel '{{key}}' '{{value_actual}}' stimmt nicht mit erwartetem Wert {{value_expected}} überein", "checks.http_request.body_misses_part": "Rumpf enthält nicht den erwarteten Teil '{{part}}'", "misc.state_file_path": "Pfad zur Zustands-Datei", - "misc.check_procedure_failed": "Prüfungs-Prozedur fehlgeschlagen" + "misc.check_procedure_failed": "Prüfungs-Prozedur fehlgeschlagen", + "checks.generic_remote.overflow": "Festplatte fast voll" } diff --git a/source/localization/en.json b/source/localization/en.json index 676273d..798c20d 100644 --- a/source/localization/en.json +++ b/source/localization/en.json @@ -21,5 +21,6 @@ "checks.http_request.header_value_mismatch": "actual header value for key '{{key}}' '{{value_actual}}' and does not match the expected value {{value_expected}}", "checks.http_request.body_misses_part": "body does not contain the expected part '{{part}}'", "misc.state_file_path": "state file path", - "misc.check_procedure_failed": "check procedure failed" + "misc.check_procedure_failed": "check procedure failed", + "checks.generic_remote.overflow": "harddisk full" } diff --git a/source/logic/lib.py b/source/logic/lib.py index 9ad64bb..9d741ac 100644 --- a/source/logic/lib.py +++ b/source/logic/lib.py @@ -14,7 +14,7 @@ def file_write(path, content): def string_coin(template, arguments): result = template for (key, value, ) in arguments.items(): - result = result.replace("{{%s}}" % key, value) + result = result.replace("{{%s}}" % key, str(value)) return result diff --git a/source/logic/main.py b/source/logic/main.py index 79e53fc..ac44b92 100644 --- a/source/logic/main.py +++ b/source/logic/main.py @@ -107,6 +107,7 @@ def main(): "script": implementation_check_kind_script(), "file_state": implementation_check_kind_file_state(), "http_request": implementation_check_kind_http_request(), + "generic_remote" : implementation_check_kind_generic_remote() } ### load notification channel implementations diff --git a/tools/build b/tools/build index d893ef2..511564f 100755 --- a/tools/build +++ b/tools/build @@ -44,6 +44,7 @@ def main(): _os.path.join(dir_source, "logic", "checks", "script.py"), _os.path.join(dir_source, "logic", "checks", "file_state.py"), _os.path.join(dir_source, "logic", "checks", "http_request.py"), + _os.path.join(dir_source, "logic", "checks", "generic_remote.py"), _os.path.join(dir_source, "logic", "channels", "_interface.py"), _os.path.join(dir_source, "logic", "channels", "console.py"), _os.path.join(dir_source, "logic", "channels", "email.py"),