コード例 #1
0
class WinSQLInstance(OSComponent):
    '''
    Model class for MSSQL Instance.
    '''
    meta_type = portal_type = 'WinDBInstance'

    instancename = None
    backupdevices = None
    roles = None

    _properties = OSComponent._properties + (
        {'id': 'instancename', 'type': 'string'},
        )

    _relations = OSComponent._relations + (
        ("os", ToOne(ToManyCont,
            "ZenPacks.zenoss.Microsoft.Windows.OperatingSystem",
            "winsqlinstances")),
        ("backups", ToManyCont(ToOne,
            "ZenPacks.zenoss.Microsoft.Windows.WinSQLBackup",
            "winsqlinstance")),
        ("jobs", ToManyCont(ToOne,
            "ZenPacks.zenoss.Microsoft.Windows.WinSQLJob",
            "winsqlinstance")),
        ("databases", ToManyCont(ToOne,
            "ZenPacks.zenoss.Microsoft.Windows.WinSQLDatabase",
            "winsqlinstance")),
    )

    def getRRDTemplateName(self):
        return 'WinDBInstance'
コード例 #2
0
class Endpoint(Device):
    meta_type = portal_type = 'OpenStackEndpoint'

    _relations = Device._relations + (
        (
            'flavors',
            ToManyCont(
                ToOne,
                'ZenPacks.zenoss.OpenStack.Flavor.Flavor',
                'endpoint',
            ),
        ),
        (
            'images',
            ToManyCont(
                ToOne,
                'ZenPacks.zenoss.OpenStack.Image.Image',
                'endpoint',
            ),
        ),
        (
            'servers',
            ToManyCont(
                ToOne,
                'ZenPacks.zenoss.OpenStack.Server.Server',
                'endpoint',
            ),
        ),
    )
コード例 #3
0
class RabbitMQVHost(RabbitMQComponent):
    meta_type = portal_type = "RabbitMQVHost"

    _relations = RabbitMQComponent._relations + (
        (
            'rabbitmq_node',
            ToOne(
                ToManyCont,
                'ZenPacks.zenoss.RabbitMQ.RabbitMQNode.RabbitMQNode',
                'rabbitmq_vhosts',
            ),
        ),
        (
            'rabbitmq_exchanges',
            ToManyCont(
                ToOne,
                'ZenPacks.zenoss.RabbitMQ.RabbitMQExchange.RabbitMQExchange',
                'rabbitmq_vhost',
            ),
        ),
        (
            'rabbitmq_queues',
            ToManyCont(
                ToOne,
                'ZenPacks.zenoss.RabbitMQ.RabbitMQQueue.RabbitMQQueue',
                'rabbitmq_vhost',
            ),
        ),
    )

    def device(self):
        return self.rabbitmq_node().device()
コード例 #4
0
class IBM3584DeviceHW(DeviceHW):

    # Define new relationships
    _relations = DeviceHW._relations + (
        ("changerdevices", ToManyCont(ToOne, "ZenPacks.community.IBM3584Mon.IBM3584ChangerDevice", "hw")),
        ("frames", ToManyCont(ToOne, "ZenPacks.community.IBM3584Mon.IBM3584Frame", "hw")),
        ("accessdevices", ToManyCont(ToOne, "ZenPacks.community.IBM3584Mon.IBM3584AccessDevice", "hw")),
    )
コード例 #5
0
class A10Device(Device):
    """
    A10 device subclass. In this case the reason for creating a subclass of
    device is to add a new type of relation. We want many "A10ServiceGroup" and "A10VirtualServer"
    components to be associated with each of these devices.

    If you set the zPythonClass of a device class to
    ZenPacks.community.A10Device, any devices created or moved
    into that device class will become this class and be able to contain
    A10ServiceGroups and A10VirtualServers.
    """

    meta_type = portal_type = 'A10Device'

    memoryUsed = 0

    _properties = Device._properties + ({
        'id': 'memoryUsed',
        'type': 'int',
        'mode': ''
    }, )

    # This is where we extend the standard relationships of a device to add
    # the "a10Servers", "a10ServiceGroups" and "a10VirtualServers" relationships that must be filled with components
    # of our custom "A10Server", "A10ServiceGroup" and "A10VirtualServer" classes.
    _relations = Device._relations + (
        (
            'a10VirtualServers',
            ToManyCont(
                ToOne,
                'ZenPacks.community.A10.A10VirtualServer',
                'a10Device',
            ),
        ),
        (
            'a10ServiceGroups',
            ToManyCont(
                ToOne,
                'ZenPacks.community.A10.A10ServiceGroup',
                'a10Device',
            ),
        ),
        (
            'a10Servers',
            ToManyCont(
                ToOne,
                'ZenPacks.community.A10.A10Server',
                'a10Device',
            ),
        ),
    )

    factory_type_information = deepcopy(Device.factory_type_information)

    def __init__(self, *args, **kw):
        Device.__init__(self, *args, **kw)
        self.buildRelations()
コード例 #6
0
class upsDevice(Device):
    "upsCS1x1 Device"
    meta_type = portal_type = 'upsDevice'


    _relations = Device._relations + (
        ('upsBattery',       ToManyCont(ToOne, 'ZenPacks.community.upsCS1x1.upsBattery',       'upsDevBattery',),),
        ('upsInput',         ToManyCont(ToOne, 'ZenPacks.community.upsCS1x1.upsInput',         'upsDevInput',),),
        ('upsOutput',        ToManyCont(ToOne, 'ZenPacks.community.upsCS1x1.upsOutput',        'upsDevOutput',),),
        ('upsBypass',        ToManyCont(ToOne, 'ZenPacks.community.upsCS1x1.upsBypass',        'upsDevBypass',),),
    )
コード例 #7
0
class EC2Region(AWSComponent):
    '''
    Model class for EC2Region.
    '''

    meta_type = portal_type = 'EC2Region'

    _instance_device_ids = None

    _properties = AWSComponent._properties

    _relations = AWSComponent._relations + (
        ('account', ToOne(ToManyCont, MODULE_NAME['EC2Account'], 'regions')),
        ('zones', ToManyCont(ToOne, MODULE_NAME['EC2Zone'], 'region')),
        ('instances', ToManyCont(ToOne, MODULE_NAME['EC2Instance'], 'region')),
        ('volumes', ToManyCont(ToOne, MODULE_NAME['EC2Volume'], 'region')),
        ('vpcs', ToManyCont(ToOne, MODULE_NAME['EC2VPC'], 'region')),
        ('vpc_subnets', ToManyCont(ToOne, MODULE_NAME['EC2VPCSubnet'],
                                   'region')),
    )

    def getDimension(self):
        return ''

    def getRegionId(self):
        return self.id

    @transact
    def discover_guests(self):
        '''
        Attempt to discover and link instance guest devices.
        '''
        map(operator.methodcaller('discover_guest'), self.instances())

        # First discovery. Initialize our instance device ids storage.
        if self._instance_device_ids is None:
            self._instance_device_ids = set(self.instances.objectIds())
            return

        instance_device_ids = set(self.instances.objectIds())
        terminated_device_ids = self._instance_device_ids.difference(
            instance_device_ids)

        # Delete guest devices for terminated instances.
        for device_id in terminated_device_ids:
            guest_device = self.findDeviceByIdExact(device_id)
            if guest_device:
                LOG.info('Deleting device %s after instance %s was terminated',
                         guest_device.titleOrId(), guest_device.id)

                guest_device.deleteDevice()

        # Store instance device ids for next run.
        self._instance_device_ids = instance_device_ids
コード例 #8
0
class Zone(BaseComponent):
    meta_type = portal_type = "CloudStackZone"

    guest_cidr_address = None
    dhcp_provider = None
    dns1 = None
    dns2 = None
    internal_dns1 = None
    internal_dns2 = None
    network_type = None
    security_groups_enabled = None
    vlan = None
    zone_token = None

    _properties = BaseComponent._properties + (
        {'id': 'guest_cidr_address', 'type': 'string', 'mode': ''},
        {'id': 'dhcp_provider', 'type': 'string', 'mode': ''},
        {'id': 'dns1', 'type': 'string', 'mode': ''},
        {'id': 'dns2', 'type': 'string', 'mode': ''},
        {'id': 'internal_dns1', 'type': 'string', 'mode': ''},
        {'id': 'internal_dns2', 'type': 'string', 'mode': ''},
        {'id': 'network_type', 'type': 'string', 'mode': ''},
        {'id': 'security_groups_enabled', 'type': 'boolean', 'mode': ''},
        {'id': 'vlan', 'type': 'string', 'mode': ''},
        {'id': 'zone_token', 'type': 'string', 'mode': ''},
        )

    _relations = BaseComponent._relations + (
        ('cloud', ToOne(ToManyCont,
            'ZenPacks.zenoss.CloudStack.Cloud.Cloud',
            'zones')
            ),

        ('pods', ToManyCont(ToOne,
            'ZenPacks.zenoss.CloudStack.Pod.Pod',
            'zone')
            ),

        ('vms', ToManyCont(ToOne,
            'ZenPacks.zenoss.CloudStack.VirtualMachine.VirtualMachine',
            'zone')
            ),
        )

    def device(self):
        return self.cloud()


    def getRRDTemplates(self):
        templates = super(Zone, self).getRRDTemplates()
        if not self.isRootAdmin():
            return []

        return templates
コード例 #9
0
class Endpoint(Device):
    meta_type = portal_type = 'OpenStackEndpoint'

    _relations = Device._relations + (
        (
            'flavors',
            ToManyCont(
                ToOne,
                'ZenPacks.zenoss.OpenStack.Flavor.Flavor',
                'endpoint',
            ),
        ),
        (
            'images',
            ToManyCont(
                ToOne,
                'ZenPacks.zenoss.OpenStack.Image.Image',
                'endpoint',
            ),
        ),
        (
            'servers',
            ToManyCont(
                ToOne,
                'ZenPacks.zenoss.OpenStack.Server.Server',
                'endpoint',
            ),
        ),
    )

    def getIconPath(self):
        return '/++resource++openstack/img/openstack.png'

    def getStatus(self, statusclass="/Status/*", **kwargs):
        # This is identical the behavior provided by ZPL- once this zenpack
        # is converted to ZPL, this method can be removed.
        if not self.monitorDevice():
            return None

        zep = Zuul.getFacade("zep", self.dmd)
        try:
            event_filter = zep.createEventFilter(
                tags=[self.getUUID()],
                element_sub_identifier=[""],
                severity=[SEVERITY_CRITICAL],
                status=[STATUS_NEW, STATUS_ACKNOWLEDGED],
                event_class=filter(None, [statusclass]))

            result = zep.getEventSummaries(0, filter=event_filter, limit=0)
        except Exception:
            return None

        return int(result['total'])
コード例 #10
0
class System(Device):
    meta_type = portal_type = "oVirtSystem"

    _relations = Device._relations + (
        ('datacenters',
         ToManyCont(ToOne, 'ZenPacks.zenoss.oVirt.DataCenter.DataCenter',
                    'system')),
        ('storagedomains',
         ToManyCont(ToOne, 'ZenPacks.zenoss.oVirt.StorageDomain.StorageDomain',
                    'system')),
    )

    def getIconPath(self):
        return icon_for(self, 'system')
コード例 #11
0
class Framework(DeviceComponent, ManagedEntity):
    meta_type = portal_type = 'CloudFoundryFramework'

    cfName = ''
    cfDetection = PersistentList()

    _properties = ManagedEntity._properties + (
        {
            'id': 'cfName',
            'type': 'string',
            'mode': ''
        },
        {
            'id': 'cfDetection',
            'type': 'string',
            'mode': ''
        },
    )

    _relations = ManagedEntity._relations + (
        ('cfEndpoint',
         ToOne(ToManyCont, 'ZenPacks.zenoss.CloudFoundry.Endpoint.Endpoint',
               'cfFrameworks')),
        ('cfRuntimes',
         ToManyCont(ToOne, 'ZenPacks.zenoss.CloudFoundry.Runtime.Runtime',
                    'cfFramework')),
        ('cfAppServers',
         ToManyCont(ToOne, 'ZenPacks.zenoss.CloudFoundry.AppServer.AppServer',
                    'cfFramework')),
    )

    # Meta-data: Zope object views and actions
    factory_type_information = ({
        'actions': ({
            'id': 'perfConf',
            'name': 'Template',
            'action': 'objTemplates',
            'permissions': (ZEN_CHANGE_DEVICE, ),
        }, ),
    }, )

    def device(self):
        return self.cfEndpoint()

    def getCFDetection(self):
        return self.cfDetection

    def setCFDetection(self, detection):
        self.cfDetection = PersistentList(detection)
コード例 #12
0
class OperatingSystem(BaseOS):

    _relations = BaseOS._relations + (
        ("winrmservices",
         ToManyCont(ToOne, "ZenPacks.zenoss.Microsoft.Windows.WinService",
                    "os")),
        ("winrmiis",
         ToManyCont(ToOne, "ZenPacks.zenoss.Microsoft.Windows.WinIIS", "os")),
        ("winsqlinstances",
         ToManyCont(ToOne, "ZenPacks.zenoss.Microsoft.Windows.WinSQLInstance",
                    "os")),
        ("clusterservices",
         ToManyCont(ToOne, "ZenPacks.zenoss.Microsoft.Windows.ClusterService",
                    "os")),
    )
コード例 #13
0
class Cluster(BaseComponent):
    meta_type = portal_type = "CloudStackCluster"

    cluster_type = None
    hypervisor_type = None
    managed_state = None

    _properties = BaseComponent._properties + (
        {
            'id': 'cluster_type',
            'type': 'string',
            'mode': ''
        },
        {
            'id': 'hypervisor_type',
            'type': 'string',
            'mode': ''
        },
        {
            'id': 'managed_state',
            'type': 'string',
            'mode': ''
        },
    )

    _relations = BaseComponent._relations + (
        ('pod',
         ToOne(ToManyCont, 'ZenPacks.zenoss.CloudStack.Pod.Pod', 'clusters')),
        ('hosts',
         ToManyCont(ToOne, 'ZenPacks.zenoss.CloudStack.Host.Host', 'cluster')),
    )

    def device(self):
        return self.pod().device()
コード例 #14
0
class RaidGroup(DeviceComponent, ManagedEntity):
    meta_type = portal_type = 'NetAppRaidGroup'

    rg_name = None

    _properties = ManagedEntity._properties + ({
        'id': 'rg_name',
        'type': 'string'
    }, )

    _relations = ManagedEntity._relations + (
        ('plex',
         ToOne(ToManyCont, 'ZenPacks.CS.NetApp.SevenMode.Plex',
               'raid_groups')),
        ('disks',
         ToManyCont(ToOne, 'ZenPacks.CS.NetApp.SevenMode.Disk', 'raid_group')),
    )

    factory_type_information = ({
        'actions': ({
            'id': 'perfConf',
            'name': 'Template',
            'action': 'objTemplates',
            'permissions': (ZEN_CHANGE_DEVICE, ),
        }, ),
    }, )

    def device(self):
        return self.plex().aggregate().netapp_device()

    def getRRDTemplateName(self):
        return 'NetApp7Mode_RaidGroup'
コード例 #15
0
class Enclosure(DeviceComponent, ManagedEntity):
    meta_type = portal_type = 'NetBotzEnclosure'

    # Fields inherited from DeviceComponent and ManagedEntity
    #   id, title, snmpindex

    enclosure_status = None
    error_status = None
    parent_id = None
    docked_id = None

    _properties = ManagedEntity._properties + (
        {
            'id': 'enclosure_status',
            'type': 'string'
        },
        {
            'id': 'error_status',
            'type': 'string'
        },
        {
            'id': 'parent_id',
            'type': 'string'
        },
        {
            'id': 'docked_id',
            'type': 'string'
        },
    )

    _relations = ManagedEntity._relations + (
        ('sensor_device',
         ToOne(
             ToManyCont,
             'ZenPacks.training.NetBotz.NetBotzDevice',
             'enclosures',
         )),
        ('temperature_sensors',
         ToManyCont(
             ToOne,
             'ZenPacks.training.NetBotz.TemperatureSensor',
             'enclosure',
         )),
    )

    factory_type_information = ({
        'actions': ({
            'id': 'perfConf',
            'name': 'Template',
            'action': 'objTemplates',
            'permissions': (ZEN_CHANGE_DEVICE, ),
        }, ),
    }, )

    def device(self):
        return self.sensor_device()

    def getRRDTemplateName(self):
        return 'Enclosure'
コード例 #16
0
class NetAppDevice(Device):
    """NetApp Device"""
    meta_type = portal_type = 'NetAppDevice'

    _relations = Device._relations + (
        ('aggregates',
         ToManyCont(ToOne, 'ZenPacks.CS.NetApp.SevenMode.Aggregate',
                    'netapp_device')), )
コード例 #17
0
class ExampleDevice(Device):
    """
    Example device subclass. In this case the reason for creating a subclass of
    device is to add a new type of relation. We want many "ExampleComponent"
    components to be associated with each of these devices.

    If you set the zPythonClass of a device class to
    ZenPacks.NAMESPACE.PACKNAME.ExampleDevice, any devices created or moved
    into that device class will become this class and be able to contain
    ExampleComponents.
    """

    meta_type = portal_type = 'ExampleDevice'

    # This is where we extend the standard relationships of a device to add
    # our "exampleComponents" relationship that must be filled with components
    # of our custom "ExampleComponent" class.
    _relations = Device._relations + (
        ('exampleComponents', ToManyCont(ToOne,
            'ZenPacks.skills1st.MenuExamples.ExampleComponent',
            'exampleDevice',
            ),
        ),
    )

    # The menus for this particular device class will have all the standard menus
    # for a Device and then add on this new menu.  The "action" field specifies
    # the page template (.pt) file that defines the menu.

    factory_type_information = deepcopy(Device.factory_type_information)
    factory_type_information[0]['actions'] += (
            { 'id'              : 'ExampleDevice'
            , 'name'            : 'My Example Menu 2 (Example Devices only)'
            , 'action'          : 'myExampleMenuTwo'
            , 'permissions' 	: ( Permissions.view,) },
            )

    # This function called by mydropDownMenu1.pt
    # The parameter "comments" must match the name parameter on the
    #   input line and these both need to match the object attribute you are changing
    # The name of the function must match with the pt file dialog_buttons section, with
    #    the name field for the OK input eg.
    #               <input tal:attributes="type string:submit;
    #                        value string:OK"
    #                        name="createComment:method" />


    def createComment(self, comments='', REQUEST=''):
      """
        Set comments attribute for a device
      """
      self.comments = comments
      if REQUEST:
            messaging.IMessageSender(self).sendToBrowser(
                'Device comment set',
                'Device comment created as %s ' % comments
            )
            return self.callZenScreen(REQUEST)
コード例 #18
0
class xupsDevice(Device):
    meta_type = portal_type = 'xupsDevice'

    _relations = Device._relations + (
        (
            'xupsBattery',
            ToManyCont(
                ToOne,
                'ZenPacks.community.xUPS.xupsBattery',
                'xupsDevBattery',
            ),
        ),
        (
            'xupsInput',
            ToManyCont(
                ToOne,
                'ZenPacks.community.xUPS.xupsInput',
                'xupsDevInput',
            ),
        ),
        (
            'xupsOutput',
            ToManyCont(
                ToOne,
                'ZenPacks.community.xUPS.xupsOutput',
                'xupsDevOutput',
            ),
        ),
        (
            'xupsBypass',
            ToManyCont(
                ToOne,
                'ZenPacks.community.xUPS.xupsBypass',
                'xupsDevBypass',
            ),
        ),
        (
            'xupsContactSense',
            ToManyCont(
                ToOne,
                'ZenPacks.community.xUPS.xupsContactSense',
                'xupsDevContactSense',
            ),
        ),
    )
コード例 #19
0
class Cloud(Device):
    meta_type = portal_type = "CloudStackCloud"

    _relations = Device._relations + (
        ('zones', ToManyCont(ToOne,
            'ZenPacks.zenoss.CloudStack.Zone.Zone',
            'cloud')
            ),
        )
コード例 #20
0
class MySQLServer(MySQLComponent):
    meta_type = portal_type = 'MySQLServer'

    size = None
    data_size = None
    index_size = None
    percent_full_table_scans = None
    slave_status = None
    master_status = None
    version = None
    deadlock_info = None

    _properties = MySQLComponent._properties + (
        {
            'id': 'size',
            'type': 'string'
        },
        {
            'id': 'data_size',
            'type': 'string'
        },
        {
            'id': 'index_size',
            'type': 'string'
        },
        {
            'id': 'percent_full_table_scans',
            'type': 'string'
        },
        {
            'id': 'slave_status',
            'type': 'string'
        },
        {
            'id': 'master_status',
            'type': 'string'
        },
        {
            'id': 'version',
            'type': 'string'
        },
    )

    _relations = MySQLComponent._relations + (
        ('mysql_host',
         ToOne(ToManyCont, 'Products.ZenModel.Device.Device',
               'mysql_servers')),
        ('databases', ToManyCont(ToOne, MODULE_NAME['MySQLDatabase'],
                                 'server')),
    )

    def remove(self, object_id=None):
        if object_id:
            self.databases._delObject(object_id)

    def device(self):
        return self.mysql_host()
コード例 #21
0
class ClusterService(OSComponent):
    '''
    Model class for Cluster Service.
    '''
    meta_type = portal_type = 'MSClusterService'

    ownernode = None
    description = None
    coregroup = False
    priority = 0
    state = None

    _properties = OSComponent._properties + (
        {
            'id': 'ownernode',
            'type': 'string'
        },
        {
            'id': 'description',
            'type': 'string'
        },
        {
            'id': 'coregroup',
            'type': 'boolean'
        },
        {
            'id': 'priority',
            'type': 'integer'
        },
        {
            'id': 'state',
            'type': 'string'
        },
    )

    _relations = OSComponent._relations + (
        ('os',
         ToOne(ToManyCont, 'ZenPacks.zenoss.Microsoft.Windows.OperatingSystem',
               'clusterservices')),
        ('clusterresources',
         ToManyCont(ToOne, 'ZenPacks.zenoss.Microsoft.Windows.ClusterResource',
                    'clusterservice')),
    )

    def ownernodeurl(self):
        deviceRoot = self.dmd.getDmdRoot("Devices")
        try:
            clusterhostip = getHostByName(self.ownernode)
            device = deviceRoot.findDeviceByIdOrIp(clusterhostip)
            return device.getPrimaryUrlPath()
        except (gaierror):
            log.warning('Unable to resolve hostname {0}'.format(
                self.ownernode))
            return

    def getRRDTemplateName(self):
        return 'ClusterService'
コード例 #22
0
def add_relationships(cls):
    """Add our relationships to cls._relations."""
    our_relnames = set(DEVICE_RELATIONS)
    existing_relnames = {x[0] for x in cls._relations}
    new_reltuples = tuple(
        (relname, ToManyCont(ToOne, DEVICE_RELATIONS[relname], 'switch'))
        for relname in our_relnames.difference(existing_relnames))

    if new_reltuples:
        cls._relations += new_reltuples
コード例 #23
0
ファイル: TrueNASDevice.py プロジェクト: ixmarty/Zenoss
class TrueNASDevice(Device):
    # temp_sensor_count = None

    _properties = Device._properties + (
        # {'id': 'temp_sensor_count', 'type': 'int'},
    )
    _relations = Device._relations + (
        ('TrueNAS_Pools',
         ToManyCont(
             ToOne,
             'ZenPacks.iXsystems.TrueNAS.TrueNASPool',
             'TrueNAS_Device',
         )),
        ('TrueNAS_Datasets',
         ToManyCont(
             ToOne,
             'ZenPacks.iXsystems.TrueNAS.TrueNASDataset',
             'TrueNAS_Device',
         )),
    )
コード例 #24
0
class SubComponent(IpService):
    _relations = (
        ("superComponent",
         ToOne(ToManyCont, 'Products.ZenModel.IpService.IpService',
               'subcomponents')),
        ("subcomponents",
         ToManyCont(
             ToOne,
             "Products.ZenModel.tests.testDeviceComponent.SubSubComponent",
             "superComponent")),
    )
コード例 #25
0
class HPEVADeviceOS(OperatingSystem):

    # Define new relationships
    _relations = Software._relations + (
        ("interfaces", ToManyCont(ToOne,
            "Products.ZenModel.IpInterface", "os")),
        ("routes", ToManyCont(ToOne, "Products.ZenModel.IpRouteEntry", "os")),
        ("ipservices", ToManyCont(ToOne, "Products.ZenModel.IpService", "os")),
        ("winservices", ToManyCont(ToOne,
            "Products.ZenModel.WinService", "os")),
        ("processes", ToManyCont(ToOne, "Products.ZenModel.OSProcess", "os")),
        ("filesystems", ToManyCont(ToOne,
            "Products.ZenModel.FileSystem", "os")),
        ("software", ToManyCont(ToOne, "Products.ZenModel.Software", "os")),
        ("storagepools", ToManyCont(ToOne,
            "ZenPacks.community.HPEVAMon.HPEVAStoragePool", "os")),
        ("virtualdisks", ToManyCont(ToOne,
            "ZenPacks.community.HPEVAMon.HPEVAStorageVolume", "os")),
        ("drgroups", ToManyCont(ToOne,
            "ZenPacks.community.HPEVAMon.HPEVAConsistencySet", "os")),
    )


    factory_type_information = (
        {
            'id'             : 'Device',
            'meta_type'      : 'Device',
            'description'    : """Base class for all devices""",
            'icon'           : 'Device_icon.gif',
            'product'        : 'ZenModel',
            'factory'        : 'manage_addDevice',
            'immediate_view' : 'hpevaDeviceOsDetail',
            'actions'        : ()
         },
        )


    def __init__(self):
        id = "os"
        Software.__init__(self, id)
        self._delObject("os")   # OperatingSystem is a software 
コード例 #26
0
class KyoceraPrinterDevice(Device):

    meta_type = portal_type = 'KyoceraPrinterDevice'

    _relations = Device._relations + ((
        'printer_elements',
        ToManyCont(
            ToOne,
            'ZenPacks.andinod.KyoceraPrinter.TonerContainer',
            'toner_container',
        ),
    ), )

    _relations += ((
        'printer_covers',
        ToManyCont(
            ToOne,
            'ZenPacks.andinod.KyoceraPrinter.PrinterCover',
            'cover_printer',
        ),
    ), )
コード例 #27
0
class StorageDomain(BaseComponent):
    meta_type = portal_type = "oVirtStorageDomain"

    storagedomain_type = None
    storage_type = None
    storage_format = None
    status = None

    _properties = BaseComponent._properties + (
        {'id': 'storagedomain_type', 'type': 'string', 'mode': 'w'},
        {'id': 'storage_type', 'type': 'string', 'mode': 'w'},
        {'id': 'storage_format', 'type': 'string', 'mode': 'w'},
        {'id': 'status', 'type': 'string', 'mode': 'w'},
        )

    _relations = BaseComponent._relations + (
       ('system', ToOne(ToManyCont,
             'ZenPacks.zenoss.oVirt.System.System',
             'storagedomains')
              ),

       ('disks', ToManyCont(ToOne,
             'ZenPacks.zenoss.oVirt.VmDisk.VmDisk',
             'storagedomains')
              ),

       ('datacenters', ToMany(ToMany,
             'ZenPacks.zenoss.oVirt.DataCenter.DataCenter',
             'storagedomains')
              ),
        )

    def device(self):
        return self.system()

    def setDatacenterId(self, ids):
        new_ids = set(ids)
        current_ids = set(x.id for x in self.datacenters())

        for id_ in new_ids.symmetric_difference(current_ids):
            datacenter = self.device().datacenters._getOb(id_)
            if datacenter:
                if id_ in new_ids:
                    self.datacenters.addRelation(datacenter)
                else:
                    self.datacenters.removeRelation(datacenter)
                notify(IndexingEvent(datacenter, 'path', False))

    def getDatacenterId(self):
        return sorted([x.id for x in self.datacenters()])

    def getIconPath(self):
        return icon_for(self.device(), 'storage-domain')
コード例 #28
0
class InfobloxDevice(Device):
    bind_zone_count = None

    _properties = Device._properties + ({
        'id': 'bind_zone_count',
        'type': 'int'
    }, )

    _relations = Device._relations + (
        ('bind_zones',
         ToManyCont(
             ToOne,
             'ZenPacks.community.Infoblox.InfobloxDNS',
             'bind_zone',
         )),
        ('dhcp_networks',
         ToManyCont(
             ToOne,
             'ZenPacks.community.Infoblox.InfobloxDHCP',
             'dhcp_network',
         )),
    )
コード例 #29
0
class Database(DeviceComponent, ManagedEntity, CollectedOrModeledMixin):
    meta_type = portal_type = 'PostgreSQLDatabase'

    dbName = None
    dbOid = None

    # We do more frequent collection of these values, but it's good to have an
    # immediate value to use as soon as the device is added.
    modeled_dbSize = None

    _properties = ManagedEntity._properties + (
        {
            'id': 'dbName',
            'type': 'string',
            'mode': ''
        },
        {
            'id': 'dbOid',
            'type': 'int',
            'mode': ''
        },
        {
            'id': 'modeled_dbSize',
            'type': 'int',
            'mode': ''
        },
    )

    _relations = ManagedEntity._relations + (
        ('server',
         ToOne(ToManyCont, 'Products.ZenModel.Device.Device', 'pgDatabases')),
        ('tables',
         ToManyCont(ToOne, 'ZenPacks.zenoss.PostgreSQL.Table.Table',
                    'database')),
    )

    # Meta-data: Zope object views and actions
    factory_type_information = ({
        'actions': ({
            'id': 'perfConf',
            'name': 'Template',
            'action': 'objTemplates',
            'permissions': (ZEN_CHANGE_DEVICE, ),
        }, ),
    }, )

    # Query for events by id instead of name.
    event_key = "ComponentId"

    def device(self):
        return self.server()
コード例 #30
0
class HBaseRegionServer(HBaseComponent):
    meta_type = portal_type = 'HBaseRegionServer'

    start_code = None
    is_alive = None
    region_name = None
    handler_count = None
    memstore_upper_limit = None
    memstore_lower_limit = None
    logflush_interval = None

    _properties = HBaseComponent._properties + (
        {
            'id': 'start_code',
            'type': 'string'
        },
        {
            'id': 'is_alive',
            'type': 'string'
        },
        {
            'id': 'region_name',
            'type': 'string'
        },
        {
            'id': 'handler_count',
            'type': 'string'
        },
        {
            'id': 'memstore_upper_limit',
            'type': 'string'
        },
        {
            'id': 'memstore_lower_limit',
            'type': 'string'
        },
        {
            'id': 'logflush_interval',
            'type': 'string'
        },
    )

    _relations = HBaseComponent._relations + (
        ('hbase_host',
         ToOne(ToManyCont, 'Products.ZenModel.Device.Device',
               'hbase_servers')),
        ('regions', ToManyCont(ToOne, MODULE_NAME['HBaseHRegion'], 'server')),
    )

    def device(self):
        return self.hbase_host()