Collection of CheckMK checks (see https://checkmk.com/). All checks and plugins are provided as is. Absolutely no warranty. Send any comments to thl-cmk[at]outlook[dot]com

Skip to content
Snippets Groups Projects
Commit d2440e7c authored by thl-cmk's avatar thl-cmk :flag_na:
Browse files

Delete checkpoint_fw_ls

parent 7eecce08
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
#
# License: GNU General Public License v2
#
# Author: thl-cmk[at]outlook[dot]com
# URL : https://thl-cmk.hopto.org
#
# 19.07.2016 : monitor Check Point FW Log server status
# 24.07.2016 : changed for check state
# 05.01.2018 : fix inventory function
# 08.03.2018 : changed snmp scan function and inventory function
# 15.03.2018 : code cleanup
# 08.06.2020 : changed snmp-scan function
#
# sample snmpwalk
#
# CHECKPOINT-MIB::fwLSConnOverall.0 = INTEGER: 0
# CHECKPOINT-MIB::fwLSConnOverallDesc.0 = STRING: Security Gateway is reporting logs as defined
# CHECKPOINT-MIB::fwLSConnIndex.1.0 = Gauge32: 1
# CHECKPOINT-MIB::fwLSConnIndex.2.0 = Gauge32: 2
# CHECKPOINT-MIB::fwLSConnName.1.0 = STRING: 10.140.2.203
# CHECKPOINT-MIB::fwLSConnName.2.0 = STRING: 10.140.2.103
# CHECKPOINT-MIB::fwLSConnState.1.0 = Gauge32: 0
# CHECKPOINT-MIB::fwLSConnState.2.0 = Gauge32: 2
# CHECKPOINT-MIB::fwLSConnStateDesc.1.0 = STRING: Log-Server Connected
# CHECKPOINT-MIB::fwLSConnStateDesc.2.0 = STRING: Log-Server Disconnected
# CHECKPOINT-MIB::fwLSConnSendRate.1.0 = Gauge32: 0
# CHECKPOINT-MIB::fwLSConnSendRate.2.0 = Gauge32: 0
# CHECKPOINT-MIB::fwLocalLoggingDesc.0 = STRING: Logs are written to log server
# CHECKPOINT-MIB::fwLocalLoggingStat.0 = INTEGER: 0
# CHECKPOINT-MIB::fwLocalLoggingWriteRate.0 = Gauge32: 0
# CHECKPOINT-MIB::fwLoggingHandlingRate.0 = Gauge32: 0
#
# .1.3.6.1.4.1.2620.1.1.30.1.0 = INTEGER: 0
# .1.3.6.1.4.1.2620.1.1.30.2.0 = STRING: "Security Gateway is reporting logs as defined"
# .1.3.6.1.4.1.2620.1.1.30.3.1.1.1.0 = Gauge32: 1
# .1.3.6.1.4.1.2620.1.1.30.3.1.1.2.0 = Gauge32: 2
# .1.3.6.1.4.1.2620.1.1.30.3.1.2.1.0 = STRING: "10.140.2.203"
# .1.3.6.1.4.1.2620.1.1.30.3.1.2.2.0 = STRING: "10.140.2.103"
# .1.3.6.1.4.1.2620.1.1.30.3.1.3.1.0 = Gauge32: 0
# .1.3.6.1.4.1.2620.1.1.30.3.1.3.2.0 = Gauge32: 2
# .1.3.6.1.4.1.2620.1.1.30.3.1.4.1.0 = STRING: "Log-Server Connected"
# .1.3.6.1.4.1.2620.1.1.30.3.1.4.2.0 = STRING: "Log-Server Disconnected"
# .1.3.6.1.4.1.2620.1.1.30.3.1.5.1.0 = Gauge32: 0
# .1.3.6.1.4.1.2620.1.1.30.3.1.5.2.0 = Gauge32: 0
# .1.3.6.1.4.1.2620.1.1.30.4.0 = STRING: "Logs are written to log server"
# .1.3.6.1.4.1.2620.1.1.30.5.0 = INTEGER: 0
# .1.3.6.1.4.1.2620.1.1.30.6.0 = Gauge32: 0
# .1.3.6.1.4.1.2620.1.1.30.7.0 = Gauge32: 0
#
#
# sample info
# log server running
# [[[u'0', u'Security Gateway is reporting logs as defined', u'Logs are written to log server', u'0']],
# [[u'1', u'192.168.10.10', u'0', u'Log-Server Connected'],
# [u'2', u'192.168.10.11', u'2', u'Backup Log-Server Not Active']]]
#
# no log server
# [[], []]
#
factory_settings['checkpoint_fw_ls_defaults'] = {
}
def inventory_checkpoint_fw_ls(info):
if info != [[], []]:
over_all, log_servers = info
# check for over all log status
yield 'over all', None
for log_server in log_servers:
fwLSConnIndex, fwLSConnName, fwLSConnState, fwLSConnStateDesc, fwLSConnSendRate = log_server
# check per Log Server
fw_ls_info = {'fwlsconnstate': int(fwLSConnState), }
yield fwLSConnName, fw_ls_info
def check_checkpoint_fw_ls(item, params, info):
fwLSConnOverall = {
0: 'Ok',
1: 'Warnning',
2: 'Error',
}
fwLSConnState_des = {
0: 'Ok',
1: 'Error',
2: 'Not Active',
}
fwLocalLoggingStat = {
0: 'Logging to log servers',
1: 'Logging local configured',
2: 'Logging local due to connectivity',
3: 'Logging local due to high rate',
}
infotext = 'item not found'
longoutput = ''
perfdata = None
state = 3
over_all, log_servers = info
for log_server in log_servers:
fwLSConnIndex, fwLSConnName, fwLSConnState, fwLSConnStateDesc, fwLSConnSendRate = log_server
fwLSConnState = int(fwLSConnState)
if item == fwLSConnName:
infotext = fwLSConnStateDesc
if fwLSConnSendRate.isdigit(): # R80.10 and up
fwLSConnSendRate = int(fwLSConnSendRate)
perfdata = [('fwlsconnsendrate', fwLSConnSendRate)]
state = 0
if fwLSConnState == 1:
yield 2, 'Connection error'
if params.get('fwlsconnstate') != fwLSConnState:
yield 2, ', State change(found/expected): %s/%s' % (fwLSConnState_des.get(fwLSConnState), fwLSConnState_des.get(params.get('fwlsconnstate')))
if item == 'over all':
fwlsconnoverall, fwlsconnoveralldesc, fwlocalloggingdesc, fwlocalloggingstat, fwLocalLoggingWriteRate, fwLoggingHandlingRate = over_all[0]
fwlocalloggingstat = int(fwlocalloggingstat)
fwlsconnoverall = int(fwlsconnoverall)
infotext = ''
state = 0
if fwLocalLoggingWriteRate.isdigit() and fwLoggingHandlingRate.isdigit(): # R80.10 and up
fwLocalLoggingWriteRate = int(fwLocalLoggingWriteRate)
fwLoggingHandlingRate = int(fwLoggingHandlingRate)
perfdata = [('fwlocalloggingwriterate', fwLocalLoggingWriteRate),
('fwlogginghandlingrate', fwLoggingHandlingRate),
]
message = '%s' % (fwlsconnoveralldesc)
if fwlsconnoverall == 0:
infotext += message
elif fwlsconnoverall == 1:
yield 1, message
elif fwlsconnoverall == 2:
yield 2, message
message = '%s' % (fwlocalloggingdesc)
if fwlocalloggingstat == 1 or fwlocalloggingstat == 3:
yield 1, message
elif fwlocalloggingstat == 2:
yield 2, message
else:
infotext += ', %s' % message
yield state, infotext + longoutput, perfdata
check_info['checkpoint_fw_ls'] = {
'check_function' : check_checkpoint_fw_ls,
'inventory_function' : inventory_checkpoint_fw_ls,
'default_levels_variable': 'checkpoint_fw_ls_defaults',
'service_description' : 'FW Log server %s',
'group' : 'cp_fw_ls',
'has_perfdata' : True,
'snmp_scan_function': lambda oid: (oid('.1.3.6.1.2.1.1.2.0').startswith('.1.3.6.1.4.1.2620.1.6.123.1') or
oid('.1.3.6.1.2.1.1.2.0').startswith('.1.3.6.1.4.1.8072.3.2.10')) and
oid('.1.3.6.1.4.1.2620.1.6.1.0', '').lower().startswith('svn foundation'),
'snmp_info' : [
('.1.3.6.1.4.1.2620.1.1.30', [ # CHECKPOINT-MIB:fwLSConn
'1', # fwLSConnOverall
'2', # fwLSConnOverallDesc
'4', # fwLocalLoggingDesc
'5', # fwLocalLoggingStat
'6', # fwLocalLoggingWriteRate
'7', # fwLoggingHandlingRate
]),
('.1.3.6.1.4.1.2620.1.1.30.3.1', [ # CHECKPOINT-MIB::fwLSConnEntry
'1', # fwLSConnIndex
'2', # fwLSConnName
'3', # fwLSConnState
'4', # fwLSConnStateDesc
'5', # fwLSConnSendRate
]),
],
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment