Refactored snapin server_time to new snapin API
[check_mk.git] / checks / netapp_vfiler
blob59f63c0fa6b30334fac3d27b560b15f27b205ce9
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.
32 # netappFiler(1) vfiler(16) vfTable (3) vfEntry (1) vfName (2)
33 # vfState(9)
36 def inventory_netapp_vfiler(info):
37 inventory = []
38 for line in info:
39 # If we find an entry consisting of name and status, add it to inventory.
40 # otherwise we don't inventorize anything.
41 if len(line) == 2:
42 inventory.append((line[0], None))
44 return inventory
46 def check_netapp_vfiler(item, _no_params, info):
47 for vfEntry in info:
48 vfName, vfState = vfEntry
49 if vfName == item:
50 if vfState == "2":
51 return (0, "vFiler is running")
52 elif vfState == "1":
53 return (2, "vFiler is stopped")
54 return (3, "UNKOWN - vFiler status unknown")
55 return (3, "vFiler not found in SNMP output")
58 # get the vfName and vfState from the vfEntry table
64 check_info["netapp_vfiler"] = {
65 'check_function': check_netapp_vfiler,
66 'inventory_function': inventory_netapp_vfiler,
67 'service_description': 'vFiler Status %s',
68 # get the vfName and vfState from the vfEntry table
69 'snmp_info': ('.1.3.6.1.4.1.789.1.16.3.1', ['2', '9']),
70 'snmp_scan_function': \
71 lambda oid: "netapp release" in oid(".1.3.6.1.2.1.1.1.0").lower() and \
72 oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.789"),