class LogicalDiskInfo(ComponentInfo):
    implements(interfaces.ILogicalDiskInfo)

    description = ProxyProperty("description")
    diskType = ProxyProperty("diskType")

    @property
    def stripesize(self):
        return convToUnits(self._object.stripesize)

    @property
    def size(self):
        return convToUnits(self._object.size)

    @property
    def status(self):
        if not hasattr(self._object, 'statusString'): return 'Unknown'
        else: return self._object.statusString()
class ClusterDataSourceInfo(RRDDataSourceInfo):
    """
    Pull in proxy values so they can be utilized within the Shell plugin.
    """
    implements(IClusterDataSourceInfo)
    adapts(ClusterDataSource)

    testable = False
    cycletime = ProxyProperty('cycletime')
Пример #3
0
class VMwareDataSourceInfo(RRDDataSourceInfo):
    """ Adapter between IVMwareDataSourceInfo and VMwareDataSource """
    implements(IVMwareDataSourceInfo)
    adapts(VMwareDataSource)

    cycletime = ProxyProperty('cycletime')

    # Doesn't seem to run in the GUI if you activate the test button
    testable = False
Пример #4
0
class FlavorInfo(OpenStackComponentInfo):
    implements(IFlavorInfo)
    adapts(Flavor)

    flavorRAM = ProxyProperty('flavorRAM')
    flavorDisk = ProxyProperty('flavorDisk')

    @property
    def flavorRAMString(self):
        return convToUnits(self._object.flavorRAM, 1024, 'B')

    @property
    def flavorDiskString(self):
        return convToUnits(self._object.flavorDisk, 1024, 'B')

    @property
    def serverCount(self):
        return self._object.servers.countObjects()
Пример #5
0
class MsSqlSrvInstInfo(DBSrvInstInfo):
    implements(interfaces.IMsSqlSrvInstInfo)

    edition = ProxyProperty("edition")
    licenseType = ProxyProperty("licenseType")
    numLicenses = ProxyProperty("numLicenses")
    port = ProxyProperty("port")
    processID = ProxyProperty("processID")
    productVersion = ProxyProperty("productVersion")
    productLevel = ProxyProperty("productLevel")
    dbsiproperties = ProxyProperty("dbsiproperties")
Пример #6
0
class ESXiHostInfo(DeviceInfo):
    implements(interfaces.IESXiHostInfo)

    cpuMhz = ProxyProperty('cpuMhz')
    cpuModel = ProxyProperty('cpuModel')
    numCpuCores = ProxyProperty('numCpuCores')
    numCpuPkgs = ProxyProperty('numCpuPkgs')
    numCpuCoresPerPkgs = ProxyProperty('numCpuCoresPerPkgs')
    numCpuThreads = ProxyProperty('numCpuThreads')
    numNics = ProxyProperty('numNics')
    vmotionState = ProxyProperty('vmotionState')
Пример #7
0
class DriveInfo(ComponentInfo):
    implements(IDriveInfo)

    id = ProxyProperty('id')
    drive_status = ProxyProperty('drive_status')
    error_sequence_number = ProxyProperty('error_sequence_number')
    use = ProxyProperty('use')
    tech_type = ProxyProperty('tech_type')
    capacity = ProxyProperty('capacity')
    enclosure_id = ProxyProperty('enclosure_id')
    slot_id = ProxyProperty('slot_id')
Пример #8
0
class RRDDataSourceInfo(InfoBase):
    implements(templateInterfaces.IRRDDataSourceInfo)
    """
    This is the default Schema/Info for every class that descends from
    RRDDataSource.  Most of the zenpacks descend from this.
    """
    def __init__(self, dataSource):
        self._object = dataSource

    @property
    def id(self):
        return '/'.join(self._object.getPrimaryPath())

    @property
    def source(self):
        return self._object.getDescription()

    @property
    def type(self):
        return self._object.sourcetype

    # severity
    def _setSeverity(self, value):
        try:
            if isinstance(value, str):
                value = severityId(value)
        except ValueError:
            # they entered junk somehow (default to info if invalid)
            value = severityId('info')
        self._object.severity = value

    def _getSeverity(self):
        return self._object.severity

    @property
    def newId(self):
        return self._object.id

    severity = property(_getSeverity, _setSeverity)
    enabled = ProxyProperty('enabled')
    component = ProxyProperty('component')
    eventClass = ProxyProperty('eventClass')
    eventKey = ProxyProperty('eventKey')
Пример #9
0
class PrinterMIBTonerInfo(ComponentInfo):
    implements(interfaces.IPrinterMIBTonerInfo)


    Description = ProxyProperty("prtMarkerSuppliesDescription")
    Color = ProxyProperty("prtMarkerSuppliesColorantValue")
    MaxLevel = ProxyProperty("prtMarkerSuppliesMaxCapacity")
    CurrentLevel = ProxyProperty("prtMarkerSuppliesLevel")
    rgbColorCode = ProxyProperty("rgbColorCode")
    SupplyType = ProxyProperty("prtMarkerSuppliesType")
    SupplyTypeUnit = ProxyProperty("prtMarkerSuppliesSupplyUnit")
    CurrentUsage = ProxyProperty("usagepct")
Пример #10
0
class ApacheMonitorDataSourceInfo(BasicDataSourceInfo):
    implements(IApacheMonitorDataSourceInfo)
    usessh = ProxyProperty('usessh')
    component = ProxyProperty('component')
    eventKey = ProxyProperty('eventKey')
    timeout = ProxyProperty('timeout')
    hostname = ProxyProperty('hostname')
    port = ProxyProperty('port')
    ssl = ProxyProperty('ssl')
    url = ProxyProperty('url')
    ngregex = ProxyProperty('ngregex')
    ngerror = ProxyProperty('ngerror')

    @property
    def testable(self):
        """
        We can NOT test this datsource against a specific device
        """
        return False
Пример #11
0
 def getter(self, data, enum):
     if not enum:
         return ProxyProperty(data)
     else:
         data = getattr(self._object, data, None)
         try:
             data = int(data)
             return Zuul.info(enum[data])
         except Exception:
             return Zuul.info(data)
Пример #12
0
class VmDiskInfo(BaseComponentInfo):
    """VmDisk API (Info) adapter factory."""

    implements(IVmDiskInfo)

    bootable = ProxyProperty('bootable')
    interface = ProxyProperty('interface')
    format = ProxyProperty('format')
    size = ProxyProperty('size')

    @property
    @info
    def storagedomain(self):
        return self._object.storagedomains()

    @property
    @info
    def vm(self):
        return self._object.vm()
Пример #13
0
class DatabaseInfo(ComponentInfo):

    type = ProxyProperty("type")
    contact = ProxyProperty("contact")
    version = ProxyProperty("version")
    activeTime = ProxyProperty("activeTime")

    @property
    def name(self):
        return self._object.dbname

    @property
    @info
    def dbSrvInst(self):
        return self._object.getDBSrvInst()

    @property
    def blockSizeString(self):
        return self._object.blockSizeString()

    @property
    def totalBytesString(self):
        return self._object.totalString()

    @property
    def usedBytesString(self):
        return self._object.usedString()

    @property
    def availBytesString(self):
        return self._object.availString()

    @property
    def capacity(self):
        cap = self._object.capacity()
        if cap != 'Unknown': cap = '%s%%' % cap
        return cap

    @property
    def status(self):
        if not hasattr(self._object, 'statusString'): return 'Unknown'
        else: return self._object.statusString()
Пример #14
0
class ClusterResourceInfo(WinComponentInfo):
    implements(IClusterResourceInfo)
    ownernode = ProxyProperty('ownernode')
    description = ProxyProperty('description')
    ownergroup = ProxyProperty('ownergroup')
    state = ProxyProperty('state')

    @property
    @info
    def servicegroup(self):
        return self._object.clusterservice()

    @property
    @info
    def clusternode(self):
        entity = self._object.ownernodeentity()
        if entity:
            return '<a class="z-entity" href="{}">{}</a>'.format(
                entity.getPrimaryUrlPath(), self._object.ownernode)
        return self._object.ownernode
Пример #15
0
class WBEMDataSourceInfo(RRDDataSourceInfo):
    implements(IWBEMDataSourceInfo)
    adapts(WBEMDataSource)

    testable = False

    cycletime = ProxyProperty('cycletime')

    namespace = ProxyProperty('namespace')
    result_component_key = ProxyProperty('result_component_key')
    result_component_value = ProxyProperty('result_component_value')
    result_timestamp_key = ProxyProperty('result_timestamp_key')

    @property
    def query(self):
        return "\n".join(self._object.query)

    @query.setter
    def query(self, val):
        self._object.query = string_to_lines(val)
Пример #16
0
class DataPointGraphPointInfo(ColorGraphPointInfo):
    """
    Info object for the data point graph point
    """
    implements(graphPointInterfaces.IDataPointGraphPointInfo)
    lineType = ProxyProperty('lineType')
    lineWidth = ProxyProperty('lineWidth')
    stacked = ProxyProperty('stacked')
    format = ProxyProperty('format')
    limit = ProxyProperty('limit')
    rpn = ProxyProperty('rpn')
    dpName = ProxyProperty('dpName')
    cFunc = ProxyProperty('cFunc')
class EventsAMQPDataSourceInfo(AMQPDataSourceInfo):
    '''
    API Info adapter factory for EventsAMQPDataSource.
    '''

    implements(IEventsAMQPDataSourceInfo)
    adapts(EventsAMQPDataSource)

    cycletime = ProxyProperty('cycletime')

    testable = False
Пример #18
0
class GraphInfo(InfoBase):

    def __init__(self, graph):
        self._object = graph

    @property
    def id(self):
        return self._object.getId()

    @property
    def newId(self):
        return self._object.id

    @property
    def graphPoints(self):
        return self._object.getGraphPointNamesString()

    custom = ProxyProperty('custom')
    height = ProxyProperty('height')
    width = ProxyProperty('width')
    units = ProxyProperty('units')
    log = ProxyProperty('log')
    base = ProxyProperty('base')
    miny = ProxyProperty('miny')
    maxy = ProxyProperty('maxy')
    hasSummary = ProxyProperty('hasSummary')
    sequence = ProxyProperty('sequence')

    @property
    def rrdVariables(self):
        """
        Returns a list of RRD variables
        """
        return self._object.getRRDVariables()

    @property
    def fakeGraphCommands(self):
        """
        Used to display the graph commands to the user
        """
        return self._object.getFakeGraphCmds()
Пример #19
0
class NotificationWindowInfo(InfoBase):
    implements(INotificationWindowInfo)

    @property
    def newId(self):
        return self._object.id

    def _getStart(self):
        # is a unix timestamp convert to string
        start = time()
        try:
            start = float(self._object.start)
        except (ValueError, TypeError):
            pass
        dt = datetime.utcfromtimestamp(start)
        # we want the format in mm/dd/yyyy
        return "%.2d/%.2d/%d" % (dt.month, dt.day, dt.year)

    def _setStart(self, value):
        # convert string to unix time stamp
        # expecting the time to always be in the following format
        dt = datetime.strptime(value, "%Y-%m-%dT%H:%M:%S")
        self._object.start = dt.strftime('%s')

    def _getStartTime(self):
        starttime = time()
        try:
            starttime = float(self._object.start)
        except (ValueError, TypeError):
            pass
        dt = datetime.fromtimestamp(starttime)
        return '%.2d:%.2d' % (dt.hour, dt.minute)

    def _setStartTime(self, value):
        pass

    start = property(_getStart, _setStart)
    starttime = property(_getStartTime, _setStartTime)
    enabled = ProxyProperty('enabled')
    repeat = ProxyProperty('repeat')
    duration = ProxyProperty('duration')
Пример #20
0
class IMMMemVpdInfo(ComponentInfo):
    implements(interfaces.IIMMMemVpdInfo)

    memoryVpdIndex = ProxyProperty("memoryVpdIndex")
    memoryVpdDescription = ProxyProperty("memoryVpdDescription")
    memoryVpdPartNumber = ProxyProperty("memoryVpdPartNumber")
    memoryVpdFRUSerialNumber = ProxyProperty("memoryVpdFRUSerialNumber")
    memoryVpdManufactureDate = ProxyProperty("memoryVpdManufactureDate")
    memoryVpdType = ProxyProperty("memoryVpdType")
    memoryVpdSize = ProxyProperty("memoryVpdSize")
Пример #21
0
class VDatastoreInfo(ComponentInfo):
    implements(interfaces.IVDatastoreInfo)

    vdName = ProxyProperty("vdName")
    vdTotal = ProxyProperty("vdTotal")
    vdUsed = ProxyProperty("vdUsed")
    vdFree = ProxyProperty("vdFree")
    vdFilesystem = ProxyProperty("vdFilesystem")
    vdVersion = ProxyProperty("vdVersion")
    vdPath = ProxyProperty("vdPath")
Пример #22
0
class JuniperComponentsInfo(ComponentInfo):
    implements(interfaces.IJuniperComponentsInfo)

    containerIndex = ProxyProperty("containerIndex")
    containerDescr = ProxyProperty("containerDescr")
    containerParentIndex = ProxyProperty("containerParentIndex")
    containerParentDescr = ProxyProperty("containerParentDescr")
    containerType = ProxyProperty("containerType")
    containerLevel = ProxyProperty("containerLevel")
    containerNextLevel = ProxyProperty("containerNextLevel")
Пример #23
0
class JuniperFanInfo(ComponentInfo):
    implements(interfaces.IJuniperFanInfo)

    fanContainerIndex = ProxyProperty("fanContainerIndex")
    fanDescr = ProxyProperty("fanDescr")
    fanType = ProxyProperty("fanType")
    fanSerialNo = ProxyProperty("fanSerialNo")
    fanRevision = ProxyProperty("fanRevision")
    fanChassisId = ProxyProperty("fanChassisId")
    fanState = ProxyProperty("fanState")
Пример #24
0
class NotificationSubscriptionInfo(InfoBase):
    implements(INotificationSubscriptionInfo)

    @property
    def newId(self):
        return self._object.id

    enabled = ProxyProperty('enabled')
    send_clear = ProxyProperty('send_clear')
    send_initial_occurrence = ProxyProperty('send_initial_occurrence')

    delay_seconds = ProxyProperty('delay_seconds')
    repeat_seconds = ProxyProperty('repeat_seconds')

    def _getAction(self):
        try:
            if getUtility(IAction, self._object.action):
                return self._object.action
        except ComponentLookupError, e:
            # Zenpack may have been removed
            return '%s (MISSING)' % self._object.action
Пример #25
0
class MsSqlDatabaseInfo(DatabaseInfo):
    implements(interfaces.IMsSqlDatabaseInfo)

    dbid = ProxyProperty("dbid")
    updateability = ProxyProperty("updateability")
    useraccess = ProxyProperty("useraccess")
    recovery = ProxyProperty("recovery")
    collation = ProxyProperty("collation")
    sqlsortorder = ProxyProperty("sqlsortorder")
    dbproperties = ProxyProperty("dbproperties")
class TemperatureSensorInfo(ComponentInfo):
    implements(ITemperatureSensorInfo)

    port = ProxyProperty('port')

    @property
    @info
    def enclosure(self):
        """Return the Enclosure object because ITemperatureInfo defines this
        property as an Entity."""

        return self._object.enclosure()
Пример #27
0
class BatteryInfo(ComponentInfo):
    implements(IBatteryInfo)

    id = ProxyProperty('id')
    enclosure_ID = ProxyProperty('enclosure_ID')
    battery_status = ProxyProperty('battery_status')
    charging_status = ProxyProperty('charging_status')
    recondition_needed = ProxyProperty('recondition_needed')
    percent_charged = ProxyProperty('percent_charged')
    end_of_life_warning = ProxyProperty('end_of_life_warning')
Пример #28
0
class nrpeComponentInfo(ComponentInfo):
    implements(InrpeComponentInfo)

    title = ProxyProperty("title")
    nrpe_cmd = ProxyProperty("nrpe_cmd")
    nrpe_args = ProxyProperty("nrpe_args")
    nrpe_timeout = ProxyProperty("nrpe_timeout")
    nrpe_min = ProxyProperty("nrpe_min")
    nrpe_max = ProxyProperty("nrpe_max")
    nrpe_type = ProxyProperty("nrpe_type")
Пример #29
0
class HPEVAConsistencySetInfo(ComponentInfo):
    implements(interfaces.IHPEVAConsistencySetInfo)

    participationType = ProxyProperty("participationType")
    writeMode = ProxyProperty("writeMode")
    remoteCellName = ProxyProperty("remoteCellName")
    hostAccessMode = ProxyProperty("hostAccessMode")
    failSafe = ProxyProperty("failSafe")
    suspendMode = ProxyProperty("suspendMode")

    @property
    def name(self):
        return self._object.caption

    @property
    @info
    def storagePool(self):
        return self._object.getStoragePool()

    @property
    def currentPercentLogLevel(self):
        return self._object.getCurrentPercentLogLevel()

    @property
    def logDiskReservedCapacity(self):
        return self._object.getLogDiskReservedCapacity()

    @property
    def status(self):
        if not hasattr(self._object, 'statusString'): return 'Unknown'
        else: return self._object.statusString()
Пример #30
0
class DashboardInfo(InfoBase):
    implements(IDashboardInfo)
    name = ProxyProperty('name')
    owner = ProxyProperty('owner')
    columns = ProxyProperty('columns')
    state = ProxyProperty('state')
    locked = ProxyProperty('locked')
    audit = ProxyProperty('audit')

    @property
    def contextUid(self):
        obj = self._object
        return obj.getContext().primaryAq().getPrimaryId()

    @property
    def contextType(self):
        obj = self._object
        if obj.userSettingManager():
            return "global"
        context = obj.userSetting()
        if isinstance(context, GroupSettings):
            return "user_groups"
        return "current_user"

    @property
    def isUserDashboardOwner(self):
        securityManager = getSecurityManager()
        userId = securityManager.getUser()._login
        if (userId == self.owner):
            return True
        return False