def __init__(self, zapi, obj=None, defaults=None, template_id=None): self.zapi = zapi self.obj = obj self.defaults = defaults self.template_id = template_id self.obj_type = 'item' ZabbixObject(self.zapi, self.obj, self.template_id)
def __init__(self, zapi, obj, defaults, template_id): self.zapi = zapi self.obj = obj self.defaults = defaults self.template_id = template_id self.obj_type = 'discoveryrule' ZabbixObject(self.zapi, self.obj, self.template_id)
def __init__(self, zapi, obj, defaults, template_id): self.zapi = zapi self.obj = obj self.defaults = defaults self.template_id = template_id self.obj_type = 'graph' self.zbx_item_class = 'item' ZabbixObject(self.zapi, self.obj, self.template_id)
def __init__(self, template=None): ZabbixCLIArguments.__init__(self) self._configureLogging() log.debug('Parser arguments: %s', self.args) # if no arguments, jsut print help if len(sys.argv) <= 1: self.argparser.print_help() sys.exit() if not self.args.get('template'): sys.exit('Template should be specified.') self.url = self.args['server'] try: self.zapi = ZabbixAPI( self.url, user=self.args['user'], password=self.args['pass']) except: log.error('Error while trying open connection to zabbix server: %s', self.url) # If we need to delete an object and exit if self.args.get('delete'): template_id = self.zapi.get_id('template', self.args['delete'][1]) if ZabbixObject(self.zapi, {'name': self.args['delete'][2]}, template_id=template_id, obj_type=self.args['delete'][0]).delete(): log.info( '"{2}" {0} was deleted from "{1}"'.format( *self.args['delete'])) else: log.exit( 'Error while trying to delete: "{2}" {0} from "{1}"'.format( *self.args['delete'])) exit() # Set template name from __init__ params or args if template: self.template_name = template else: self.template_name = self.args.get('template') # Load template from file self.template = ZabbixTemplateFile(self.template_name, templates_dir=self.args.get('templates_dir')) self.template_id = None # When template loaded, set defaults and run apply process if self.template: self.config = ZabbixDefaults() self.apply()
def __init__(self, zapi, obj, template_id): self.zapi = zapi self.obj = obj self.template_id = template_id self.obj_type = 'usermacro' ZabbixObject(self.zapi, self.obj, self.template_id)
def __init__(self, zapi, obj): self.zapi = zapi self.obj = obj self.obj_type = 'action' ZabbixObject(self.zapi, self.obj)
def __init__(self, zapi, obj, template_id): self.zapi = zapi self.obj = obj self.template_id = template_id self.obj_type = 'application' ZabbixObject(self.zapi, self.obj)