From ed342bddc52152a29552778cbbba437a96d156b5 Mon Sep 17 00:00:00 2001 From: Marius Rieder Date: Mon, 3 Jul 2023 05:37:08 +0000 Subject: [PATCH] Migrate from legacy plugins --- .devcontainer/symlink.sh | 5 +++++ .../plugins/metrics => metrics}/veeam_o365jobs.py | 15 ++++++++++++++- .../metrics => metrics}/veeam_o365licenses.py | 2 +- package | 15 ++++++++------- .../agent_bakery/veeam_o365.py | 2 +- .../check_parameters/veeam_o365jobs.py | 0 .../check_parameters/veeam_o365licenses.py | 2 +- 7 files changed, 30 insertions(+), 11 deletions(-) rename {web/plugins/metrics => metrics}/veeam_o365jobs.py (86%) rename {web/plugins/metrics => metrics}/veeam_o365licenses.py (97%) rename web/plugins/wato/agent_bakery_veeam_o365.py => wato/agent_bakery/veeam_o365.py (97%) rename web/plugins/wato/check_parameters_veeam_o365jobs.py => wato/check_parameters/veeam_o365jobs.py (100%) rename web/plugins/wato/check_parameters_veeam_o365licenses.py => wato/check_parameters/veeam_o365licenses.py (98%) diff --git a/.devcontainer/symlink.sh b/.devcontainer/symlink.sh index a9b5e65..18d6cf6 100755 --- a/.devcontainer/symlink.sh +++ b/.devcontainer/symlink.sh @@ -8,6 +8,11 @@ done; rm -rfv $OMD_ROOT/local/lib/python3/cmk/base/plugins/agent_based ln -sv $WORKSPACE/agent_based $OMD_ROOT/local/lib/python3/cmk/base/plugins/agent_based +for DIR in 'wato' 'metrics'; do + rm -rfv $OMD_ROOT/local/lib/python3/cmk/gui/plugins/$DIR + ln -sv $WORKSPACE/$DIR $OMD_ROOT/local/lib/python3/cmk/gui/plugins/$DIR +done; + mkdir -p $OMD_ROOT/local/lib/python3/cmk/base/cee/plugins ln -sv $WORKSPACE/bakery $OMD_ROOT/local/lib/python3/cmk/base/cee/plugins/bakery diff --git a/web/plugins/metrics/veeam_o365jobs.py b/metrics/veeam_o365jobs.py similarity index 86% rename from web/plugins/metrics/veeam_o365jobs.py rename to metrics/veeam_o365jobs.py index a928eb9..3365403 100644 --- a/web/plugins/metrics/veeam_o365jobs.py +++ b/metrics/veeam_o365jobs.py @@ -19,7 +19,7 @@ from cmk.gui.i18n import _ -from cmk.gui.plugins.metrics import ( +from cmk.gui.plugins.metrics.utils import ( check_metrics, metric_info, graph_info, @@ -32,6 +32,7 @@ 'transferred': {'name': 'veeam_o365jobs_transferred'}, 'duration': {'name': 'veeam_o365jobs_duration'}, 'items': {'name': 'veeam_o365jobs_items'}, + 'age': {'name': 'veeam_o365jobs_age'}, } @@ -53,6 +54,12 @@ 'color': '#00b336', } +metric_info['veeam_o365jobs_age'] = { + 'title': _('Time since last successfull run'), + 'unit': 's', + 'color': '#00b336', +} + graph_info['veeam_o365jobs_transferred'] = { 'title': _('Veeam for Office 365 Job'), @@ -76,6 +83,12 @@ 'range': (0, 'veeam_o365jobs_items:max'), } +graph_info['veeam_o365jobs_age'] = { + 'title': _('Veeam for Office 365 Job'), + 'metrics': [('veeam_o365jobs_age', 'area')], + 'range': (0, 'veeam_o365jobs_age:max'), +} + perfometer_info.append({ 'type': 'stacked', diff --git a/web/plugins/metrics/veeam_o365licenses.py b/metrics/veeam_o365licenses.py similarity index 97% rename from web/plugins/metrics/veeam_o365licenses.py rename to metrics/veeam_o365licenses.py index 48d0e5b..1089241 100644 --- a/web/plugins/metrics/veeam_o365licenses.py +++ b/metrics/veeam_o365licenses.py @@ -19,7 +19,7 @@ from cmk.gui.i18n import _ -from cmk.gui.plugins.metrics import ( +from cmk.gui.plugins.metrics.utils import ( check_metrics, metric_info, graph_info, diff --git a/package b/package index a1ca21f..577ddce 100644 --- a/package +++ b/package @@ -8,16 +8,17 @@ 'windows/plugins/veeam_o365_status.ps1', ], 'checkman': ['veeam_o365jobs', 'veeam_o365licenses'], + 'gui': [ + 'metrics/veeam_o365jobs.py', + 'metrics/veeam_o365licenses.py', + 'wato/agent_bakery/veeam_o365.py', + 'wato/check_parameters/veeam_o365licenses.py', + 'wato/check_parameters/veeam_o365jobs.py', + ], 'lib': [ 'python3/cmk/base/cee/plugins/bakery/veeam_o365.py', ], - 'web': [ - 'plugins/metrics/veeam_o365jobs.py', - 'plugins/metrics/veeam_o365licenses.py', - 'plugins/wato/agent_bakery_veeam_o365.py', - 'plugins/wato/check_parameters_veeam_o365licenses.py', - 'plugins/wato/check_parameters_veeam_o365jobs.py', - ]}, + }, 'name': 'veeam_o365', 'title': u'Veeam for Office 365 Checks', 'version': '2.6.1', diff --git a/web/plugins/wato/agent_bakery_veeam_o365.py b/wato/agent_bakery/veeam_o365.py similarity index 97% rename from web/plugins/wato/agent_bakery_veeam_o365.py rename to wato/agent_bakery/veeam_o365.py index b3a976d..744c394 100644 --- a/web/plugins/wato/agent_bakery_veeam_o365.py +++ b/wato/agent_bakery/veeam_o365.py @@ -21,7 +21,7 @@ from cmk.gui.valuespec import ( DropdownChoice, ) -from cmk.gui.plugins.wato import ( +from cmk.gui.plugins.wato.utils import ( HostRulespec, rulespec_registry, ) diff --git a/web/plugins/wato/check_parameters_veeam_o365jobs.py b/wato/check_parameters/veeam_o365jobs.py similarity index 100% rename from web/plugins/wato/check_parameters_veeam_o365jobs.py rename to wato/check_parameters/veeam_o365jobs.py diff --git a/web/plugins/wato/check_parameters_veeam_o365licenses.py b/wato/check_parameters/veeam_o365licenses.py similarity index 98% rename from web/plugins/wato/check_parameters_veeam_o365licenses.py rename to wato/check_parameters/veeam_o365licenses.py index 3328920..079ba97 100644 --- a/web/plugins/wato/check_parameters_veeam_o365licenses.py +++ b/wato/check_parameters/veeam_o365licenses.py @@ -26,7 +26,7 @@ TextAscii, Tuple, ) -from cmk.gui.plugins.wato import ( +from cmk.gui.plugins.wato.utils import ( CheckParameterRulespecWithItem, RulespecGroupCheckParametersApplications, rulespec_registry,