This file is indexed.

/usr/share/check_mk/checks/hp_procurve_sensors is in check-mk-server 1.1.12-1ubuntu1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# |             ____ _               _        __  __ _  __           |
# |            / ___| |__   ___  ___| | __   |  \/  | |/ /           |
# |           | |   | '_ \ / _ \/ __| |/ /   | |\/| | ' /            |
# |           | |___| | | |  __/ (__|   <    | |  | | . \            |
# |            \____|_| |_|\___|\___|_|\_\___|_|  |_|_|\_\           |
# |                                                                  |
# | Copyright Mathias Kettner 2010             mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software;  you can redistribute it and/or modify it
# under the  terms of the  GNU General Public License  as published by
# the Free Software Foundation in version 2.  check_mk is  distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;  with-
# out even the implied warranty of  MERCHANTABILITY  or  FITNESS FOR A
# PARTICULAR PURPOSE. See the  GNU General Public License for more de-
# ails.  You should have  received  a copy of the  GNU  General Public
# License along with GNU Make; see the file  COPYING.  If  not,  write
# to the Free Software Foundation, Inc., 51 Franklin St,  Fifth Floor,
# Boston, MA 02110-1301 USA.

# Author: Lars Michelsen <lm@mathias-kettner.de>

# Relevant SNMP OIDs:
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.1.1 1
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.1.2 2
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.1.3 3
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.1.4 4
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.2.1 SNMPv2-SMI::enterprises.11.2.3.7.8.3.2
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.2.2 SNMPv2-SMI::enterprises.11.2.3.7.8.3.1
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.2.3 SNMPv2-SMI::enterprises.11.2.3.7.8.3.1
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.2.4 SNMPv2-SMI::enterprises.11.2.3.7.8.3.3
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.3.1 1
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.3.2 1
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.3.3 1
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.3.4 1
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.4.1 4
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.4.2 4
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.4.3 5
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.4.4 4
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.5.1 0
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.5.2 0
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.5.3 0
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.5.4 0
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.6.1 0
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.6.2 0
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.6.3 0
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.6.4 0
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.7.1 "Fan Sensor"
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.7.2 "Power Supply Sensor"
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.7.3 "Redundant Power Supply Sensor"
# .1.3.6.1.4.1.11.2.14.11.1.2.6.1.7.4 "Over-temperature Sensor"

# Status codes:
# 1 => unknown,
# 2 => bad,
# 3 => warning
# 4 => good,
# 5 => notPresent

# GENERAL MAPS:

hp_procurve_status_map = { '1': 'unknown', '2': 'bad', '3': 'warning', '4': 'good', '5': 'notPresent' }
hp_procurve_status2nagios_map = { 'unknown': 3, 'bad': 2, 'warning': 1, 'good': 0, 'notPresent': 1 }

def get_hp_procurve_sensor_type(type_input):
    type = ''
    if type_input.endswith('11.2.3.7.8.3.1'):
        type = 'PSU'
    elif type_input.endswith('11.2.3.7.8.3.2'):
        type = 'FAN'
    elif type_input.endswith('11.2.3.7.8.3.3'):
        type = 'Temp'
    elif type_input.endswith('11.2.3.7.8.3.4'):
        type = 'FutureSlot'
    return type

def inventory_hp_procurve_sensors(info):
    inventory = []
    for line in info:
        if len(line) == 4 and hp_procurve_status_map[line[2]] != 'notPresent':
            inventory.append((line[0], None))
    return inventory

def check_hp_procurve_sensors(item, _not_used, info):
    for line in info:
        if line[0] == item:
            procurve_status = hp_procurve_status_map[line[2]]
            status = hp_procurve_status2nagios_map[procurve_status]

            return (status, '%s - Condition of %s "%s" is %s' %
                      (nagios_state_names[status], get_hp_procurve_sensor_type(line[1]), line[3], procurve_status))
    return (3, "UNKNOWN - item not found in snmp data")


check_info['hp_procurve_sensors'] = (check_hp_procurve_sensors, "Sensor %s", 0,  inventory_hp_procurve_sensors)
snmp_info['hp_procurve_sensors']  = ( ".1.3.6.1.4.1.11.2.14.11.1.2.6.1", [ "1", "2", "4", "7" ] )
snmp_scan_functions['hp_procurve_sensors'] = \
    lambda oid: ".11.2.3.7.11" in oid(".1.3.6.1.2.1.1.2.0")