#!/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',
# }

def agent_graylog_input_metrics_arguments(params, hostname, ipaddress):
    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
