check-unifi-controller/share/check_mk/checks/agent_unifi_controller

27 lines
946 B
Python

#!/usr/bin/env python3
# -*- encoding: utf-8; py-indent-offset: 4 -*-
#Function get params (in this case is port, passed via WATO agent rule cunfiguration, hostname and ip addres of host,
#for which agent will be invoked
def agent_unifi_controller_arguments(params, hostname, ipaddress):
args = [
'--user', params['user'],
'--password', passwordstore_get_cmdline('%s', params['password']),
'--port', params['port'],
'--piggyback',params['piggyback'],
]
_site = params.get("site")
if _site:
args += ["--site",_site]
if 'ignore_cert' in params and params['ignore_cert'] != '':
args += ['--ignore-cert']
args += [ipaddress]
return args
#register invoke function for our agent
#key value for this dictionary is name part from register datasource of our agent (name="special_agents:myspecial")
special_agent_info['unifi_controller'] = agent_unifi_controller_arguments