#!/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.

from cmk.base.check_legacy_includes.fireeye import scan_fireeye

# .1.3.6.1.4.1.25597.13.1.40.0 1

factory_settings["quarantine_levels"] = {"usage": (70, 80)}


def discover_fireeye_quarantine(string_table):
    if string_table:
        yield None, {}


def check_fireeye_quarantine(no_item, params, info):
    usage = int(info[0][0])
    return check_levels(
        usage,
        "quarantine",
        params["usage"],
        human_readable_func=get_percent_human_readable,
        infoname="Usage",
    )


check_info["fireeye_quarantine"] = {
    "inventory_function": discover_fireeye_quarantine,
    "check_function": check_fireeye_quarantine,
    "service_description": "Quarantine Usage",
    "default_levels_variable": "quarantine_levels",
    "group": "fireeye_quarantine",
    "snmp_info": (
        ".1.3.6.1.4.1.25597.13.1.40",
        [
            "0",  # FE-FIREEYE-MIB::feeQuarantineUsage
        ],
    ),
    "snmp_scan_function": scan_fireeye,
    "has_perfdata": True,
}
