def main(argv): logging.basicConfig( format='%(asctime)s:%(process)d:[%(levelname)s](%(name)s):%(message)s', level=log_level) for module in skipmodules: logging.getLogger(module).setLevel(logging.ERROR) try: opts, args = getopt.getopt(argv, "hs:f:", ["help", "source=", "field="]) except getopt.GetoptError: helpArgs() sys.exit() for opt, arg in opts: if opt in ("-h", "--help"): helpArgs() sys.exit() elif opt in ("-s", "--source"): hostname = arg elif opt in ("-f", "--field"): fieldname = arg zapi = ZabbixAPI(ZBXURI) zapi.login(ZBXUSER, ZBXPASS) logging.info("Connected to Zabbix API %s Version %s" % (ZBXURI, zapi.api_version())) zapi.cicle_inventory_value(hostname=hostname, inventory_field=fieldname)