def iinfo_schemas(self):
        """Return IInfo attribute schema dict."""
        remote_spec = self.class_.zenpack.classes.get(self.remote_classname)
        imported_class = self.class_.zenpack.imported_classes.get(self.schema.remoteClass)
        if not (remote_spec or imported_class):
            return {}

        schemas = {}

        if not self.details_display:
            return {}

        if imported_class:
            remote_spec = imported_class
            remote_spec.label = remote_spec.meta_type

        if isinstance(self.schema, (ToOne)):
            if (self.label or remote_spec.label) != 'Device':
                schemas[self.name] = schema.Entity(
                    title=_t(self.label or remote_spec.label),
                    group="Overview",
                    order=self.scaled_order)
        else:
            relname_count = '{}_count'.format(self.name)
            schemas[relname_count] = schema.Int(
                title=_t(u'Number of {}'.format(self.label or remote_spec.plural_label)),
                group="Overview",
                order=self.scaled_order)

        return schemas
 def get_interface(self):
     '''return object suitable for interfaces.py'''
     if self.isMethod == True:
         if self.isText ==True:
             return self.interface_type()(title=_t(u'%s' % self.title), readonly=True, group=_t(u'%s' % self.group))
         else:
             return None
     if self.order is not None:
         return self.interface_type()(title=_t(u'%s' % self.title), group=_t(u'%s' % self.group), order=self.order)
     else:
         return self.interface_type()(title=_t(u'%s' % self.title), group=_t(u'%s' % self.group))
    def addOpenStack(self, device_name, username, api_key, project_id, auth_url,
                     region_name=None, collector='localhost'):
        """Add a new OpenStack endpoint to the system."""
        parsed_url = urlparse(auth_url.strip())

        if parsed_url.scheme == "" or parsed_url.hostname is None:
            return False, _t("'%s' is not a valid URL." % auth_url)

        # Verify that this device does not already exist.
        deviceRoot = self._dmd.getDmdRoot("Devices")
        device = deviceRoot.findDeviceByIdExact(device_name)
        if device:
            return False, _t("A device named %s already exists." % device_name)

        zProperties = {
            'zCommandUsername': username,
            'zCommandPassword': api_key,
            'zOpenStackProjectId': project_id,
            'zOpenStackAuthUrl': auth_url,
            'zOpenstackComputeApiVersion': 2,
            'zOpenStackRegionName': region_name or '',
        }

        @transact
        def create_device():
            dc = self._dmd.Devices.getOrganizer(OPENSTACK_DEVICE_PATH)

            device = dc.createInstance(device_name)
            device.setPerformanceMonitor(collector)

            device.username = username
            device.password = api_key

            for prop, val in zProperties.items():
                device.setZenProperty(prop, val)

            device.index_object()
            notify(IndexingEvent(device))

        # This must be committed before the following model can be
        # scheduled.
        create_device()

        # Schedule a modeling job for the new device.
        device = deviceRoot.findDeviceByIdExact(device_name)
        device.collectDevice(setlog=False, background=True)

        return True, 'Device addition scheduled'
Example #4
0
    def add_ec2account(self, accountname, accesskey, secretkey, collector):
        deviceRoot = self._dmd.getDmdRoot("Devices")
        device = deviceRoot.findDeviceByIdExact(accountname)
        if device:
            return False, _t("A device named %s already exists." % accountname)

        @transact
        def create_device():
            dc = self._dmd.Devices.getOrganizer('/Devices/AWS/EC2')

            account = dc.createInstance(accountname)
            account.setPerformanceMonitor(collector)

            account.ec2accesskey = accesskey
            account.ec2secretkey = secretkey

            account.index_object()
            notify(IndexingEvent(account))

        # This must be committed before the following model can be
        # scheduled.
        create_device()

        # Schedule a modeling job for the new account.
        account = deviceRoot.findDeviceByIdExact(accountname)
        account.collectDevice(setlog=False, background=True)

        return True
Example #5
0
 def register_extjsPortlet(self, id, title, height=200, permission=ZEN_COMMON):
     """
     Registers an ExtJS portlet
     """
     ppath = os.path.join('Products','ZenWidgets','ZenossPortlets','ExtPortlet.js')
     self.register_portlet(ppath, id=id, title=_t(title), height=height,
                           permission=permission)
Example #6
0
 def register_portlet(self, sourcepath, id='', title='', description='', 
                      preview='', height=200, permission=ZEN_COMMON):
     """
     Registers a new source file and creates an associated Portlet to store
     the metadata and provide access methods.
     """
     p = self.find(id, sourcepath)
     if p:
         old_values = (p.sourcepath, p.id, p.title, p.description, p.preview, p.height, p.permission)
         new_values = (sourcepath, id, _t(title), description, preview, height, permission)
         if old_values == new_values:
             # Portlet unchanged - don't re-register
             return
         self.unregister_portlet(p.id)
     p = Portlet(sourcepath, id, _t(title), description, preview, height, permission)
     self.portlets._setObject(id, p)
    def add_cloudstack(self, url, api_key, secret_key,collector='localhost'):
        """Handles adding a new CloudStack cloud to the system."""

        parsed_url = urlparse(url)
        hostname = parsed_url.hostname

        deviceRoot = self._dmd.getDmdRoot("Devices")
        device = deviceRoot.findDeviceByIdExact(hostname)
        if device:
            return False, _t("A device named %s already exists." % hostname)

        zProperties = {
            'zCloudStackURL': url,
            'zCloudStackAPIKey': api_key,
            'zCloudStackSecretKey': secret_key,
            }

        perfConf = self._dmd.Monitors.getPerformanceMonitor(collector)
        jobStatus = perfConf.addDeviceCreationJob(
            deviceName=hostname,
            devicePath='/Devices/CloudStack',
            performanceMonitor=collector,
            discoverProto='python',
            zProperties=zProperties)

        return True, jobStatus.id
 def get_interface(self):
     '''return appropriate schema module for interfaces.py'''
     # property references a method
     if self.isMethod is True:
         # whether method should return as read-only text
         if self.isText is True:
             return self.interface_type()(title=_t(u'%s' % self.title), readonly=True, group=_t(u'%s' % self.group))
         # don't return anything if property is a method returning a non-text-like value
         else: return None
     # if the order is specified, use it.
     # note that this doesn't do what I thought it did (determine layout order in component data drop-down), so
     # not sure what this does exactly
     if self.order is not None:
         return self.interface_type()(title=_t(u'%s' % self.title), group=_t(u'%s' % self.group), order=self.order)
     else:
         return self.interface_type()(title=_t(u'%s' % self.title), group=_t(u'%s' % self.group))
    def addOpenStack(self, username, api_key, project_id, auth_url,
                     region_name=None, collector='localhost'):
        """Add a new OpenStack endpoint to the system."""
        parsed_url = urlparse(auth_url)
        hostname = parsed_url.hostname

        # Verify that this device does not already exist.
        deviceRoot = self._dmd.getDmdRoot("Devices")
        device = deviceRoot.findDeviceByIdExact(hostname)
        if device:
            return False, _t("A device named %s already exists." % hostname)

        zProperties = {
            'zCommandUsername': username,
            'zCommandPassword': api_key,
            'zOpenStackProjectId': project_id,
            'zOpenStackAuthUrl': auth_url,
            'zOpenstackComputeApiVersion': 2,
            'zOpenStackRegionName': region_name or '',
            }

        perfConf = self._dmd.Monitors.getPerformanceMonitor('localhost')
        jobStatus = perfConf.addDeviceCreationJob(
            deviceName=hostname,
            devicePath=OPENSTACK_DEVICE_PATH,
            discoverProto='python',
            performanceMonitor=collector,
            zProperties=zProperties)

        return True, jobStatus.id
    def addEndpoint(self, target, email, password, collector):
        """
        Handles adding a new CloudFoundry endpoint to the system.
        """

        # Verify that this device does not already exist.
        deviceRoot = self._dmd.getDmdRoot("Devices")
        device = deviceRoot.findDeviceByIdExact(target)
        if device:
            return False, _t("A device named %s already exists." % target)

        # If all is well, submit a discovery job for the new cell to be added
        # as a Zenoss device.
        zProperties = {
            'zCloudFoundryTarget': target,
            'zCloudFoundryEmail': email,
            'zCloudFoundryPassword': password,
            }

        # TODO: allow user to specify the collector?
        perfConf = self._dmd.Monitors.getPerformanceMonitor(collector)
        jobStatus = perfConf.addDeviceCreationJob(deviceName=target,
                devicePath=CLOUDFOUNDRY_DEVICE_PATH,
                performanceMonitor=collector,
                discoverProto='python',
                zProperties=zProperties)

        # Redirect the user to the job status page so that they can view the
        # output of the discovery job immediately.
        return True, jobStatus.id
    def add_ExampleDevice(self, deviceIp, community, comment):
        """Add a device of class ExampleDevice """

        deviceRoot = self._dmd.getDmdRoot("Devices")
        device = deviceRoot.findDeviceByIdExact(deviceIp)
        if device:
            return False, _t("A device named %s already exists." % deviceIp)

        zProperties = {
            'zSnmpCommunity': community,
            'zPythonClass': 'ZenPacks.skills1st.MenuExamples.ExampleDevice',
            }

        perfConf = self._dmd.Monitors.getPerformanceMonitor('localhost')
        
        # addDeviceCreationJob is a method defined in $ZENHOME/Products/ZenModel/PerformanceConf.py
        # Parameters here are not exhustive. discoverProto='snmp' ensures device is modeled as well
        #   as discovered into the Zope database

        jobStatus = perfConf.addDeviceCreationJob(
            deviceName=deviceIp,
            devicePath='/Example/TestClass',
            discoverProto='snmp',
            comments=comment,
            zProperties=zProperties)

        return True, jobStatus.id
    def myFacadeFunc(self, ob, comments, rackSlot):
        """ Modifies comments and rackSlot attributes for a device """

        ob.comments = comments
        ob.rackSlot = rackSlot
 
        return True, _t(" Comments and rackSlot attributes set for device %s" % (ob.id))
Example #13
0
    def getSavedSearch(self, searchName):
        """
        @params string searchName: identifier of the search we are looking for
        @return DirectResponse: the data attribute will have our search terms
        """
        facade = self._getFacade()
        if facade.noSaveSearchProvidersPresent():
            return DirectResponse.fail(message=_t('Unable to find the specified search'))

        # look for our search
        savedSearch = facade.getSavedSearch(searchName)
        if savedSearch:
            return DirectResponse.succeed(data=Zuul.marshal(savedSearch))

        # we could not find the search term
        return DirectResponse.fail(message=_t('Unable to find the specified search'))
    def add_cloudstack(self, device_name, url, api_key, secret_key, collector='localhost'):
        """Handles adding a new CloudStack cloud to the system."""

        @transact
        def create_device():
            dc = self._dmd.Devices.getOrganizer('/Devices/CloudStack')

            account = dc.createInstance(device_name)
            account.setPerformanceMonitor(collector)
            account.setZenProperty('zCloudStackURL', url)
            account.setZenProperty('zCloudStackAPIKey', api_key)
            account.setZenProperty('zCloudStackSecretKey', secret_key)

            account.index_object()
            notify(IndexingEvent(account))


        deviceRoot = self._dmd.getDmdRoot("Devices")
        device = deviceRoot.findDeviceByIdExact(device_name)
        if device:
            return False, _t("A device named %s already exists." % device_name)

        # This must be committed before the following model can be
        # scheduled.
        create_device()

        # Schedule a modeling job for the new account.
        account = deviceRoot.findDeviceByIdExact(device_name)
        account.collectDevice(setlog=False, background=True)

        return True
    def add_ovirt(self, url, username, domain, password, collector='localhost'):
        """Handles adding a new oVirt environment to the system."""
        parsed_url = urlparse(url)
        hostname = parsed_url.hostname

        deviceRoot = self._dmd.getDmdRoot("Devices")
        device = deviceRoot.findDeviceByIdExact(hostname)

        if device:
            return False, _t("A device named %s already exists." % hostname)

        zProperties = {
            'zOVirtUrl': url,
            'zOVirtUser': username,
            'zOVirtDomain': domain,
            'zOVirtPassword': password,
        }

        perfConf = self._dmd.Monitors.getPerformanceMonitor('localhost')
        jobStatus = perfConf.addDeviceCreationJob(
            deviceName=hostname,
            devicePath='/Devices/oVirt',
            discoverProto='python',
            performanceMonitor=collector,
            zProperties=zProperties)

        return True, jobStatus.id
    def rrdVariables(self):
        """
        Returns a list of all of the available RRD variables
        """
        # get the available variables from the graph definition
        graphDef = self._object.graphDef()
        variables = graphDef.getRRDVariables(self._object.sequence)

        # the old UI returned the string "None" if there were not any variables
        return variables or _t(u'None')
Example #17
0
 def genTargets():
     for obj in objs:
         container = obj.rrdTemplates
         organizer = '/' + '/'.join(obj.getPrimaryPath()[4:])
         label = organizer
         if template.id in container.objectIds():
             label += " (%s)" % _t('Create Copy')
         if label.lower().startswith(query.lower()):
             uid = '/'.join(obj.getPrimaryPath())
             yield dict(uid=uid, label=label)
 def jsonComponentColumn(self):
     '''columns for the component.js file'''
     
     if self.optional == False:
         return {'id': '%s' % self.id,
                 'dataIndex': '%s' % self.id,
                 'header': _t('%s') % self.title,
                 'sortable': 'true',
                 'width': self.width
                 }
     return None
 def jsonComponentColumn(self):
     '''columns for the component.js grid file'''
     if self.optional is False:
         return {
                 'id': '%s' % self.id,
                 'dataIndex': '%s' % self.id,
                 'header': _t('%s') % self.title,
                 'sortable': "true",
                 'width': self.width,
                 "renderer": "pass_link"
                 }
     return None
 def jsonAdd(self):
     ''' format fields for the component-add.js file '''
     if self.optional == False:
         return {
                 'xtype' : self.xtype(),
                 'name' : self.id,
                 'fieldLabel' : _t('%s') % self.title,
                 'id' : '%sField' % self.id,
                 'width' : self.width*2 ,
                 'allowBlank' : self.is_optional()
                 }
     return None
Example #21
0
 def text(self):
     """
     If a template display the path otherwise just show what the parent shows
     """
     if self.isOrganizer:
         return self._object.name
     # it is a template
     if self._organizerPath in self.uid:
         path = _t('Locally Defined')
     else:
         path = self._get_object().getUIPath()
     return "%s (%s)" % (self._object.name, path)
Example #22
0
    def getAllSavedSearches(self, query=None, addManageSavedSearch=False):
        """
        @returns [ISavedSearchInfo] All the searches the logged in
        user can access
        """
        facade = self._getFacade()
        if facade.noSaveSearchProvidersPresent():
            return DirectResponse.succeed()

        data = Zuul.marshal(facade.getSavedSearchesByUser())
        if addManageSavedSearch:
            manageName = '<span id="manage-search-link">%s</span>' % (_t('Manage Saved Searches...'))
            data.append(dict(id='manage_saved_search', name=manageName))
        return DirectResponse.succeed(data=data)
    def getTableHeader(self, tableName, fieldName, fieldTitle,
                sortRule='cmp', style='tableheader',attributes="",
                i18n_domain='zenoss'):
        """generate a <th></th> tag that allows column sorting"""
        href = self.getTableHeaderHref(tableName, fieldName, sortRule)
        style = self.getTableHeaderStyle(tableName, fieldName, style)
        tag = """<th class="%s" %s>""" % (style, attributes)
        tag += """<a class="%s" href="%s""" % (style, href)

        # Owwwwwwwwwww
        from Products.Zuul.utils import ZuulMessageFactory as _t
        msg = getTranslation(_t(fieldTitle), self.REQUEST, domain=i18n_domain)
        tag += msg + "</a></th>\n"

        return tag
 def get_product(self):
     '''
         return dict with the info, interface 
         needed for setting component-level productClass
     '''
     getName = "_getProductClass"
     setName = "_setProductClass"
     getKlass = stringToMethod(getName, '''def %s(self):\n    return self._object.getProductKey()\n''' % (getName))
     setKlass = stringToMethod(setName, '''def %s(self, value):\n    self._object.productKey = value\n    self._object.setProductKey(value)\n'''% (setName))
     data = {'info': {}, 'interface': {}, 'infotext': {}}
     data['info'][getName] = getKlass
     data['info'][setName] = setKlass
     data['info'][self.id] = property(getKlass, setKlass)
     data['interface'][self.id] = self.interface_type()(title=_t(u'%s' % self.title), alwaysEditable=True, readonly=False, default=_t(u'%s' % self.default))
     return data
    def addHttpComponent(self, ob, httpPort='80', httpUseSSL=False, httpUrl='/', httpAuthUser='', httpAuthPassword='', httpJsonPost='', httpFindString=''):
        """ Adds HTTP Component URL monitor"""
        id = ob.id + '_' + re.sub('[^A-Za-z0-9]+', '', httpUrl) + '_'+httpPort
        httpcomponent = HttpComponent(id)
        ob.httpComponents._setObject(httpcomponent.id, httpcomponent)
        httpcomponent = ob.httpComponents._getOb(httpcomponent.id)
        httpcomponent.httpIp = ob.manageIp
        httpcomponent.httpPort = httpPort
        httpcomponent.httpUseSSL = httpUseSSL
        httpcomponent.httpUrl = httpUrl
        httpcomponent.httpAuthUser = httpAuthUser
        httpcomponent.httpAuthPassword = httpAuthPassword
        httpcomponent.httpJsonPost = httpJsonPost
        httpcomponent.httpFindString = httpFindString

        return True, _t(" Added URL Monitor for device %s" % (ob.id))
 def get_chooser(self, vocname, vocref, voctext):
     ''''''
     listName = "list%s" % self.methodName
     getName = "_get%s" % self.id
     setName = "_set%s" % self.id
     listChoices = stringToMethod(listName, '''def %s(self):\n    return self._object.%s()\n''' % (listName, self.methodName))
     getChoice = stringToMethod(getName, '''def %s(self):\n    return self._object.%s\n''' % (getName, self.id))
     setChoice = stringToMethod(setName, '''def %s(self, value):\n    self._object.%s = value\n'''% (setName, self.id))
     data = {'info': {}, 'interface': {}, 'infotext': {}}
     data['info'][listName] = listChoices
     data['info'][getName] = getChoice
     data['info'][setName] = setChoice
     data['info'][self.id] = property(getChoice, setChoice)
     #voctext = '''from zope.schema.vocabulary import SimpleVocabulary\ndef %s(context):\n    return SimpleVocabulary.fromValues(context.%s())\n\n''' % (vocname, listName)
     data['infotext'][vocname] = voctext % (vocname, listName)
     data['interface'][self.id] = schema.Choice(title=_t(u'%s' % self.title), alwaysEditable=True, vocabulary=vocref, default=self.default)
     return data
 def jsonAddFields(self,data):
     ''' format fields for the component-add.js file '''
     fields = []
     for v in data:
         if v.optional is False and v.isMethod is False:
             data = {'xtype' : v.xtype(),
                     'name' : v.id,
                     'fieldLabel' : _t('%s') % v.title,
                     'id' : '%sField' % v.id,
                     'width' : 260,
                     'allowBlank' : v.is_optional()
                     }
             fields.append(data)
     cols = ['xtype', 'name', 'fieldLabel', 'id', 'width', 'allowBlank']
     #log.debug( "add fields: %s" % fields)
     output = self.jsonify(fields,24)
     for f in cols:  output = output.replace('"%s"' % f, f)
     output = output.replace('"', "'")
     return output
 def get_chooser(self, vocname, vocref, voctext):
     '''
         return dict with the info, interface, and vocablulary 
         needed for drop-down chooser menus like eventClass
     '''
     listName = "list%s" % self.methodName
     getName = "_get%s" % self.id
     setName = "_set%s" % self.id
     listChoices = stringToMethod(listName, '''def %s(self):\n    return self._object.%s()\n''' % (listName, self.methodName))
     getChoice = stringToMethod(getName, '''def %s(self):\n    return self._object.%s\n''' % (getName, self.id))
     setChoice = stringToMethod(setName, '''def %s(self, value):\n    self._object.%s = value\n'''% (setName, self.id))
     data = {'info': {}, 'interface': {}, 'infotext': {}}
     data['info'][listName] = listChoices
     data['info'][getName] = getChoice
     data['info'][setName] = setChoice
     data['info'][self.id] = property(getChoice, setChoice)
     data['infotext'][vocname] = voctext % (vocname, listName)
     data['interface'][self.id] = schema.Choice(title=_t(u'%s' % self.title), alwaysEditable=True, vocabulary=vocref, default=self.default)
     return data
Example #29
0
    def getTemplates(self, id):
        object = self._getObject(id)
        rrdTemplates = object.getRRDTemplates()

        # used to sort the templates
        def byTitleOrId(left, right):
            return cmp(left.titleOrId().lower(), right.titleOrId().lower())

        for rrdTemplate in sorted(rrdTemplates, byTitleOrId):
            uid = '/'.join(rrdTemplate.getPrimaryPath())
            # only show Bound Templates
            if rrdTemplate.id in object.zDeviceTemplates:
                path = rrdTemplate.getUIPath()

                # if defined directly on the device do not show the path
                if isinstance(object, Device) and object.titleOrId() in path:
                    path = _t('Locally Defined')
                yield {'id': uid,
                       'uid': uid,
                       'path': path,
                       'text': '%s (%s)' % (rrdTemplate.titleOrId(), path),
                       'leaf': True
                       }
    def addOpenStack(self, hostname, authUrl, username, apiKey):
        """
        Handles adding a new OpenStack endpoint to the system.
        """
        # Verify that this device does not already exist.
        deviceRoot = self._dmd.getDmdRoot("Devices")
        device = deviceRoot.findDeviceByIdExact(hostname)
        if device:
            return False, _t("A device named %s already exists." % hostname)

        zProperties = {
            'zOpenStackAuthUrl': authUrl,
            'zCommandUsername': username,
            'zCommandPassword': apiKey,
            }

        perfConf = self._dmd.Monitors.getPerformanceMonitor('localhost')
        jobStatus = perfConf.addDeviceCreationJob(
            deviceName=hostname,
            devicePath=OPENSTACK_DEVICE_PATH,
            discoverProto='python',
            zProperties=zProperties)

        return True, jobStatus.id
Example #31
0
class IPrinterCoverInfo(IComponentInfo):
    coverstatus = SingleLineText(title=_t(u"Cover Status"))
class IMailTxDataSourceInfo(IRRDDataSourceInfo):
    cycleTime = schema.Int(title=_t(u'Cycle Time (seconds)'))
    timeout = schema.Int(title=_t(u"Timeout (seconds)"))
    toAddress = schema.TextLine(title=_t(u"To Address"))
    fromAddress = schema.TextLine(title=_t(u"From Address"))
    messageBody = schema.TextLine(title=_t(u'Message Body'),
                                  xtype="twocolumntextarea")

    # SMTP fields
    smtpHost = schema.TextLine(title=_t(u'SMTP Host'), group=_t(u'SMTP'))
    smtpPort = schema.Int(title=_t(u'SMTP Port'), group=_t(u'SMTP'))
    smtpUsername = schema.TextLine(title=_t(u'SMTP Username'),
                                   group=_t(u'SMTP'))
    smtpPassword = schema.Password(title=_t(u'SMTP Password'),
                                   group=_t(u'SMTP'))
    smtpAuth = schema.Choice(title=_t(u'Transport Security'),
                             vocabulary="transportSecurity",
                             group=_t(u'SMTP'))

    # POP fields
    popHost = schema.TextLine(title=_t(u'POP Host'), group=_t(u'POP'))
    popPort = schema.Int(title=_t(u'POP Port'), group=_t(u'POP'))
    popUsername = schema.TextLine(title=_t(u'POP Username'), group=_t(u'POP'))
    popPassword = schema.Password(title=_t(u'POP Password'), group=_t(u'POP'))
    popAuth = schema.Choice(title=_t(u'Transport Security'),
                            vocabulary="transportSecurity",
                            group=_t(u'POP'))
    popAllowInsecureLogin = schema.Bool(title=_t(u'Allow Insecure Logins?'),
                                        group=_t(u'POP'))
Example #33
0
class IStulzRunTimesInfo(IComponentInfo):
    unitNamer                    = SingleLineText(title=_t(u"Unit ID"))
    unitOnOffr                   = SingleLineText(title=_t(u"Unit On/Off"))
    busidr                       = SingleLineText(title=_t(u"Bus ID"))
    unitidr                      = SingleLineText(title=_t(u"Unit ID"))
    unitRuntimeUnit              = SingleLineText(title=_t(u"Unit Run Time"))
    unitStoptimeUnit             = SingleLineText(title=_t(u"Unit Stop Time"))
    unitRuntimeCooling           = SingleLineText(title=_t(u"Run Time Cooling"))
    unitRuntimeHeating           = SingleLineText(title=_t(u"Run Time Heating"))
    unitRuntimeHumidification    = SingleLineText(title=_t(u"Run Time Humidification"))
    unitRuntimeDehumidification  = SingleLineText(title=_t(u"Run Time Dehumidification"))
    compr1Runtime                = SingleLineText(title=_t(u"Run Time Compressor"))
    fan1Runtime                  = SingleLineText(title=_t(u"Run Time Fan"))
    elecHeating1Runtime          = SingleLineText(title=_t(u"Run Time ElecHeating"))
class IWBEMDataSourceInfo(IRRDDataSourceInfo):
    cycletime = schema.TextLine(title=_t(u'Cycle Time (seconds)'))

    namespace = schema.TextLine(group=_t('WBEM'), title=_t('Namespace'))

    query = schema.Text(group=_t(u'WBEM'),
                        title=_t('CQL Query'),
                        xtype='twocolumntextarea')

    result_component_key = schema.TextLine(group=_t(u'WBEM Results'),
                                           title=_t(u'Result Component Key'))

    result_component_value = schema.TextLine(
        group=_t(u'WBEM Results'), title=_t(u'Result Component Value'))

    result_timestamp_key = schema.TextLine(group=_t(u'WBEM Results'),
                                           title=_t(u'Result Timestamp Key'))
Example #35
0
class IWinSQLBackupInfo(IWinComponentInfo):
    devicetype = schema.TextLine(title=_t(u'Device Type'), readonly=True)
    physicallocation = schema.TextLine(title=_t(u'Physical Location'),
                                       readonly=True)
    status = schema.TextLine(title=_t(u'Status'), readonly=True)
    instancename = schema.TextLine(title=_t(u'Instance Name'), readonly=True)
Example #36
0
class ITrueNASDatasetInfo(IComponentInfo):
    size = schema.TextLine(title=_t('Available Size'))
Example #37
0
class IPIFInfo(IPooledComponentInfo):
    '''
    API Info interface for PIF.
    '''

    host = schema.Entity(title=_t(u'Host'))
    network = schema.Entity(title=_t(u'Network'))
    server_interface = schema.Entity(title=_t(u'Server Interface'))

    dns = schema.TextLine(title=_t(u'DNS Server Address'))
    ipv4_addresses = schema.TextLine(title=_t(u'IPv4 Addresses'))
    ipv6_addresses = schema.TextLine(title=_t(u'IPv6 Addresses'))
    macaddress = schema.TextLine(title=_t(u'MAC Address'))
    mtu = schema.TextLine(title=_t(u'MTU'))
    vlan = schema.TextLine(title=_t(u'VLAN'))
    carrier = schema.Bool(title=_t(u'Carrier'))
    currently_attached = schema.Bool(title=_t(u'Currently Attached'))
    pif_device = schema.TextLine(title=_t(u'Network Device'))
    pif_device_id = schema.TextLine(title=_t(u'Network Device ID'))
    pif_device_name = schema.TextLine(title=_t(u'Network Device Name'))
    disallow_unplug = schema.Bool(title=_t(u'Disallow Unplug'))
    ipv4_gateway = schema.TextLine(title=_t(u'IPv4 Gateway'))
    ipv4_configuration_mode = schema.TextLine(
        title=_t(u'IPv4 Configuration Mode'))
    ipv6_configuration_mode = schema.TextLine(
        title=_t(u'IPv6 Configuration Mode'))
    ipv6_gateway = schema.TextLine(title=_t(u'IPv6 Gateway'))
    management = schema.Bool(title=_t(u'Management'))
    ipv4_netmask = schema.TextLine(title=_t(u'IPv4 Netmask'))
    physical = schema.Bool(title=_t(u'Physical'))
    primary_address_type = schema.TextLine(title=_t(u'Primary Address Type'))
    speed = schema.Int(title=_t(u'Speed'))
    vendor_name = schema.TextLine(title=_t(u'Vendor Name'))
class IWMIDataSourceInfo(IInfo):
    name = schema.Text(title=_t(u'Name'))
    enabled = schema.Bool(title=_t(u'Enabled'))
    namespace = schema.Text(title=_t(u'Namespace'))
    wql = schema.TextLine(title=_t(u'Query'))
Example #39
0
 def configSchema(self):
     configSchema = [{
         'id': 'event_age_disable_severity',
         'name': _t("Don't Age This Severity and Above"),
         'xtype': 'eventageseverity',
     }, {
         'id': 'event_age_severity_inclusive',
         'xtype': 'hidden',
     }, {
         'id': 'event_age_interval_minutes',
         'name': _t('Event Aging Threshold (minutes)'),
         'xtype': 'numberfield',
         'minValue': 0,
         'allowNegative': False,
     }, {
         'id': 'aging_interval_milliseconds',
         'name': _t('Event Aging Interval (milliseconds)'),
         'xtype': 'numberfield',
         'minValue': 1,
         'allowNegative': False
     }, {
         'id': 'aging_limit',
         'name': _t('Event Aging Limit'),
         'xtype': 'numberfield',
         'minValue': 1,
         'allowNegative': False
     }, {
         'id': 'event_archive_interval_minutes',
         'name': _t('Event Archive Threshold (minutes)'),
         'xtype': 'numberfield',
         'minValue': 1,
         'maxValue': 43200,
         'allowNegative': False,
     }, {
         'id': 'archive_interval_milliseconds',
         'name': _t('Event Archive Interval (milliseconds)'),
         'xtype': 'numberfield',
         'minValue': 1,
         'allowNegative': False,
     }, {
         'id': 'archive_limit',
         'name': _t('Event Archive Limit'),
         'xtype': 'numberfield',
         'minValue': 1,
         'allowNegative': False,
     }, {
         'id': 'event_archive_purge_interval_days',
         'minValue': 1,
         'name': _t('Delete Archived Events Older Than (days)'),
         'xtype': 'numberfield',
         'allowNegative': False,
     }, {
         'id':
         'default_syslog_priority',
         'name':
         _t('Default Syslog Priority'),
         'xtype':
         'numberfield',
         'allowNegative':
         False,
         'value':
         self.context.dmd.ZenEventManager.defaultPriority
     }, {
         'id':
         'default_availability_days',
         'name':
         _t('Default Availability Report (days)'),
         'xtype':
         'numberfield',
         'allowNegative':
         False,
         'minValue':
         1,
         'value':
         self.context.dmd.ZenEventManager.defaultAvailabilityDays
     }, {
         'id': 'event_max_size_bytes',
         'name': _t('Max Event Size In Bytes'),
         'xtype': 'numberfield',
         'allowNegative': False,
         'minValue': 8192,
         'maxValue': 102400,
     }, {
         'id': 'index_summary_interval_milliseconds',
         'name': _t('Summary Index Interval (milliseconds)'),
         'xtype': 'numberfield',
         'allowNegative': False,
         'minValue': 1
     }, {
         'id': 'index_archive_interval_milliseconds',
         'name': _t('Archive Index Interval (milliseconds)'),
         'xtype': 'numberfield',
         'allowNegative': False,
         'minValue': 1
     }, {
         'id': 'index_limit',
         'name': _t('Index Limit'),
         'xtype': 'numberfield',
         'allowNegative': False,
         'minValue': 1
     }, {
         'id': 'event_time_purge_interval_days',
         'name': _t('Event Time Purge Interval (days)'),
         'xtype': 'numberfield',
         'allowNegative': False,
         'minValue': 1
     }, {
         'id': 'enable_event_flapping_detection',
         'name': _t('Enable Event Flapping Detection'),
         'xtype': 'checkbox',
     }, {
         'id': 'flapping_event_class',
         'name': _t('Event Flapping Event Class'),
         'xtype': 'eventclass'
     }]
     return configSchema
Example #40
0
class IMySqlMonitorDataSourceInfo(IBasicDataSourceInfo):
    usessh = schema.Bool(title=_t(u"Use SSH"))
    cycletime = schema.Int(title=_t(u'Cycle Time (seconds)'))
    timeout = schema.Int(title=_t(u'Timeout (seconds)'))
    hostname = schema.TextLine(title=_t(u'MySQL Host'), group=_t(u'MySQL'))
    username = schema.TextLine(title=_t(u'MySQL Username'), group=_t(u'MySQL'))
    port = schema.TextLine(title=_t(u'MySQL Port'), group=_t(u'MySQL'))
    password = schema.Password(title=_t(u'MySQL Password'), group=_t(u'MySQL'))
    versionFivePlus = schema.Bool(title=_t(u'MySQL Version 5+'),
                                  group=_t(u'MySQL'))
Example #41
0
class IClusterResourceInfo(IWinComponentInfo):
    ownernode = schema.TextLine(title=_t(u'Owner Node'), readonly=True)
    description = schema.TextLine(title=_t(u'Description'), readonly=True)
    ownergroup = schema.TextLine(title=_t(u'Owner Group'), readonly=True)
    state = schema.TextLine(title=_t(u'State'), readonly=True)
Example #42
0
class IClusterServiceInfo(IWinComponentInfo):
    ownernode = schema.TextLine(title=_t(u'Owner Node'), readonly=True)
    description = schema.TextLine(title=_t(u'Description'), readonly=True)
    coregroup = schema.TextLine(title=_t(u'Core Group'), readonly=True)
    priority = schema.TextLine(title=_t(u'Priority'), readonly=True)
    state = schema.TextLine(title=_t(u'State'), readonly=True)
Example #43
0
class IWinSQLInstanceInfo(IWinComponentInfo):
    instancename = schema.TextLine(title=_t(u'Instance Name'), readonly=True)
Example #44
0
from Products.Zuul.routers import TreeRouter
from Products import Zuul
from Products.ZenModel.ReportClass import ReportClass
from Products.ZenModel.BaseReport import BaseReport
from Products.Zuul.interfaces import ICatalogTool

log = logging.getLogger('zen.ReportRouter')

reportTypes = [
    'customDeviceReport',
    'graphReport',
    'multiGraphReport',
]

menuText = [
    _t('Custom Device Report'),
    _t('Graph Report'),
    _t('Multi-Graph Report'),
]

essentialReportOrganizers = [
    '/zport/dmd/Reports/Custom Device Reports',
    '/zport/dmd/Reports/Graph Reports',
    '/zport/dmd/Reports/Multi-Graph Reports',
    '/zport/dmd/Reports',
]


class ReportRouter(TreeRouter):
    """
    A JSON/ExtDirect interface to operations on reports
Example #45
0
class ITonerContainerInfo(IComponentInfo):
    tonername = SingleLineText(title=_t(u"Toner Name"))
    maxcapacity = schema.Int(title=_t(u"Max Capacity"))
class IPythonDataSourceInfo(IRRDDataSourceInfo):
    plugin_classname = schema.TextLine(title=_t(u'Plugin Class Name'))
    cycletime = schema.TextLine(title=_t(u'Cycle Time (seconds)'))
Example #47
0
class IAWSEmailHostActionContentInfo(IInfo):

    body_content_type = schema.Choice(
        title=_t(u'Body Content Type'),
        vocabulary=SimpleVocabulary.fromValues(
            actions.getNotificationBodyTypes()),
        description=_t(u'The content type of the body for emails.'),
        default=u'html')

    subject_format = schema.TextLine(
        title=_t(u'Message (Subject) Format'),
        description=_t(u'The template for the subject for emails.'),
        default=_t(u'[zenoss] ${evt/device} ${evt/summary}'))

    body_format = schema.Text(
        title=_t(u'Body Format'),
        description=_t(u'The template for the body for emails.'),
        default=textwrap.dedent(text=u'''
        Device: ${evt/device}
        Component: ${evt/component}
        Severity: ${evt/severity}
        Time: ${evt/lastTime}
        Message:
        ${evt/message}
        <a href="${urls/eventUrl}">Event Detail</a>
        <a href="${urls/ackUrl}">Acknowledge</a>
        <a href="${urls/closeUrl}">Close</a>
        <a href="${urls/eventsUrl}">Device Events</a>
        '''))

    clear_subject_format = schema.TextLine(
        title=_t(u'Clear Message (Subject) Format'),
        description=_t(u'The template for the subject for CLEAR emails.'),
        default=_t(u'[zenoss] CLEAR: ${evt/device} ${clearEvt/summary}'))

    clear_body_format = schema.Text(
        title=_t(u'Body Format'),
        description=_t(u'The template for the body for CLEAR emails.'),
        default=textwrap.dedent(text=u'''
        Event: '${evt/summary}'
        Cleared by: '${evt/clearid}'
        At: ${evt/stateChange}
        Device: ${evt/device}
        Component: ${evt/component}
        Severity: ${evt/severity}
        Message:
        ${evt/message}
        <a href="${urls/reopenUrl}">Reopen</a>
        '''))

    email_from = schema.Text(
        title=_t(u'From Address for Emails'),
        description=_t(
            u'The user from which the e-mail originated on the Zenoss server.'
        ),
        default=u'*****@*****.**')

    aws_account_name = schema.Text(
        title=_t(u'AWS Account Name'),
        description=_t(u'Name of the AWS account you\'ll be using.'),
    )

    aws_region = schema.Choice(
        title=_t(u'AWS Region'),
        vocabulary=SimpleVocabulary.fromValues(getSESRegions()),
        description=_t(u'List of available AWS Regions.'),
        default=getSESRegions()[0])

    aws_access_key = schema.Text(
        title=_t(u'AWS Access Key'),
        description=_t(u'Access Key for the AWS account.'),
    )

    aws_secret_key = schema.Password(
        title=_t(u'AWS Secret Key'),
        description=_t(u'Secret Key for the AWS account.'),
    )
Example #48
0
class IExampleComponentInfo(IComponentInfo):
    attributeOne = schema.Int(title=_t(u"Attribute #1"))
    attributeTwo = SingleLineText(title=_t(u"Attribute #2"))
Example #49
0
class ITrueNASPoolInfo(IComponentInfo):
    size = schema.TextLine(title=_t('Available Size'))
    health = schema.TextLine(title=_t('Pool Health'))
Example #50
0
class IWinIISInfo(IWinComponentInfo):
    sitename = schema.TextLine(title=_t(u'Site Name'), readonly=True)
    apppool = schema.TextLine(title=_t(u'App Pool'), readonly=True)
    caption = schema.TextLine(title=_t(u'Caption'), readonly=True)
    status = schema.TextLine(title=_t(u'Status'), readonly=True)
    statusname = schema.TextLine(title=_t(u'Status Name'), readonly=True)
Example #51
0
class IDeviceInfo(IDeviceInfo):
    clusterdevices = schema.TextLine(title=_t(u'Cluster Devices'),
                                     readonly=True)
Example #52
0
class ISplunkDataSourceInfo(IBasicDataSourceInfo):
    timeout = schema.Int(title=_t(u"Timeout (seconds)"))
    component = schema.Text(title=_t(u"Component"))
    eventKey = schema.Text(title=_t(u"Event Key"))

    splunkServer = schema.Text(title=_t(u"Splunk Server"), group=_t('Splunk'))
    splunkUsername = schema.Text(title=_t(u"Splunk Username"),
                                 group=_t('Splunk'))
    splunkPort = schema.Int(title=_t(u"Splunk Port"), group=_t('Splunk'))
    splunkPassword = schema.Password(title=_t(u"Splunk Password"),
                                     group=_t('Splunk'))
    splunkSearch = schema.Text(title=_t(u"Search"), group=_t('Splunk'))
class ISQLDataSourceInfo(IInfo):
    name = schema.Text(title=_t(u'Name'))
    enabled = schema.Bool(title=_t(u'Enabled'))
    cs = schema.Text(title=_t(u'Connection String'))
    sql = schema.TextLine(title=_t(u'SQL Query'))
Example #54
0
class IClusterDeviceInfo(IDeviceInfo):
    clusterhostdevices = schema.TextLine(title=_t(u'Cluster Host Devices'),
                                         readonly=True)
    guid = schema.TextLine(title=_t(u'GUID'), readonly=True)
    creatingdc = schema.TextLine(title=_t(u'Creating DC'), readonly=True)
class IImageInfo(IComponentInfo):
    imageId = schema.TextLine(title=_t(u"Image ID"))
    imageStatus = schema.TextLine(title=_t(u"Image Status"))
    imageCreated = schema.TextLine(title=_t(u"Image Created"))
    imageUpdated = schema.TextLine(title=_t(u"Image Updated"))
    serverCount = schema.Int(title=_t(u"Server Count"))
Example #56
0
class IWinComponentInfo(IComponentInfo):
    title = schema.TextLine(title=_t(u'Title'), readonly=True)
Example #57
0
class ICPUInfo(IWinComponentInfo):
    description = schema.TextLine(title=_t(u'Description'), readonly=True)
    clockspeed_str = schema.TextLine(title=_t(u'Clock Speed'), readonly=True)
    extspeed_str = schema.TextLine(title=_t(u'External Speed'), readonly=True)
    voltage_str = schema.TextLine(title=_t(u'Voltage'), readonly=True)
    cacheSizeL1_str = schema.TextLine(title=_t(u'L1 Cache Size'),
                                      readonly=True)
    cacheSizeL2_str = schema.TextLine(title=_t(u'L2 Cache Size'),
                                      readonly=True)
    cacheSpeedL2_str = schema.TextLine(title=_t('L2 Cache Speed'),
                                       readonly=True)
    cacheSizeL3_str = schema.TextLine(title=_t(u'L3 Cache Size'),
                                      readonly=True)
    cacheSpeedL3_str = schema.TextLine(title=_t('L3 Cache Speed'),
                                       readonly=True)
    manufacturer = schema.Entity(title=_t('Manufacturer'), readonly=True)
    product = schema.Entity(title=_t('Model'), readonly=True)
Example #58
0
class IFileSystemInfo(IBaseFileSystemInfo):
    mediatype = schema.TextLine(title=_t(u'Media Type'), readonly=True)
Example #59
0
class IPerfmonDataSourceInfo(IRRDDataSourceInfo):
    cycletime = schema.TextLine(title=_t(u'Cycle Time (seconds)'))

    counter = schema.TextLine(group=_t(SOURCETYPE), title=_t('Counter'))
Example #60
0
class IEventLogInfo(IInfo):
    newId = schema.TextLine(title=_t(u'Name'),
                            xtype="idfield",
                            description=_t(u'The name of this datasource'))
    type = schema.TextLine(title=_t(u'Type'), readonly=True)
    enabled = schema.Bool(title=_t(u'Enabled'))
    eventClass = schema.TextLine(title=_t(u'Event Class'), xtype='eventclass')
    component = schema.TextLine(title=_t(u'Component'))
    cycletime = schema.TextLine(title=_t(u'Cycle Time (seconds)'))
    eventlog = schema.TextLine(group=_t('WindowsEventLog'),
                               title=_t('Event Log'))
    query = schema.Text(group=_t(u'WindowsEventLog'),
                        title=_t('Event Query Powershell or XPath XML'),
                        xtype='textarea')
    max_age = schema.TextLine(
        group=_t(u'WindowsEventLog'),
        title=_t('Max age of events to get (hours)'),
    )