2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2015 mk@mathias-kettner.de |
11 # +------------------------------------------------------------------+
13 # This file is part of Check_MK.
14 # The official homepage is at http://mathias-kettner.de/check_mk.
16 # check_mk is free software; you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by
18 # the Free Software Foundation in version 2. check_mk is distributed
19 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
20 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
22 # tails. You should have received a copy of the GNU General Public
23 # License along with GNU Make; see the file COPYING. If not, write
24 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
25 # Boston, MA 02110-1301 USA.
27 # We are not sure how to safely detect the UCD SNMP Daemon. We know that
28 # it is mainly used on Linux, but not only. But fetching and OID outside
29 # of the info area for scanning is not a good idea. It will slow down
30 # scans for *all* hosts.
32 # ---ucd cpu load---------------------------------------------------------
34 # We prefer HOST-RESOURCES-MIB implementation but not in case
35 # of check 'ucd_cpu_load' because the HR-MIB has not data
43 # ---general ucd/hr-------------------------------------------------------
47 return bool(oid('.1.3.6.1.2.1.25.1.1.0'))
50 def prefer_hr_else_ucd(oid
):
51 return _is_ucd(oid
) and not oid(".1.3.6.1.2.1.25.1.1.0")
54 # ---memory---------------------------------------------------------------
58 # Avoid inverting output of a function in a check plugin and be
59 # descriptive about what a function is actually doing
62 return _is_ucd_mem(oid
)
66 # We prefer HOST-RESOURCES-MIB implementation but not in case
67 # of devices, which are known to report incorrect information
71 return not _is_ucd_mem(oid
)
74 # ---helper---------------------------------------------------------------
76 # Within _is_ucd or _is_ucd_mem we make use of a whitelist
77 # in order to expand this list of devices easily.
81 sys_descr
= oid(".1.3.6.1.2.1.1.1.0").lower()
85 "hp onboard administrator",
93 # Artec email archive appliances
94 if oid('.1.3.6.1.2.1.1.2.0') == '.1.3.6.1.4.1.8072.3.2.10' \
95 and "version" in sys_descr
and "serial" in sys_descr
:
101 def _is_ucd_mem(oid
):
102 sys_descr
= oid(".1.3.6.1.2.1.1.1.0").lower()
103 # Devices for which ucd_mem should be used
104 # if and only if HR-table is not available
109 if name
in sys_descr
and not oid(".1.3.6.1.2.1.25.1.1.0"):
112 # Astaro and Synology are Linux but should use hr_mem
113 # Otherwise Cache/Buffers are included in used memory
114 # generating critical state
115 if oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.8072."):
118 # Otherwise use ucd_mem for listed devices in _is_ucd.
122 def _ignore_both(oid
):
123 # Some devices report incorrect data on both HR and UCD, eg. F5 BigIP
124 return oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.3375")