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

update project

parent 8f2f876d
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
#
# Rewriten by: Th.L.
# Date: 10-02-2020
#
# monitors license status of Cisco IronPort Appliances (ESA/SMA/WSA)
# Tested with: C380, M380, C370, M670, S370
#
# 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.
#
# sample snmpwalk:
#
# OMD[cmk16x]:~$ snmpwalk -v2c -c public localhost -m ASYNCOS-MAIL-MIB -ObentU keyExpirationTable
# .1.3.6.1.4.1.15497.1.1.1.12.1.1.1 = INTEGER: 1
# .1.3.6.1.4.1.15497.1.1.1.12.1.1.2 = INTEGER: 2
# .1.3.6.1.4.1.15497.1.1.1.12.1.1.3 = INTEGER: 3
# .1.3.6.1.4.1.15497.1.1.1.12.1.1.4 = INTEGER: 4
# .1.3.6.1.4.1.15497.1.1.1.12.1.1.5 = INTEGER: 5
# .1.3.6.1.4.1.15497.1.1.1.12.1.1.6 = INTEGER: 6
# .1.3.6.1.4.1.15497.1.1.1.12.1.1.7 = INTEGER: 7
# .1.3.6.1.4.1.15497.1.1.1.12.1.1.8 = INTEGER: 8
# .1.3.6.1.4.1.15497.1.1.1.12.1.1.9 = INTEGER: 9
# .1.3.6.1.4.1.15497.1.1.1.12.1.1.10 = INTEGER: 10
# .1.3.6.1.4.1.15497.1.1.1.12.1.1.11 = INTEGER: 11
# .1.3.6.1.4.1.15497.1.1.1.12.1.2.1 = STRING: Bounce Verification
# .1.3.6.1.4.1.15497.1.1.1.12.1.2.2 = STRING: Data Loss Prevention
# .1.3.6.1.4.1.15497.1.1.1.12.1.2.3 = STRING: External Threat Feeds
# .1.3.6.1.4.1.15497.1.1.1.12.1.2.4 = STRING: File Analysis
# .1.3.6.1.4.1.15497.1.1.1.12.1.2.5 = STRING: File Reputation
# .1.3.6.1.4.1.15497.1.1.1.12.1.2.6 = STRING: Incoming Mail Handling
# .1.3.6.1.4.1.15497.1.1.1.12.1.2.7 = STRING: IronPort Anti-Spam
# .1.3.6.1.4.1.15497.1.1.1.12.1.2.8 = STRING: IronPort Email Encryption
# .1.3.6.1.4.1.15497.1.1.1.12.1.2.9 = STRING: McAfee
# .1.3.6.1.4.1.15497.1.1.1.12.1.2.10 = STRING: Outbreak Filters
# .1.3.6.1.4.1.15497.1.1.1.12.1.2.11 = STRING: Sophos Anti-Virus
# .1.3.6.1.4.1.15497.1.1.1.12.1.3.1 = INTEGER: 1
# .1.3.6.1.4.1.15497.1.1.1.12.1.3.2 = INTEGER: 2
# .1.3.6.1.4.1.15497.1.1.1.12.1.3.3 = INTEGER: 2
# .1.3.6.1.4.1.15497.1.1.1.12.1.3.4 = INTEGER: 2
# .1.3.6.1.4.1.15497.1.1.1.12.1.3.5 = INTEGER: 2
# .1.3.6.1.4.1.15497.1.1.1.12.1.3.6 = INTEGER: 1
# .1.3.6.1.4.1.15497.1.1.1.12.1.3.7 = INTEGER: 2
# .1.3.6.1.4.1.15497.1.1.1.12.1.3.8 = INTEGER: 2
# .1.3.6.1.4.1.15497.1.1.1.12.1.3.9 = INTEGER: 2
# .1.3.6.1.4.1.15497.1.1.1.12.1.3.10 = INTEGER: 2
# .1.3.6.1.4.1.15497.1.1.1.12.1.3.11 = INTEGER: 2
# .1.3.6.1.4.1.15497.1.1.1.12.1.4.1 = Gauge32: 0
# .1.3.6.1.4.1.15497.1.1.1.12.1.4.2 = Gauge32: 0
# .1.3.6.1.4.1.15497.1.1.1.12.1.4.3 = Gauge32: 32542740
# .1.3.6.1.4.1.15497.1.1.1.12.1.4.4 = Gauge32: 32542804
# .1.3.6.1.4.1.15497.1.1.1.12.1.4.5 = Gauge32: 32542804
# .1.3.6.1.4.1.15497.1.1.1.12.1.4.6 = Gauge32: 0
# .1.3.6.1.4.1.15497.1.1.1.12.1.4.7 = Gauge32: 32542740
# .1.3.6.1.4.1.15497.1.1.1.12.1.4.8 = Gauge32: 0
# .1.3.6.1.4.1.15497.1.1.1.12.1.4.9 = Gauge32: 1463722
# .1.3.6.1.4.1.15497.1.1.1.12.1.4.10 = Gauge32: 32542740
# .1.3.6.1.4.1.15497.1.1.1.12.1.4.11 = Gauge32: 32542740
#
# OMD[cmk16x]:~$ snmpwalk -v2c -c public localhost -m ASYNCOS-MAIL-MIB keyExpirationTable
# ASYNCOS-MAIL-MIB::keyExpirationIndex.1 = INTEGER: 1
# ASYNCOS-MAIL-MIB::keyExpirationIndex.2 = INTEGER: 2
# ASYNCOS-MAIL-MIB::keyExpirationIndex.3 = INTEGER: 3
# ASYNCOS-MAIL-MIB::keyExpirationIndex.4 = INTEGER: 4
# ASYNCOS-MAIL-MIB::keyExpirationIndex.5 = INTEGER: 5
# ASYNCOS-MAIL-MIB::keyExpirationIndex.6 = INTEGER: 6
# ASYNCOS-MAIL-MIB::keyExpirationIndex.7 = INTEGER: 7
# ASYNCOS-MAIL-MIB::keyExpirationIndex.8 = INTEGER: 8
# ASYNCOS-MAIL-MIB::keyExpirationIndex.9 = INTEGER: 9
# ASYNCOS-MAIL-MIB::keyExpirationIndex.10 = INTEGER: 10
# ASYNCOS-MAIL-MIB::keyExpirationIndex.11 = INTEGER: 11
# ASYNCOS-MAIL-MIB::keyDescription.1 = STRING: Bounce Verification
# ASYNCOS-MAIL-MIB::keyDescription.2 = STRING: Data Loss Prevention
# ASYNCOS-MAIL-MIB::keyDescription.3 = STRING: External Threat Feeds
# ASYNCOS-MAIL-MIB::keyDescription.4 = STRING: File Analysis
# ASYNCOS-MAIL-MIB::keyDescription.5 = STRING: File Reputation
# ASYNCOS-MAIL-MIB::keyDescription.6 = STRING: Incoming Mail Handling
# ASYNCOS-MAIL-MIB::keyDescription.7 = STRING: IronPort Anti-Spam
# ASYNCOS-MAIL-MIB::keyDescription.8 = STRING: IronPort Email Encryption
# ASYNCOS-MAIL-MIB::keyDescription.9 = STRING: McAfee
# ASYNCOS-MAIL-MIB::keyDescription.10 = STRING: Outbreak Filters
# ASYNCOS-MAIL-MIB::keyDescription.11 = STRING: Sophos Anti-Virus
# ASYNCOS-MAIL-MIB::keyIsPerpetual.1 = INTEGER: true(1)
# ASYNCOS-MAIL-MIB::keyIsPerpetual.2 = INTEGER: false(2)
# ASYNCOS-MAIL-MIB::keyIsPerpetual.3 = INTEGER: false(2)
# ASYNCOS-MAIL-MIB::keyIsPerpetual.4 = INTEGER: false(2)
# ASYNCOS-MAIL-MIB::keyIsPerpetual.5 = INTEGER: false(2)
# ASYNCOS-MAIL-MIB::keyIsPerpetual.6 = INTEGER: true(1)
# ASYNCOS-MAIL-MIB::keyIsPerpetual.7 = INTEGER: false(2)
# ASYNCOS-MAIL-MIB::keyIsPerpetual.8 = INTEGER: false(2)
# ASYNCOS-MAIL-MIB::keyIsPerpetual.9 = INTEGER: false(2)
# ASYNCOS-MAIL-MIB::keyIsPerpetual.10 = INTEGER: false(2)
# ASYNCOS-MAIL-MIB::keyIsPerpetual.11 = INTEGER: false(2)
# ASYNCOS-MAIL-MIB::keySecondsUntilExpire.1 = Gauge32: 0
# ASYNCOS-MAIL-MIB::keySecondsUntilExpire.2 = Gauge32: 0
# ASYNCOS-MAIL-MIB::keySecondsUntilExpire.3 = Gauge32: 32542740
# ASYNCOS-MAIL-MIB::keySecondsUntilExpire.4 = Gauge32: 32542804
# ASYNCOS-MAIL-MIB::keySecondsUntilExpire.5 = Gauge32: 32542804
# ASYNCOS-MAIL-MIB::keySecondsUntilExpire.6 = Gauge32: 0
# ASYNCOS-MAIL-MIB::keySecondsUntilExpire.7 = Gauge32: 32542740
# ASYNCOS-MAIL-MIB::keySecondsUntilExpire.8 = Gauge32: 0
# ASYNCOS-MAIL-MIB::keySecondsUntilExpire.9 = Gauge32: 1463722
# ASYNCOS-MAIL-MIB::keySecondsUntilExpire.10 = Gauge32: 32542740
# ASYNCOS-MAIL-MIB::keySecondsUntilExpire.11 = Gauge32: 32542740
#
#
# sample info:
# [
# [u'Cisco Centralized Email Reporting', u'2', u'927000'],
# [u'Cisco Centralized Web Configuration Manager', u'2', u'927000'],
# [u'Cisco Centralized Web Reporting', u'2', u'2592000'],
# [u'Cisco IronPort Centralized Email Message Tracking', u'2', u'927000'],
# [u'Cisco IronPort Spam Quarantine', u'2', u'927000'],
# [u'Incoming Mail Handling', u'1', u'0']
# ]
#
factory_settings['cisco_asyncos_license_default_levels'] = {
'expire': (30, 7), # 30 days warn, 7 days crit
# 'features_ignore': ['McAfee', 'Data Loss Prevention'], # list of features to ignore in license check
}
def inventory_cisco_asyncos_license(info):
if len(info) > 0:
return [(None, 'cisco_asyncos_license_default_levels')]
def check_cisco_asyncos_license(_no_item, params, info):
infotext = ''
longoutput = ''
features_warn = []
features_crit = []
features_ignore = params.get('features_ignore', [])
expire_warn, expire_crit = params.get('expire', (30, 15))
expire_warn = expire_warn * 24 * 3600
expire_crit = expire_crit * 24 * 3600
def get_isperpetual(isperpetual):
s_status = {'1': True,
'2': False}
return s_status.get(isperpetual,False)
for featurekey in info:
description, isperpetual, secondsuntilexpire = featurekey
isperpetual = get_isperpetual(isperpetual)
secondsuntilexpire = int(secondsuntilexpire)
expiredate = time.strftime("%d %b %Y", time.localtime(time.time()+secondsuntilexpire))
if isperpetual:
longoutput += '\n%s: perpetual: %s, expires at: %s' % (description, isperpetual, 'will not expire')
elif secondsuntilexpire == 0:
longoutput += '\n%s: perpetual: %s, has expired or is not licensed' % (description, isperpetual)
else:
longoutput += '\n%s: perpetual: %s, expires at: %s' % (description, isperpetual, expiredate)
if not isperpetual and description not in features_ignore:
if secondsuntilexpire < expire_crit:
features_crit.append(description)
elif secondsuntilexpire < expire_warn:
features_warn.append(description)
if len(features_crit) != 0:
temp = ', '.join(features_crit)
yield 2, '%d features about to expire (%s)' % (len(features_crit), temp)
if len(features_warn) != 0:
temp = ', '.join(features_warn)
yield 1, '%d features about to expire (%s)' % (len(features_warn), temp)
infotext += '%d features found' % len(info)
yield 0, infotext + longoutput
check_info['cisco_asyncos_license'] = {
'check_function': check_cisco_asyncos_license,
'inventory_function': inventory_cisco_asyncos_license,
'group': 'cisco_asyncos_license',
'service_description': 'License',
'snmp_info': ('.1.3.6.1.4.1.15497.1.1.1.12.1', # ASYNCOS-MAIL-MIB::keyExpirationEntry
['2', # keyDescription
'3', # keyIsPerpetual
'4', # keySecondsUntilExpire
]),
'default_levels_variable': 'cisco_asyncos_license_default_levels',
'snmp_scan_function': lambda oid: oid('.1.3.6.1.2.1.1.1.0').find('AsyncOS') != -1,
# 'snmp_scan_function': scan_cisco_asyncos,
# 'includes': ['cisco_asyncos.include'],
}
No preview for this file type
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