/usr/share/check_mk/checks/sophos is in check-mk-server 1.2.8p16-1ubuntu0.1.
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 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | #!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2015 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-
# tails. 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.
# .1.3.6.1.4.1.2604.3.4 2 --> SOPHOS::sophosHwMemoryConsumption Indicates whether the appliance is consuming excessive memory
# .1.3.6.1.4.1.2604.3.5 2 --> SOPHOS::sophosHwMemoryStatus Indicates whether the appliance detects less memory than expected
# .1.3.6.1.4.1.2604.3.6 0 --> SOPHOS::sophosHwRaid Indicates whether the appliance RAID system is operating normally
# .1.3.6.1.4.1.2604.3.7 2 --> SOPHOS::sophosHwCpuStatus Indicates whether the appliance CPU is operating normally
# .1.3.6.1.4.1.2604.3.8 0 --> SOPHOS::sophosHwPowerSupplyLeft Indicates whether the left power supply is operating normally
# .1.3.6.1.4.1.2604.3.9 0 --> SOPHOS::sophosHwPowerSupplyRight Indicates whether the right power supply is operating normally
# .1.3.6.1.4.1.2604.3.10 0 --> SOPHOS::sophosHwPowerSupplyFanLeft Indicates whether the left power supply fan is operating normally
# .1.3.6.1.4.1.2604.3.11 0 --> SOPHOS::sophosHwPowerSupplyFanRight Indicates whether the left power supply fan is operating normally
# .1.3.6.1.4.1.2604.3.12 2 --> SOPHOS::sophosHwSystemFan Indicates whether all fans are operating normally
# .1.3.6.1.4.1.2604.3.13 2 --> SOPHOS::sophosHwTemperature Indicates whether the appliance is operating within an acceptable temperature range
# .1.3.6.1.4.1.2604.3.14 2 --> SOPHOS::sophosHwVoltage Indicates whether the appliance is operating within normal voltage ranges
# .1.3.6.1.4.1.2604.3.16 2 --> SOPHOS::sophosHwPowerSupplies Indicates whether both power supplies are operating normally
sophos_map_oid = {
"4" : ("Memory Consumption", {
"2" : " (the appliance is consuming normal memory)",
"3" : " (the appliance is consuming inflated memory)",
"4" : " (the appliance is consuming excessive memory)",
}),
"5" : ("Memory", {
"2" : " (the appliance detects memory than expected)",
"3" : " (the appliance detects less memory than expected)",
"4" : " (the appliance detects insufficient memory than expected)",
}),
"6" : ("RAID", {
"2" : " (the appliance RAID system is operating normally)",
"3" : " (the appliance RAID system is operating abnormally)",
"4" : " (the appliance RAID system is operating viciously)",
}),
"7" : ("CPU Utilization", {
"2" : " (the appliance CPU is operating normally)",
"3" : " (the appliance CPU is operating abnormally)",
"4" : " (the appliance CPU is operating viciously)",
}),
"8" : ("Power Supply Left", {
"2" : " (the left power supply is operating normally)",
"3" : " (the left power supply is operating abnormally)",
"4" : " (the left power supply is operating viciously)",
}),
"9" : ("Power Supply Right", {
"2" : " (the right power supply is operating normally)",
"3" : " (the right power supply is operating abnormally)",
"4" : " (the right power supply is operating viciously)",
}),
"10" : ("Fan Left", {
"2" : " (the left fan is operating normally)",
"3" : " (the left fan is operating abnormally)",
"4" : " (the left fan is operating viciously)",
}),
"11" : ("Fan Right", {
"2" : " (the right fan is operating normally)",
"3" : " (the right fan is operating abnormally)",
"4" : " (the right fan is operating viciously)",
}),
"12" : ("Fan Summary", {
"2" : " (all fans are operating normally)",
"3" : " (all fans are operating abnormally)",
"4" : " (all fans are operating viciously)",
}),
"13" : ("Temperature", {
"2" : " (the appliance is operating within an acceptable temperature range)",
"3" : " (the appliance is operating in the margins of an acceptable temperature range)",
"4" : " (the appliance is operating outside an acceptable temperature range)",
}),
"14" : ("Power Supply Voltage", {
"2" : " (the appliance is operating within a normal voltage range)",
"3" : " (the appliance is operating in the margins of a normal voltage range)",
"4" : " (the appliance is operating outside of a normal voltage range)",
}),
"16" : ("Power Supply Summary", {
"2" : " (both power supplies are operating normally)",
"3" : " (one or both power supplies are operating abnormally)",
"4" : " (one or both power supplies are operating viciously)",
}),
}
def inventory_sophos(info):
inventory = []
for item_oid, item_state in info:
if item_oid in sophos_map_oid and item_state in ["2", "3", "4"]:
inventory.append( (sophos_map_oid[item_oid][0], None) )
return inventory
def check_sophos(item, _no_params, info):
sophos_map_state = {
"0" : (3, "unknown"),
"1" : (3, "disabled"),
"2" : (0, "OK"),
"3" : (1, "warn"),
"4" : (2, "error"),
}
for item_oid, item_state in info:
item_name, item_info = sophos_map_oid.get(item_oid, (None, None))
if item_name == item:
state, state_readable = sophos_map_state[item_state]
extra_info = item_info.get(item_state, "")
infotext = "Status: %s%s" % (state_readable, extra_info)
return state, infotext
check_info['sophos'] = {
'inventory_function' : inventory_sophos,
'check_function' : check_sophos,
'service_description' : '%s',
'snmp_info' : (".1.3.6.1.4.1.2604.3",[ OID_END, "" ]),
'snmp_scan_function' : lambda oid: oid(".1.3.6.1.2.1.1.2.0") == ".1.3.6.1.4.1.2604",
}
|