#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2019 tribe29 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.


def inventory_steelhead_status(info):
    if len(info) == 1:
        return [(None, None)]


def check_steelhead_status(item, params, info):
    health, status = info[0]
    if health == "Healthy" and status == "running":
        return (0, "Healthy and running")
    return (2, "Status is %s and %s" % (health, status))


check_info["steelhead_status"] = {
    "check_function": check_steelhead_status,
    "inventory_function": inventory_steelhead_status,
    "service_description": "Status",
    "snmp_info": (".1.3.6.1.4.1.17163.1.1.2", [2, 3]),
    "snmp_scan_function": lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.17163."),
}
