Ejemplo n.º 1
0
class SSeriesMIB(metaclass=MIBMeta, prefix='.1.3.6.1.4.1.6027.3.10.1.2.9'):
    """
    -- .iso.org.dod.internet.private.enterprises
    .force10.f10Mgmt.f10ChassisMib.f10ChassisMibObject
    .chRpmObjects.chRpmUtilTable.chRpmUtilEntry.chRpmCpuUtil5Min
    """
    updater = sys_util_h

    # S-Series CPU utilization in percentage for last 5 seconds
    chStackUnitCpuUtil5sec = MIBEntry('1.2.1', ValueType.GAUGE_32,
                                      sys_util_h.get_cpuutil_5sec)

    # S-Series CPU utilization in percentage for last 1 minute.
    chStackUnitCpuUtil1Min = MIBEntry('1.3.1', ValueType.GAUGE_32,
                                      sys_util_h.get_cpuutil_1min)

    # S-Series CPU utilization in percentage for last 5 minutes.
    chStackUnitCpuUtil5Min = MIBEntry('1.4.1', ValueType.GAUGE_32,
                                      sys_util_h.get_cpuutil_5min)

    # Stack member total memory usage in percentage
    chStackUnitMemUsageUtil = MIBEntry('1.5.1', ValueType.GAUGE_32,
                                       sys_util_h.get_memutil)
Ejemplo n.º 2
0
class InterfacesMIB(metaclass=MIBMeta, prefix='.1.3.6.1.2.1.2'):
    """
    'interfaces' https://tools.ietf.org/html/rfc1213#section-3.5
    """

    if_updater = InterfacesUpdater()

    oidtree_updater = mibs.RedisOidTreeUpdater(prefix_str='1.3.6.1.2.1.2')

    # (subtree, value_type, callable_, *args, handler=None)
    ifNumber = MIBEntry('1', ValueType.INTEGER, if_updater.get_if_number)

    # ifTable ::= { interfaces 2 }
    # ifEntry ::= { ifTable 1 }

    ifIndex = \
        SubtreeMIBEntry('2.1.1', if_updater, ValueType.INTEGER, if_updater.if_index)

    ifDescr = \
        SubtreeMIBEntry('2.1.2', if_updater, ValueType.OCTET_STRING, if_updater.interface_description)

    ifType = \
        SubtreeMIBEntry('2.1.3', if_updater, ValueType.INTEGER, if_updater.get_if_type)

    ifMtu = \
        SubtreeMIBEntry('2.1.4', if_updater, ValueType.INTEGER, if_updater.get_mtu)

    ifSpeed = \
        SubtreeMIBEntry('2.1.5', if_updater, ValueType.GAUGE_32, if_updater.get_speed_bps)

    # FIXME Placeholder.
    ifPhysAddress = \
        SubtreeMIBEntry('2.1.6', if_updater, ValueType.OCTET_STRING, lambda sub_id: '')

    ifAdminStatus = \
        SubtreeMIBEntry('2.1.7', if_updater, ValueType.INTEGER, if_updater.get_admin_status)

    ifOperStatus = \
        SubtreeMIBEntry('2.1.8', if_updater, ValueType.INTEGER, if_updater.get_oper_status)

    # FIXME Placeholder.
    ifLastChange = \
        SubtreeMIBEntry('2.1.9', if_updater, ValueType.TIME_TICKS, lambda sub_id: 0)

    ifInOctets = \
        OverlayAdpaterMIBEntry(
            SubtreeMIBEntry('2.1.10', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(10)),
            OidMIBEntry('2.1.10', ValueType.COUNTER_32, oidtree_updater.get_oidvalue)
        )

    ifInUcastPkts = \
        OverlayAdpaterMIBEntry(
            SubtreeMIBEntry('2.1.11', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(11)),
            OidMIBEntry('2.1.11', ValueType.COUNTER_32, oidtree_updater.get_oidvalue)
        )

    ifInNUcastPkts = \
        OverlayAdpaterMIBEntry(
            SubtreeMIBEntry('2.1.12', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(12)),
            OidMIBEntry('2.1.12', ValueType.COUNTER_32, oidtree_updater.get_oidvalue)
        )

    ifInDiscards = \
        OverlayAdpaterMIBEntry(
            SubtreeMIBEntry('2.1.13', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(13)),
            OidMIBEntry('2.1.13', ValueType.COUNTER_32, oidtree_updater.get_oidvalue)
        )

    ifInErrors = \
        OverlayAdpaterMIBEntry(
            SubtreeMIBEntry('2.1.14', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(14)),
            OidMIBEntry('2.1.14', ValueType.COUNTER_32, oidtree_updater.get_oidvalue)
        )

    ifInUnknownProtos = \
        OverlayAdpaterMIBEntry(
            SubtreeMIBEntry('2.1.15', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(15)),
            OidMIBEntry('2.1.15', ValueType.COUNTER_32, oidtree_updater.get_oidvalue)
        )

    ifOutOctets = \
        OverlayAdpaterMIBEntry(
            SubtreeMIBEntry('2.1.16', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(16)),
            OidMIBEntry('2.1.16', ValueType.COUNTER_32, oidtree_updater.get_oidvalue)
        )

    ifOutUcastPkts = \
        OverlayAdpaterMIBEntry(
            SubtreeMIBEntry('2.1.17', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(17)),
            OidMIBEntry('2.1.17', ValueType.COUNTER_32, oidtree_updater.get_oidvalue)
        )

    ifOutNUcastPkts = \
        OverlayAdpaterMIBEntry(
            SubtreeMIBEntry('2.1.18', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(18)),
            OidMIBEntry('2.1.18', ValueType.COUNTER_32, oidtree_updater.get_oidvalue)
        )

    ifOutDiscards = \
        OverlayAdpaterMIBEntry(
            SubtreeMIBEntry('2.1.19', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(19)),
            OidMIBEntry('2.1.19', ValueType.COUNTER_32, oidtree_updater.get_oidvalue)
        )

    ifOutErrors = \
        OverlayAdpaterMIBEntry(
            SubtreeMIBEntry('2.1.20', if_updater, ValueType.COUNTER_32, if_updater.get_counter,
                           DbTables(20)),
            OidMIBEntry('2.1.20', ValueType.COUNTER_32, oidtree_updater.get_oidvalue)
        )

    ifOutQLen = \
        OverlayAdpaterMIBEntry(
            SubtreeMIBEntry('2.1.21', if_updater, ValueType.GAUGE_32, if_updater.get_counter,
                           DbTables(21)),
            OidMIBEntry('2.1.21', ValueType.GAUGE_32, oidtree_updater.get_oidvalue)
        )

    # FIXME Placeholder
    ifSpecific = \
        SubtreeMIBEntry('2.1.22', if_updater, ValueType.OBJECT_IDENTIFIER, lambda sub_id: ObjectIdentifier.null_oid())
Ejemplo n.º 3
0
class SysNameMIB(metaclass=MIBMeta, prefix='.1.3.6.1.2.1.1.5'):
    updater = sysNameUpdater()

    sysName = MIBEntry('0', ValueType.OCTET_STRING, updater.get_sys_name)