/usr/share/check_mk/checks/mbg_lantime_refclock 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 105 106 107 | #!/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.
mbg_lantime_refclock_refmode_map = {
'0': 'notavailable',
'1': 'normalOperation',
'2': 'trackingSearching',
'3': 'antennaFaulty',
'4': 'warmBoot',
'5': 'coldBoot',
'6': 'antennaShortcircuit',
}
mbg_lantime_refclock_gpsstate_map = {
'0': 'not available',
'1': 'synchronized',
'2': 'not synchronized',
}
# number of good satellites
mbg_lantime_refclock_default_levels = (3, 3)
def inventory_mbg_lantime_refclock(info):
if len(info) > 0 and len(info[0]) == 6:
return [(None, None, "mbg_lantime_refclock_default_levels")]
def check_mbg_lantime_refclock(item, params, info):
if len(info) > 0 and len(info[0]) == 6:
ref_mode, gps_state, gps_pos, gps_sat_good, gps_sat_total, gps_mode = info[0]
state = 0
state_txt = []
# Handle the reported refclock mode
thr_txt = ''
if ref_mode in [ '0', '3', '6' ]:
state = max(state, 2)
thr_txt = ' (!!)'
elif ref_mode in [ '2', '4', '5' ]:
state = max(state, 1)
thr_txt = ' (!)'
state_txt.append('Refclock State: %s%s' % (mbg_lantime_refclock_refmode_map.get(ref_mode, 'UNKNOWN'), thr_txt))
# Handle gps state
thr_txt = ''
if gps_state in [ '0', '2' ]:
state = max(state, 2)
thr_txt = ' (!!)'
state_txt.append('GPS State: %s%s' % (mbg_lantime_refclock_gpsstate_map.get(gps_state, 'UNKNOWN'), thr_txt))
# Add gps position
state_txt.append(gps_pos)
# Handle number of satellites
thr_txt = ''
if params[0] is not None and int(gps_sat_good) < params[1]:
state = max(state, 2)
thr_txt = ' (!!)'
elif params[1] is not None and int(gps_sat_good) < params[0]:
state = max(state, 1)
thr_txt = ' (!)'
state_txt.append('Satellites: %s/%s%s' % (gps_sat_good, gps_sat_total, thr_txt))
perfdata = [('sat_good', gps_sat_good, params[0], params[1]),
('sat_total', gps_sat_total) ]
return (state, '%s - %s' % (nagios_state_names[state], ', '.join(state_txt)), perfdata)
return (3, 'UNKNOWN - Got no state information')
check_info['mbg_lantime_refclock'] = ( check_mbg_lantime_refclock, "LANTIME Refclock", 1, inventory_mbg_lantime_refclock )
snmp_info['mbg_lantime_refclock'] = ( ".1.3.6.1.4.1.5597.3.2", [
4, # MBG-SNMP-MIB::mbgLtRefClockModeVal
6, # MBG-SNMP-MIB::mbgLtRefGpsStateVal
7, # MBG-SNMP-MIB::mbgLtRefGpsPosition
9, # MBG-SNMP-MIB::mbgLtRefGpsSatellitesGood
10, # MBG-SNMP-MIB::mbgLtRefGpsSatellitesInView
16, # MBG-SNMP-MIB::mbgLtRefGpsModeVal
])
snmp_scan_functions['mbg_lantime_refclock'] \
= lambda oid: oid(".1.3.6.1.2.1.1.2.0") == ".1.3.6.1.4.1.5597.3"
|