mirror of
https://github.com/bashclub/check-unifi-controller.git
synced 2024-12-26 05:10:12 +01:00
27 lines
946 B
Python
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
|
|
|
|
|