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

Delete cisco_api_status

parent 7b74cb79
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
#
# 2018-09-05 : changes for CMK 1.5.x (replaced global variable g_hostname with api call host_name())
# 2020-08-08 : cleanup
#
def cisco_api_status_arguments(params):
# print params
args = []
# example
# {'psirt': {'warn-severity': 3, 'warn-days': 31, 'crit-days': 7, 'crit-severity': 1}}
if params:
if params.get('psirt'):
for key, value in [
('--psirt-crit-days', 'crit-days'),
('--psirt-warn-days', 'warn-days'),
('--psirt-warn-severity', 'warn-severity'),
('--psirt-crit-severity', 'crit-severity'),
('--psirt-not-active', 'not-active'),
]:
if params['psirt'].get(value):
args.append('%s %s' % (key, params['psirt'].get(value)))
if params.get('eox'):
for key, value in [
('--eox-crit-new', 'crit-new'),
('--eox-warn-new', 'warn-new'),
('--eox-crit-change', 'crit-change'),
('--eox-warn-change', 'warn-change'),
('--eox-not-active', 'not-active'),
]:
if params['eox'].get(value):
args.append('%s %s' % (key, params['eox'].get(value)))
if params.get('sn2info'):
for key, value in [
('--sn2info-crit-change', 'crit-change'),
('--sn2info-warn-change', 'warn-change'),
('--sn2info-not-active', 'not-active'),
]:
if params['sn2info'].get(value):
args.append('%s %s' % (key, params['sn2info'].get(value)))
if params.get('suggestion'):
for key, value in [
('--suggestion-not-active', 'not-active'),
]:
if params['suggestion'].get(value):
args.append('%s %s' % (key, params['suggestion'].get(value)))
# in CMK v1.5.x global variable g_hostname was replaced by API call host_name()
try:
_hostname = host_name()
except NameError:
_hostname = g_hostname
args.append('%s' % _hostname)
return ' '.join(args)
##############
#
# USER2 variable from:
# ~/etc/icinga/resource.cfg
#
#############
active_check_info['cisco_api_status'] = {
'command_line' : '$USER2$/cisco_api_status $ARG1$',
'argument_function' : cisco_api_status_arguments,
'service_description': lambda args: args.get('description', 'Cisco API status'),
}
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