checkmk-plugins/check_mk-infoblox/local/share/check_mk/checks/infoblox_aat5_count

50 lines
2.0 KiB
Python

#!/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.
# NOTE: Careful when replacing the *-import below with a more specific import. This can cause
# problems because it might remove variables from the check-context which are necessary for
# resolving legacy discovery results such as [("SUMMARY", "diskstat_default_levels")]. Furthermore,
# it might also remove variables needed for accessing discovery rulesets.
from cmk.base.check_legacy_includes.infoblox import * # pylint: disable=wildcard-import,unused-wildcard-import
#ibNetworkMonitorDNSAAT5Count(.1.3.6.1.4.1.7779.3.1.1.2.1.3.1.3.2.2.0)--)--DNS AAT5 Count"
infoblox_aat5_count_default_levels = (50, 100)
def inventory_infoblox_aat5_count(info):
item = "DNS AAT5 Count"
yield item, {}
def check_infoblox_aat5_count(item, params, info):
count=int(info[0][0])
if params:
warn, crit = params['infoblox_count']
else:
warn, crit = (50, 100)
state = 0
count_info = ""
if count > warn:
if count > crit:
state = 2
count_info = "Number of AAT Requests is %s (crit above %s requests)" % (count, crit)
else:
state = 1
count_info = "Number of AAT Requests is %s (warn above %s requests)" % (count, warn)
else:
count_info = "Number of AAT Requests is %s" % count
yield state, count_info, [('Count', count, warn, crit)]
check_info['infoblox_aat5_count'] = {
'default_levels_variable': 'infoblox_aat5_count_default_levels',
'inventory_function': inventory_infoblox_aat5_count,
'check_function': check_infoblox_aat5_count,
'service_description': '%s',
'snmp_info': ( ".1.3.6.1.4.1.7779.3.1.1.2.1.3.1.3.2.2", ["0"] ),
'snmp_scan_function': scan_infoblox,
'has_perfdata': True,
'group': 'infoblox_count',
}