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 e353db5b authored by thl-cmk's avatar thl-cmk :flag_na:
Browse files

Delete checkpoint_apcl

parent f3b23154
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
#
# 2016-08-01 : monitor Check Point Application control
# 2017-06-17 : added last update check
# 2017-01-03 : fixed inventory function for bad ino data
# 2017-01-03 : fixed lastupdate check
# 2018-03-08 : fixed update status, changed snmp scan function and inventory
# 2018-03-15 : code cleanup
# 2020-06-07 : code cleanup
# 2020-06-08 : changed snmp-scan function
#
# sample info
# [[u'valid', u'Mon Jul 1 01:00:00 2019', u'Contract is up to date.', u'new',
# u'Gateway was updated with database version: 16072904.', u'The next update will be run as scheduled.',
# u'16072904', u'0', u'', u'0', u'', u'']]
#
factory_settings['checkpoint_apcl_defaults'] = {
'no_update_warn': 7,
'no_update_crit': 14,
'timeformat': '%y%m%d'
}
def inventory_checkpoint_apcl(info):
if len(info[0]) == 12:
return[(None, None)]
def check_checkpoint_apcl(item, params, info):
def lastupdate_check(updateversion):
updateversion = updateversion[:-2]
if len(updateversion) == 5:
updateversion = '0' + updateversion
try:
lastupdate = int((time.time() - time.mktime(time.strptime(updateversion, params.get('timeformat', '%y%m%d')))) / 86400)
except ValueError:
return 'unknown'
return lastupdate
subscriptionstatus, subscriptionexpdate, subscriptiondesc, updatestatus, updatedesc, nextupdate, \
version, radstatuscode, radstatusdesc, statuscode, statusshortdesc, statuslongdesc = info[0]
infotext = ''
infotext += 'Subscription: %s, ' % subscriptionstatus
infotext += 'Valid until: %s, ' % subscriptionexpdate
infotext += 'Update status: %s, ' % updatestatus
infotext += 'Version: %s' % version
longoutput = ''
longoutput += '\nSubscription description: %s' % subscriptiondesc
longoutput += '\nUpdate description : %s' % updatedesc
longoutput += '\nNext update : %s' % nextupdate
longoutput += '\nRAD status description : %s' % radstatusdesc
longoutput += '\nStatus short description: %s' % statusshortdesc
longoutput += '\nStatus long description : %s' % statuslongdesc
state = 0
lastupdate = lastupdate_check(version)
if subscriptionstatus != 'valid':
if len(subscriptiondesc) != 0:
yield 1, '%s' % subscriptiondesc
else:
yield 1, 'Subscription is not valid'
if (updatestatus != 'up-to-date') and (updatestatus != 'new'):
yield 1, '%s' % updatedesc
if int(radstatuscode) != 0:
state = max(1, state)
if len(radstatusdesc) != 0:
yield 1, '%s' % radstatusdesc
else:
yield 1, 'Application Control Engine is not up and running'
if lastupdate > params.get('no_update_crit'):
yield 2, 'Last update is %s days ago' % lastupdate
elif lastupdate > params.get('no_update_warn'):
yield 1, 'Last update is %s days ago' % lastupdate
if int(statuscode) != 0:
state = max(2, state)
if len(statuslongdesc) != 0:
yield 2, statuslongdesc
else:
yield 2, 'Not running'
yield state, infotext+longoutput
check_info['checkpoint_apcl'] = {
'check_function' : check_checkpoint_apcl,
'inventory_function' : inventory_checkpoint_apcl,
'default_levels_variable': 'checkpoint_apcl_defaults',
'service_description' : 'Application control',
'group' : 'checkpoint_apcl',
'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.39', [ # CHECKPOINT-MIB
'1.1', # applicationControlSubscriptionStatus
'1.2', # applicationControlSubscriptionExpDate
'1.3', # applicationControlSubscriptionDesc
'2.1', # applicationControlUpdateStatus
'2.2', # applicationControlUpdateDesc
'2.3', # applicationControlNextUpdate
'2.4', # applicationControlVersion
'3.1', # radstatuscode
'3.2', # radstatusdescription
'101', # applicationControlStatusCode
'102', # applicationControlStatusShortDesc
'103', # applicationControlStatusLongDesc
]),
}
\ 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