def __init__(self, conf): from include.zabbix_api import ZabbixAPI, ZabbixAPIException self.server = conf["server"] self.username = conf["login"] self.password = conf["password"] self.log_level = 0 self.zapi = ZabbixAPI(server=self.server, user=self.username, passwd=self.password, path="", log_level=self.log_level) self.connect()
class ZAPI(): def __init__(self, conf): from include.zabbix_api import ZabbixAPI, ZabbixAPIException self.server = conf["server"] self.username = conf["login"] self.password = conf["password"] self.log_level = 0 self.zapi = ZabbixAPI(server=self.server, user=self.username, passwd=self.password, path="", log_level=self.log_level) self.connect() def connect(self): from include.zabbix_api import ZabbixAPIException try: self.zapi.login(self.username, self.password) except ZabbixAPIException, e: sys.stderr.write(str(e) + '\n') return False return True