checkmk-plugins/check_mk-graylog_metrics/local/share/check_mk/checks/agent_graylog_input_metrics

40 lines
1.0 KiB
Python

#!/usr/bin/env python3
# Copyright (C) 2019 Checkmk GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.
#
# {
# 'proto': 'http',
# 'port': 9000,
# 'user': 'hell',
# 'password': 'yeah',
# }
from typing import Any, Mapping, Optional, Sequence, Union
def agent_graylog_input_metrics_arguments(
params: Mapping[str, Any], hostname: str, ipaddress: Optional[str]
) -> Sequence[Union[str, tuple[str, str, str]]]:
args = [
"-P",
params["protocol"],
"-u",
params["user"],
"-s",
passwordstore_get_cmdline("%s", params["password"]),
]
if "port" in params:
args += ["-p", params["port"]]
if "no-cert-check" in params:
args += ["--no-cert-check"]
args.append(params["instance"])
return args
special_agent_info["graylog_input_metrics"] = agent_graylog_input_metrics_arguments