Java Code Examples for com.sun.jmx.snmp.SnmpStatusException#noSuchObject()

The following examples show how to use com.sun.jmx.snmp.SnmpStatusException#noSuchObject() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JvmClassLoadingMeta.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return the name of the attribute corresponding to the SNMP variable identified by "id".
 */
public String getAttributeName(long id)
    throws SnmpStatusException {
    switch((int)id) {
        case 4:
            return "JvmClassesVerboseLevel";

        case 3:
            return "JvmClassesUnloadedCount";

        case 2:
            return "JvmClassesTotalLoadedCount";

        case 1:
            return "JvmClassesLoadedCount";

        default:
            break;
    }
    throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
 
Example 2
Source File: JvmOSMeta.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return the name of the attribute corresponding to the SNMP variable identified by "id".
 */
public String getAttributeName(long id)
    throws SnmpStatusException {
    switch((int)id) {
        case 4:
            return "JvmOSProcessorCount";

        case 3:
            return "JvmOSVersion";

        case 2:
            return "JvmOSArch";

        case 1:
            return "JvmOSName";

        default:
            break;
    }
    throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
 
Example 3
Source File: JvmRTLibraryPathEntryMeta.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get the value of a scalar variable
 */
public SnmpValue get(long var, Object data)
    throws SnmpStatusException {
    switch((int)var) {
        case 2:
            return new SnmpString(node.getJvmRTLibraryPathItem());

        case 1:
            throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
        default:
            break;
    }
    throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
 
Example 4
Source File: SnmpRequestTree.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void registerGetException(SnmpVarBind var,
                                 SnmpStatusException exception)
    throws SnmpStatusException {
    // The index in the exception must correspond to
    // the SNMP index ...
    //
    if (version == SnmpDefinitions.snmpVersionOne)
        throw new SnmpStatusException(exception, getVarIndex(var)+1);

    if (var == null)
        throw exception;

    // If we're doing a getnext ==> endOfMibView
    if (getnextflag) {
        var.value = SnmpVarBind.endOfMibView;
        return;
    }

    final int errorCode = mapGetException(exception.getStatus(),
                                          version);

    // Now take care of V2 errorCodes that can be stored
    // in the varbind itself:
    if (errorCode ==
        SnmpStatusException.noSuchObject)
        // noSuchObject => noSuchObject
        var.value= SnmpVarBind.noSuchObject;

    else if (errorCode ==
             SnmpStatusException.noSuchInstance)
        // noSuchInstance => noSuchInstance
        var.value= SnmpVarBind.noSuchInstance;

    else
        throw new SnmpStatusException(errorCode, getVarIndex(var)+1);

}
 
Example 5
Source File: JvmThreadingMeta.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get the value of a scalar variable
 */
public SnmpValue get(long var, Object data)
    throws SnmpStatusException {
    switch((int)var) {
        case 6:
            return new SnmpInt(node.getJvmThreadCpuTimeMonitoring());

        case 5:
            return new SnmpInt(node.getJvmThreadContentionMonitoring());

        case 4:
            return new SnmpCounter64(node.getJvmThreadTotalStartedCount());

        case 3:
            return new SnmpCounter(node.getJvmThreadPeakCount());

        case 2:
            return new SnmpGauge(node.getJvmThreadDaemonCount());

        case 1:
            return new SnmpGauge(node.getJvmThreadCount());

        case 10: {
            throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
            }

        case 7:
            return new SnmpCounter64(node.getJvmThreadPeakCountReset());

        default:
            break;
    }
    throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
 
Example 6
Source File: JvmRTInputArgsEntryMeta.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the name of the attribute corresponding to the SNMP variable identified by "id".
 */
public String getAttributeName(long id)
    throws SnmpStatusException {
    switch((int)id) {
        case 2:
            return "JvmRTInputArgsItem";

        case 1:
            return "JvmRTInputArgsIndex";

        default:
            break;
    }
    throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
 
Example 7
Source File: JvmRTLibraryPathEntryMeta.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the name of the attribute corresponding to the SNMP variable identified by "id".
 */
public String getAttributeName(long id)
    throws SnmpStatusException {
    switch((int)id) {
        case 2:
            return "JvmRTLibraryPathItem";

        case 1:
            return "JvmRTLibraryPathIndex";

        default:
            break;
    }
    throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
 
Example 8
Source File: JvmRTLibraryPathEntryMeta.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get the value of a scalar variable
 */
public SnmpValue get(long var, Object data)
    throws SnmpStatusException {
    switch((int)var) {
        case 2:
            return new SnmpString(node.getJvmRTLibraryPathItem());

        case 1:
            throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
        default:
            break;
    }
    throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
 
Example 9
Source File: JvmRTClassPathEntryMeta.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return the name of the attribute corresponding to the SNMP variable identified by "id".
 */
public String getAttributeName(long id)
    throws SnmpStatusException {
    switch((int)id) {
        case 2:
            return "JvmRTClassPathItem";

        case 1:
            return "JvmRTClassPathIndex";

        default:
            break;
    }
    throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
 
Example 10
Source File: JvmMemMgrPoolRelEntryMeta.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get the value of a scalar variable
 */
public SnmpValue get(long var, Object data)
    throws SnmpStatusException {
    switch((int)var) {
        case 3:
            return new SnmpString(node.getJvmMemMgrRelPoolName());

        case 2:
            return new SnmpString(node.getJvmMemMgrRelManagerName());

        default:
            break;
    }
    throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
 
Example 11
Source File: SnmpRequestTree.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void registerGetException(SnmpVarBind var,
                                 SnmpStatusException exception)
    throws SnmpStatusException {
    // The index in the exception must correspond to
    // the SNMP index ...
    //
    if (version == SnmpDefinitions.snmpVersionOne)
        throw new SnmpStatusException(exception, getVarIndex(var)+1);

    if (var == null)
        throw exception;

    // If we're doing a getnext ==> endOfMibView
    if (getnextflag) {
        var.value = SnmpVarBind.endOfMibView;
        return;
    }

    final int errorCode = mapGetException(exception.getStatus(),
                                          version);

    // Now take care of V2 errorCodes that can be stored
    // in the varbind itself:
    if (errorCode ==
        SnmpStatusException.noSuchObject)
        // noSuchObject => noSuchObject
        var.value= SnmpVarBind.noSuchObject;

    else if (errorCode ==
             SnmpStatusException.noSuchInstance)
        // noSuchInstance => noSuchInstance
        var.value= SnmpVarBind.noSuchInstance;

    else
        throw new SnmpStatusException(errorCode, getVarIndex(var)+1);

}
 
Example 12
Source File: JvmThreadingMeta.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get the value of a scalar variable
 */
public SnmpValue get(long var, Object data)
    throws SnmpStatusException {
    switch((int)var) {
        case 6:
            return new SnmpInt(node.getJvmThreadCpuTimeMonitoring());

        case 5:
            return new SnmpInt(node.getJvmThreadContentionMonitoring());

        case 4:
            return new SnmpCounter64(node.getJvmThreadTotalStartedCount());

        case 3:
            return new SnmpCounter(node.getJvmThreadPeakCount());

        case 2:
            return new SnmpGauge(node.getJvmThreadDaemonCount());

        case 1:
            return new SnmpGauge(node.getJvmThreadCount());

        case 10: {
            throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
            }

        case 7:
            return new SnmpCounter64(node.getJvmThreadPeakCountReset());

        default:
            break;
    }
    throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
 
Example 13
Source File: JvmThreadInstanceEntryMeta.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Return the name of the attribute corresponding to the SNMP variable identified by "id".
 */
public String getAttributeName(long id)
    throws SnmpStatusException {
    switch((int)id) {
        case 9:
            return "JvmThreadInstName";

        case 8:
            return "JvmThreadInstCpuTimeNs";

        case 7:
            return "JvmThreadInstWaitTimeMs";

        case 6:
            return "JvmThreadInstWaitCount";

        case 5:
            return "JvmThreadInstBlockTimeMs";

        case 4:
            return "JvmThreadInstBlockCount";

        case 3:
            return "JvmThreadInstState";

        case 11:
            return "JvmThreadInstLockOwnerPtr";

        case 2:
            return "JvmThreadInstId";

        case 10:
            return "JvmThreadInstLockName";

        case 1:
            return "JvmThreadInstIndex";

        default:
            break;
    }
    throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
 
Example 14
Source File: JvmMemPoolEntryMeta.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Return the name of the attribute corresponding to the SNMP variable identified by "id".
 */
public String getAttributeName(long id)
    throws SnmpStatusException {
    switch((int)id) {
        case 33:
            return "JvmMemPoolCollectMaxSize";

        case 32:
            return "JvmMemPoolCollectCommitted";

        case 31:
            return "JvmMemPoolCollectUsed";

        case 133:
            return "JvmMemPoolCollectThreshdSupport";

        case 132:
            return "JvmMemPoolCollectThreshdCount";

        case 131:
            return "JvmMemPoolCollectThreshold";

        case 13:
            return "JvmMemPoolMaxSize";

        case 12:
            return "JvmMemPoolCommitted";

        case 11:
            return "JvmMemPoolUsed";

        case 10:
            return "JvmMemPoolInitSize";

        case 112:
            return "JvmMemPoolThreshdSupport";

        case 111:
            return "JvmMemPoolThreshdCount";

        case 110:
            return "JvmMemPoolThreshold";

        case 5:
            return "JvmMemPoolPeakReset";

        case 4:
            return "JvmMemPoolState";

        case 3:
            return "JvmMemPoolType";

        case 2:
            return "JvmMemPoolName";

        case 23:
            return "JvmMemPoolPeakMaxSize";

        case 1:
            return "JvmMemPoolIndex";

        case 22:
            return "JvmMemPoolPeakCommitted";

        case 21:
            return "JvmMemPoolPeakUsed";

        default:
            break;
    }
    throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
 
Example 15
Source File: SnmpRequestTree.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static int mapGetException(int errorStatus, int version)
    throws SnmpStatusException {

    final int errorCode = errorStatus;
    if (version == SnmpDefinitions.snmpVersionOne)
        return errorCode;

    int mappedErrorCode = errorCode;

    // Now take care of V2 errorCodes that can be stored
    // in the varbind itself:
    if (errorCode ==
        SnmpStatusException.noSuchObject)
        // noSuchObject => noSuchObject
        mappedErrorCode = errorCode;

    else if (errorCode ==
             SnmpStatusException.noSuchInstance)
        // noSuchInstance => noSuchInstance
        mappedErrorCode = errorCode;

    // Now we're going to try to transform every other
    // global code in either noSuchInstance or noSuchObject,
    // so that the get can return a partial result.
    //
    // Only noSuchInstance or noSuchObject can be stored
    // in the varbind itself.
    //

    // According to RFC 1905: noAccess is emitted when the
    // the access is denied because it is not in the MIB view...
    //
    else if (errorCode ==
             SnmpStatusException.noAccess)
        // noAccess => noSuchInstance
        mappedErrorCode = SnmpStatusException.noSuchInstance;

    // According to RFC 1905: (my interpretation because it is not
    // really clear) The specified variable name exists - but the
    // variable does not exists and cannot be created under the
    // present circumstances (probably because the request specifies
    // another variable/value which is incompatible, or because the
    // value of some other variable in the MIB prevents the creation)
    //
    // Note that this error should never be raised in a GET context
    // but who knows?
    //
    else if (errorCode == SnmpStatusException.snmpRspInconsistentName)
        // inconsistentName => noSuchInstance
        mappedErrorCode = SnmpStatusException.noSuchInstance;

    // All the errors comprised between snmpRspWrongType and
    // snmpRspInconsistentValue concern values: so we're going
    // to assume the OID was correct, and reply with noSuchInstance.
    //
    // Note that this error should never be raised in a GET context
    // but who knows?
    //
    else if ((errorCode >= SnmpStatusException.snmpRspWrongType) &&
             (errorCode <= SnmpStatusException.snmpRspInconsistentValue))
        mappedErrorCode = SnmpStatusException.noSuchInstance;

    // We're going to assume the OID was correct, and reply
    // with noSuchInstance.
    //
    else if (errorCode == SnmpStatusException.readOnly)
        mappedErrorCode = SnmpStatusException.noSuchInstance;

    // For all other errors but genErr, we're going to reply with
    // noSuchObject
    //
    else if (errorCode != SnmpStatusException.snmpRspAuthorizationError &&
             errorCode != SnmpStatusException.snmpRspGenErr)
        mappedErrorCode = SnmpStatusException.noSuchObject;

    // Only genErr will abort the GET and be returned as global
    // error.
    //
    return mappedErrorCode;

}
 
Example 16
Source File: JvmMemoryMeta.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Get the value of a scalar variable
 */
public SnmpValue get(long var, Object data)
    throws SnmpStatusException {
    switch((int)var) {
        case 120: {
            throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
            }

        case 23:
            return new SnmpCounter64(node.getJvmMemoryNonHeapMaxSize());

        case 22:
            return new SnmpCounter64(node.getJvmMemoryNonHeapCommitted());

        case 21:
            return new SnmpCounter64(node.getJvmMemoryNonHeapUsed());

        case 110: {
            throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
            }

        case 20:
            return new SnmpCounter64(node.getJvmMemoryNonHeapInitSize());

        case 13:
            return new SnmpCounter64(node.getJvmMemoryHeapMaxSize());

        case 12:
            return new SnmpCounter64(node.getJvmMemoryHeapCommitted());

        case 3:
            return new SnmpInt(node.getJvmMemoryGCCall());

        case 11:
            return new SnmpCounter64(node.getJvmMemoryHeapUsed());

        case 2:
            return new SnmpInt(node.getJvmMemoryGCVerboseLevel());

        case 101: {
            throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
            }

        case 10:
            return new SnmpCounter64(node.getJvmMemoryHeapInitSize());

        case 1:
            return new SnmpGauge(node.getJvmMemoryPendingFinalCount());

        case 100: {
            throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
            }

        default:
            break;
    }
    throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
 
Example 17
Source File: JvmThreadInstanceEntryMeta.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Get the value of a scalar variable
 */
public SnmpValue get(long var, Object data)
    throws SnmpStatusException {
    switch((int)var) {
        case 9:
            return new SnmpString(node.getJvmThreadInstName());

        case 8:
            return new SnmpCounter64(node.getJvmThreadInstCpuTimeNs());

        case 7:
            return new SnmpCounter64(node.getJvmThreadInstWaitTimeMs());

        case 6:
            return new SnmpCounter64(node.getJvmThreadInstWaitCount());

        case 5:
            return new SnmpCounter64(node.getJvmThreadInstBlockTimeMs());

        case 4:
            return new SnmpCounter64(node.getJvmThreadInstBlockCount());

        case 3:
            return new SnmpString(node.getJvmThreadInstState());

        case 11:
            return new SnmpOid(node.getJvmThreadInstLockOwnerPtr());

        case 2:
            return new SnmpCounter64(node.getJvmThreadInstId());

        case 10:
            return new SnmpString(node.getJvmThreadInstLockName());

        case 1:
            throw new SnmpStatusException(SnmpStatusException.noSuchInstance);
        default:
            break;
    }
    throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
 
Example 18
Source File: JvmThreadInstanceEntryMeta.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Return the name of the attribute corresponding to the SNMP variable identified by "id".
 */
public String getAttributeName(long id)
    throws SnmpStatusException {
    switch((int)id) {
        case 9:
            return "JvmThreadInstName";

        case 8:
            return "JvmThreadInstCpuTimeNs";

        case 7:
            return "JvmThreadInstWaitTimeMs";

        case 6:
            return "JvmThreadInstWaitCount";

        case 5:
            return "JvmThreadInstBlockTimeMs";

        case 4:
            return "JvmThreadInstBlockCount";

        case 3:
            return "JvmThreadInstState";

        case 11:
            return "JvmThreadInstLockOwnerPtr";

        case 2:
            return "JvmThreadInstId";

        case 10:
            return "JvmThreadInstLockName";

        case 1:
            return "JvmThreadInstIndex";

        default:
            break;
    }
    throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
 
Example 19
Source File: SnmpMibNode.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Find the node which handles the leaf that immediately follows the
 * given varbind OID, and register the it in the SnmpRequestTree.
 * This method is a pure internal method. You should never try to call
 * it directly.
 *
 * @param varbind  The varbind to be handled
 *
 * @param oid      The OID array extracted from the varbind
 *
 * @param depth    The depth reached in the OID at this step of the
 *                 processing.
 *
 * @param handlers The Hashtable in which the varbind will be registered
 *                 with its handling node. This hashtable contains
 *                 SnmpRequestTree.Handler items.
 *
 * @return The SnmpOid of the next leaf.
 *
 * @exception SnmpStatusException No handling node was found.
 **/
long[] findNextHandlingNode(SnmpVarBind varbind,
                             long[] oid, int pos, int depth,
                             SnmpRequestTree handlers, AcmChecker checker)
    throws SnmpStatusException {
    throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}
 
Example 20
Source File: SnmpMibNode.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Find the node which handles a varbind, and register it in the
 * SnmpRequestTree. This method is a pure internal method. You should
 * never try to call it directly.
 *
 * @param varbind  The varbind to be handled
 *
 * @param oid      The OID array extracted from the varbind
 *
 * @param depth    The depth reached in the OID at this step of the
 *                 processing.
 *
 * @param handlers The Hashtable in which the varbind will be registered
 *                 with its handling node. This hashtable contains
 *                 <CODE>SnmpRequestTree.Handler</CODE> items.
 *
 * @exception SnmpStatusException No handling node was found.
 **/
void findHandlingNode(SnmpVarBind varbind,
                      long[] oid, int depth,
                      SnmpRequestTree handlers)
    throws SnmpStatusException {
    throw new SnmpStatusException(SnmpStatusException.noSuchObject);
}