Cleanup config.nodes_of
[check_mk.git] / checks / netapp_vfiler
blobfe0affe64d892be4c03d2f7f763dcdc8d9508182
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2014 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 # netappFiler(1) vfiler(16) vfTable (3) vfEntry (1) vfName (2)
28 # vfState(9)
31 def inventory_netapp_vfiler(info):
32 inventory = []
33 for line in info:
34 # If we find an entry consisting of name and status, add it to inventory.
35 # otherwise we don't inventorize anything.
36 if len(line) == 2:
37 inventory.append((line[0], None))
39 return inventory
42 def check_netapp_vfiler(item, _no_params, info):
43 for vfEntry in info:
44 vfName, vfState = vfEntry
45 if vfName == item:
46 if vfState == "2":
47 return (0, "vFiler is running")
48 elif vfState == "1":
49 return (2, "vFiler is stopped")
50 return (3, "UNKOWN - vFiler status unknown")
51 return (3, "vFiler not found in SNMP output")
54 # get the vfName and vfState from the vfEntry table
56 check_info["netapp_vfiler"] = {
57 'check_function': check_netapp_vfiler,
58 'inventory_function': inventory_netapp_vfiler,
59 'service_description': 'vFiler Status %s',
60 # get the vfName and vfState from the vfEntry table
61 'snmp_info': ('.1.3.6.1.4.1.789.1.16.3.1', ['2', '9']),
62 'snmp_scan_function': lambda oid: "netapp release" in oid(".1.3.6.1.2.1.1.1.0").lower() and \
63 oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.789"),