#!/usr/bin/env python3

#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_officemaster_suite_arguments(params, hostname, ipaddress):
    args = []
    
    url = params["url"]
    port = params['port']
    u = params['u']
    p = params['p']
    
    if url != "":
        args += ["-url", url]
    elif ipaddress != "":
        args += ["-url", ipaddress]
    if port != "":
        args += ["-port", port]
    if u != "":
        args += ["-u", u]
    if p != "":
        args += ["-p", p]

    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" remember?)
special_agent_info['officemaster_suite_v2'] = agent_officemaster_suite_arguments
