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

cleanup

parents
No related branches found
No related tags found
No related merge requests found
# Check Point Application control
Monitors status of Check Point Application control blade
Check Info:
* *service*: this check will create the service *Application control*
* *state*:
**warning**
* if the supscription is not *valid*
* if the update status is not *up-to-date* or *new*
* if the Application Control Engine is not up and running
**critical**
* if the service is not running
**critical**/**warning**
* if the Application control database was not updated
* *wato*: war/crit levels for last update for the Application control database in days (default 7/14 days)
* *perfdata*: none
Sample output
![sample output](/doc/sample.png?raw=true "sample [SHORT TITLE]")
File added
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
#
# 01.08.2016 : Th.L. : monitor Check Point Application control
# 17.06.2017 : Th.L. : added last update check
# 03.01.2017 : Th.L. : fixed inventory function for bad ino data
# 03.01.2017 : Th.L. : fixed lastupdate check
# 08.03.2018 : Th.L. : fixed update status, changed snmp scan function and inventory
# 15.03.2018 : Th.L. : code cleanup
#
# 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,
}
def inventory_checkpoint_apcl(info):
return[(None, None)]
def check_checkpoint_apcl(item, params, info):
def lastupdate_check(updateversion):
try:
# time.time() : time in seconds since the epoch (1970)
# time.strptime(updateversion[:6], '%y%m%d') : convert sting in time tuple
# time.mktime(time tuple) : convert time tuple in seconds since the epoch
# seconds/86400 : convert in days
# int(days) : cut flotingpoint
lastupdate = int((time.time() - time.mktime(time.strptime(updateversion[:6], '%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') in ['.1.3.6.1.4.1.2620.1.6.123.1.67', # ClusterXL Gateway
# '.1.3.6.1.4.1.2620.1.6.123.1.65', # Appliance
# '.1.3.6.1.4.1.2620.1.6.123.1.64', # VSX Gateway
# '.1.3.6.1.4.1.2620.1.6.123.1.62', # Gateway
# '.1.3.6.1.4.1.2620.1.6.123.1.49', # R77.30 Gateway
# '.1.3.6.1.4.1.2620.1.6.123.1.48', # Mgmt
# '.1.3.6.1.4.1.8072.3.2.10'] # Virtual System (Linux),
'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') in ['.1.3.6.1.4.1.8072.3.2.10',]) # Virtual System (Linux)
and oid('.1.3.6.1.4.1.2620.1.39.1.1.0'), # CHECKPOINT-MIB::applicationControlSubscriptionStatus.0
'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
]),
}
doc/sample.png

7.16 KiB

{'author': u'Th.L. (thl-cmk[at]outlook[dot]com)',
'description': u'Monitors Check Point Application control\nchecks Update status and contract status\n',
'download_url': 'https://thl-cmk.hopto.org',
'files': {'checks': ['checkpoint_apcl'],
'web': ['plugins/wato/checkpoint_apcl.py']},
'name': 'checkpoint_application_control',
'num_files': 2,
'title': u'Check Point Application control',
'version': '20180731.v0.1.2c',
'version.min_required': '1.2.8b8',
'version.packaged': '1.4.0p35'}
\ No newline at end of file
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
#
# Author : Th.L.
# Content: wato plugin for snmp check 'checkpoint_apcl'
# to configure waring/critical levels for last update
#
#
register_check_parameters(
subgroup_applications,
'checkpoint_apcl',
_('Check Point Application Control'),
Dictionary(
elements=[
('no_update_warn',
Integer(
title=_('Warning if no Update'),
help=_('Warning if version older then days'),
unit=_('days'),
default_value=7,
minvalue=1,
label=_('warning if no updates since'),
)),
('no_update_crit',
Integer(
title=_('Critical if no Update'),
help=_('critical if version older then days'),
unit=_('days'),
default_value=14,
minvalue=1,
label=_('critical if no updates since'),
)),
],
),
None,
match_type='dict',
)
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