Collection of CheckMK checks (see https://checkmk.com/). All checks and plugins are provided as is. Absolutely no warranty. Send any comments to thl-cmk[at]outlook[dot]com

Skip to content
Snippets Groups Projects
Commit 22c90f7c authored by thl-cmk's avatar thl-cmk :flag_na:
Browse files

update project

parent 2b5150e2
No related branches found
No related tags found
No related merge requests found
[PACKAGE]: ../../raw/master/mkp/curl-0.2.1-20231021.mkp "curl-0.2.1-20231021.mkp"
[PACKAGE]: ../../raw/master/mkp/curl-0.2.0-20240623.mkp "curl-0.2.0-20240623.mkp"
[EXECUTABLE]: ../../raw/master/mkp/curl_executable-20220410.v7.82.0.mkp "curl_executable-20220410.v7.82.0.mkp"
# cURL agent plugin for Linux and Windows
......
File added
......@@ -29,7 +29,8 @@
# 2022-05-15: added workaround for raise ValueError("Cannot render negative timespan")
# 2022-05-17: fixed wrong import path for _TIME_UNITS and _gen_timespan_chunks
# 2023-06-07: moved gui files to ~/local/lib/chek_mk/gui/plugins/...
#
# 2024-06-23: modified imports for cmk 2.3
# removed work around for render negative timespan
# Example output from agent:
#
......@@ -65,49 +66,49 @@
import json
import time
from typing import Dict, Any, List, Iterable
from typing import Any, Dict, List
from cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import (
DiscoveryResult,
CheckResult,
DiscoveryResult,
)
from cmk.base.plugins.agent_based.agent_based_api.v1 import (
register,
Result,
Service,
State,
check_levels,
Result,
register,
render,
)
#
# start workaround for : raise ValueError("Cannot render negative timespan")
#
from cmk.base.api.agent_based.render import (
_TIME_UNITS,
_gen_timespan_chunks,
)
def timespan(seconds: float) -> str:
"""Render a time span in seconds
Example:
>>> timespan(1606721)
'18 days 14 hours'
>>> timespan(0.0001)
'100 microseconds'
"""
if seconds >= 0:
ts = " ".join(_gen_timespan_chunks(float(seconds), nchunks=2))
else:
seconds = -1 * seconds
ts = " ".join(_gen_timespan_chunks(float(seconds), nchunks=2))
ts = f"-{ts}"
if ts == "0 %s" % _TIME_UNITS[-1][0]:
ts = "0 seconds"
return ts
# from cmk.base.api.agent_based.render import (
# _TIME_UNITS,
# _gen_timespan_chunks,
# )
#
#
# def timespan(seconds: float) -> str:
# """Render a time span in seconds
#
# Example:
# >>> timespan(1606721)
# '18 days 14 hours'
# >>> timespan(0.0001)
# '100 microseconds'
#
# """
# if seconds >= 0:
# ts = " ".join(_gen_timespan_chunks(float(seconds), nchunks=2))
# else:
# seconds = -1 * seconds
# ts = " ".join(_gen_timespan_chunks(float(seconds), nchunks=2))
# ts = f"-{ts}"
# if ts == "0 %s" % _TIME_UNITS[-1][0]:
# ts = "0 seconds"
# return ts
#
# end workaround for : raise ValueError("Cannot render negative timespan")
......@@ -442,7 +443,7 @@ def check_curl(item, params, section: Dict[str, Any]) -> CheckResult:
label='Certificate time left',
value=_data['tls_info']['time_left'],
metric_name='cert_time_left',
render_func=timespan,
render_func=render.timespan,
notice_only=True,
levels_upper=upper,
levels_lower=lower,
......
......@@ -13,15 +13,12 @@
# 2022-02-20: added num_connects, num_redirects, size_download, size_header and speed_download
# 2022-03-13: moved cert time left graph to the end of graphs
# 2022-05-17: added scalars to cert_time_left
# 2024-06-23: modified imports for CMK 2.3
from cmk.gui.graphing import perfometer_info
from cmk.gui.graphing._utils import graph_info, metric_info
from cmk.gui.i18n import _
from cmk.gui.plugins.metrics.utils import (
metric_info,
graph_info,
perfometer_info,
)
metric_info['time_namelookup'] = {
'title': _('Time name lookup'),
'unit': 's',
......
......@@ -70,39 +70,37 @@
# 2022-04-26: added check option clickable_url
# clarified option 'Don\'t verify certificate/pub key', 'Don\'t stop at verify errors (certificate/pub key)'
# 2023-10-21: changed for CMK 2.2.0
# 2024-06-23: modified imports for CMK 2.3
# changed PasswordFromStore -> MigrateToIndividualOrStoredPassword
import ipaddress
from cmk.gui.i18n import _
from cmk.gui.cee.plugins.wato.agent_bakery.rulespecs.utils import (
RulespecGroupMonitoringAgentsAgentPlugins,
)
from cmk.gui.exceptions import MKUserError
from cmk.gui.i18n import _
from cmk.gui.plugins.wato.utils import HostRulespec, rulespec_registry
from cmk.gui.valuespec import (
Dictionary,
ListOf,
Alternative,
CAorCAChain,
CascadingDropdown,
TextUnicode,
Checkbox,
Dictionary,
DropdownChoice,
FixedValue,
Foldable,
Integer,
Tuple,
DropdownChoice,
ListOf,
ListOfStrings,
TextInput,
Checkbox,
CAorCAChain,
Optional,
Foldable,
TextInput,
TextUnicode,
Tuple,
UploadOrPasteTextFile,
Alternative,
)
from cmk.gui.plugins.wato.utils import (
rulespec_registry,
HostRulespec,
)
from cmk.gui.plugins.wato.utils import (
PasswordFromStore,
)
from cmk.gui.wato import MigrateToIndividualOrStoredPassword
from cmk.gui.cee.plugins.wato.agent_bakery.rulespecs.utils import (
RulespecGroupMonitoringAgentsAgentPlugins,
)
# unsafe characters https://www.tutorialspoint.com/html/html_url_encoding.htm
forbidden_chars = '"<>#%{}|\^~[]` \''
......@@ -225,7 +223,7 @@ _option_auth_user = ('user_auth',
forbidden_chars=forbidden_chars,
placeholder='username',
),
PasswordFromStore(
MigrateToIndividualOrStoredPassword(
title=_('Password of the user'),
allow_empty=False,
),
......@@ -252,7 +250,7 @@ _option_auth_priv_key = ('priv_key_auth',
forbidden_chars=forbidden_chars,
placeholder='username',
),
PasswordFromStore(
MigrateToIndividualOrStoredPassword(
title=_('Pass phrase'),
allow_empty=False,
),
......@@ -318,7 +316,7 @@ _option_proxy_auth = ('proxy_auth',
forbidden_chars=forbidden_chars,
placeholder='proxyusername',
),
PasswordFromStore(
MigrateToIndividualOrStoredPassword(
title=_('Password of the user'),
allow_empty=False,
),
......@@ -470,9 +468,9 @@ _option_ftp_settings = ('ftp_settings',
TextUnicode(
label=_('Address to use'),
help=_(
'Can be the interface name ie "eth0", a exact ip address, a '
'hostname/FQDN or "-" to use the same address used for the '
'control connection'
'Can be the interface name ie "eth0", a exact ip address,'
' a hostname/FQDN or "-" to use the same address used for'
' the control connection'
),
default_value='-',
regex='[0-9a-zA-Z\\.:\\-_]',
......@@ -637,7 +635,7 @@ _option_api_key_header = ('api_key_header',
forbidden_chars='|"',
placeholder='X-API-Key: ',
),
PasswordFromStore(
MigrateToIndividualOrStoredPassword(
title=_('API Key'),
allow_empty=False,
),
......
......@@ -53,13 +53,10 @@
# reworked to make scalable for multiple OSs (THX to andreas.doehler[at]gmail[dot]com)
# 2022-10-21: moved from ~/local/share/check_mk/agents_bakery to ~/local/lib/check_mk/base/cee/plugins/bakery
from pathlib import Path
from typing import List, Tuple, Dict, Any
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Dict, List
from cmk.utils import (
password_store,
)
from cmk.base.cee.plugins.bakery.bakery_api.v1 import (
FileGenerator,
OS,
......@@ -67,6 +64,7 @@ from cmk.base.cee.plugins.bakery.bakery_api.v1 import (
PluginConfig,
register
)
from cmk.utils import password_store
@dataclass
......@@ -334,7 +332,7 @@ def get_curl_files(conf) -> FileGenerator:
except ValueError: # 2022-03-23: added ssh settings
insecure, ocsp, no_revoke, cert_chain, pub_md5, pub_sha256, pub_key = url_settings['cert_verify']
_options.append(f'--insecure') if insecure else None
_options.append(f'--insecure') if insecure else None
_options.append(f'--cert-status') if ocsp else None
_options.append(f'--ssl-no-revoke') if no_revoke else None
_options.append(f'--hostpubmd5 {pub_md5}') if pub_md5 else None
......
......@@ -28,7 +28,7 @@
'lib': ['python3/cmk/base/cee/plugins/bakery/curl.py']},
'name': 'curl',
'title': 'cURL agent plugin',
'version': '0.2.1-20231021',
'version.min_required': '2.2.0b1',
'version.packaged': '2.2.0p24',
'version.usable_until': '2.3.0b1'}
'version': '0.2.0-20240623',
'version.min_required': '2.3.0b1',
'version.packaged': 'cmk-mkp-tool 0.2.0',
'version.usable_until': '2.4.0b1'}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment