コード例 #1
0
ファイル: snmp.php プロジェクト: ivladdalvi/racktables
function doSNMPmining($object_id, $snmpsetup)
{
    global $objectInfo;
    $objectInfo = spotEntity('object', $object_id);
    $objectInfo['attrs'] = getAttrValues($object_id);
    $endpoints = findAllEndpoints($object_id, $objectInfo['name']);
    if (count($endpoints) == 0) {
        showFuncMessage(__FUNCTION__, 'ERR1');
        // endpoint not found
        return;
    }
    if (count($endpoints) > 1) {
        showFuncMessage(__FUNCTION__, 'ERR2');
        // can't pick an address
        return;
    }
    switch ($objectInfo['objtype_id']) {
        case 7:
            // Router
        // Router
        case 8:
            // Network switch
        // Network switch
        case 965:
            // Wireless
        // Wireless
        case 1503:
            // Network chassis
            $device = new RTSNMPDevice($endpoints[0], $snmpsetup);
            return doGenericSNMPmining($device);
        case 2:
            $device = new APCPowerSwitch($endpoints[0], $snmpsetup);
            return doPDUSNMPmining($device);
    }
}
コード例 #2
0
ファイル: snmp.php プロジェクト: ehironymous/racktables
function doSNMPmining($object_id, $snmpsetup)
{
    $objectInfo = spotEntity('object', $object_id);
    $objectInfo['attrs'] = getAttrValues($object_id);
    $endpoints = findAllEndpoints($object_id, $objectInfo['name']);
    if (count($endpoints) == 0) {
        return showFuncMessage(__FUNCTION__, 'ERR1');
    }
    // endpoint not found
    if (count($endpoints) > 1) {
        return showFuncMessage(__FUNCTION__, 'ERR2');
    }
    // can't pick an address
    switch ($objectInfo['objtype_id']) {
        case 7:
        case 8:
            $device = new RTSNMPDevice($endpoints[0], $snmpsetup);
            return doSwitchSNMPmining($objectInfo, $device);
        case 2:
            $device = new APCPowerSwitch($endpoints[0], $snmpsetup);
            return doPDUSNMPmining($objectInfo, $device);
    }
}