diff --git a/checkpoint_fw_connections.mkp b/checkpoint_fw_connections.mkp index 80e5fdddd3db714940edf33bb858ad717f5dbdcf..0c78645faa44ac4e6309f9ecd9ca13573fad631b 100644 Binary files a/checkpoint_fw_connections.mkp and b/checkpoint_fw_connections.mkp differ diff --git a/checks/checkpoint_fw_connections b/checks/checkpoint_fw_connections index a37baca1414ad36bcabc9c447d389186b4fea26f..61d480818a5853d0a4fa01a49ba2dc9c78e37230 100644 --- a/checks/checkpoint_fw_connections +++ b/checks/checkpoint_fw_connections @@ -18,8 +18,15 @@ # 07.06.2020 : code cleanup # added wato # wadded warn/crit for connection rate +# 08.06.2020: changed snmp-scan function +# code cleanup +# +# sample info +# [[[u'559684419', u'203840211', u'51093794', u'786231', u'815404655', u'0']], [[u'11172', u'27598', u'0']]] +# +# no firewall +# [[], []] # - factory_settings['checkpoint_fw_connections_defaults'] = { # 'warncritcurrent': (1000, 2000), # 'warncritnew': (100, 200) @@ -27,7 +34,8 @@ factory_settings['checkpoint_fw_connections_defaults'] = { def inventory_checkpoint_fw_connections(info): - return [(None, {})] + if info != [[], []]: + return [(None, None)] def check_checkpoint_fw_connections(item, params, info): @@ -36,15 +44,7 @@ def check_checkpoint_fw_connections(item, params, info): fwConnectionsTcp, fwConnectionsUdp, fwConnectionsIcmp, fwConnectionsOther, fwConnectionsSum, fwConnectionRate = fwConnectionsStat[0] fwCurrnetNumConn, fwPeakNumConn, fwConnTableLimit = fwpolicystat[0] - now_time = time.time() - - fwConnectionsTcp = get_rate('checkpoint_fw_connections.%s.%s' % ('fwConnectionsTcp', item), now_time, int(fwConnectionsTcp), onwrap=SKIP) - fwConnectionsUdp = get_rate('checkpoint_fw_connections.%s.%s' % ('fwConnectionsUdp', item), now_time, int(fwConnectionsUdp), onwrap=SKIP) - fwConnectionsIcmp = get_rate('checkpoint_fw_connections.%s.%s' % ('fwConnectionsIcmp', item), now_time, int(fwConnectionsIcmp), onwrap=SKIP) - fwConnectionsOther = get_rate('checkpoint_fw_connections.%s.%s' % ('fwConnectionsOther', item), now_time, int(fwConnectionsOther), onwrap=SKIP) - fwConnectionsSum = get_rate('checkpoint_fw_connections.%s.%s' % ('fwConnectionsSum', item), now_time, int(fwConnectionsSum), onwrap=SKIP) fwConnectionRate = int(fwConnectionRate) - fwCurrnetNumConn = int(fwCurrnetNumConn) fwPeakNumConn = int(fwPeakNumConn) fwConnTableLimit = int (fwConnTableLimit) @@ -72,13 +72,18 @@ def check_checkpoint_fw_connections(item, params, info): infotext = 'peak: %d, table limit: %s' % (fwPeakNumConn, fwConnTableLimit) - perfdata = [('fwconnectionstcp', fwConnectionsTcp), - ('fwconnectionsudp', fwConnectionsUdp), - ('fwconnectionsicmp', fwConnectionsIcmp), - ('fwconnectionsother', fwConnectionsOther), - ('fwconnectionssum', fwConnectionsSum), - ('fwpeaknumconn', fwPeakNumConn) - ] + perfdata = [('fwpeaknumconn', fwPeakNumConn)] + now_time = time.time() + + for counter, value in [ + ('fwconnectionstcp', fwConnectionsTcp), + ('fwconnectionsudp', fwConnectionsUdp), + ('fwconnectionsicmp', fwConnectionsIcmp), + ('fwconnectionsother', fwConnectionsOther), + ('fwconnectionssum', fwConnectionsSum), + ]: + value = get_rate('checkpoint_fw_connections.%s' % counter, now_time, int(value), onwrap=SKIP) + perfdata.append((counter, value)) yield 0, infotext , perfdata @@ -90,10 +95,9 @@ check_info['checkpoint_fw_connections'] = { 'has_perfdata': True, 'group': 'checkpoint_fw_connections', 'default_levels_variable': 'checkpoint_fw_connections_defaults', - '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 # CheckPoint System - oid('.1.3.6.1.2.1.1.2.0') in ['.1.3.6.1.4.1.8072.3.2.10', ]) and # Virtual System (Linux) - oid('.1.3.6.1.4.1.2620.1.1.26.11.1.0')), # CHECKPOINT-MIB::fwConnectionsStatConnectionsTcp.0 + '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.26.11', [ # CHECKPOINT-MIB::fwConnectionsStat '1', # fwConnectionsStatConnectionsTcp '2', # fwConnectionsStatConnectionsUdp diff --git a/packages/checkpoint_fw_connections b/packages/checkpoint_fw_connections index 683441562d98858c6c009db4719f3304b6357d76..5493ab4d6b5792efd41f2cce348ef810490c2f90 100644 --- a/packages/checkpoint_fw_connections +++ b/packages/checkpoint_fw_connections @@ -7,6 +7,6 @@ 'name': 'checkpoint_fw_connections', 'num_files': 3, 'title': u'Check Point Connections', - 'version': '20200607.v.0.0.2', + 'version': '20200608.v.0.0.2a', 'version.min_required': '1.2.8b8', 'version.packaged': '1.4.0p38'} \ No newline at end of file diff --git a/web/plugins/metrics/checkpoint_fw_connections.py b/web/plugins/metrics/checkpoint_fw_connections.py index a6dcbc4ed4f66d06e0887c51f86012bf2522f13d..18d1627167792dfed4dd94a875fdfc2d3547964f 100644 --- a/web/plugins/metrics/checkpoint_fw_connections.py +++ b/web/plugins/metrics/checkpoint_fw_connections.py @@ -46,7 +46,7 @@ metric_info['checkpoint_fw_connections_fwconnectionsother'] = { metric_info['checkpoint_fw_connections_fwconnectionssum'] = { 'title': _('Total connections'), 'unit': '1/s', - 'color': '26/a', + 'color': '15/a', } metric_info['checkpoint_fw_connections_fwconnectionrate'] = { 'title': _('Connections rate'), @@ -62,7 +62,7 @@ metric_info['checkpoint_fw_connections_fwcurrentnumconn'] = { metric_info['checkpoint_fw_connections_fwpeaknumconn'] = { 'title': _('Peak Connections'), 'unit': 'count', - 'color': '15/a', + 'color': '16/a', }