Package org.snmp4j.agent.mo

Examples of org.snmp4j.agent.mo.MOScalar


        setModel(jvmJvmRTLibraryPathEntryModel);

  }

  private void addJvmManagementMibConstraints(DefaultMOServer server) {
    MOScalar scalar = (MOScalar)
        server.getManagedObject(JvmManagementMib.oidJvmThreadContentionMonitoring,
                                null);
    ValueConstraint jvmThreadContentionMonitoringVC = new EnumerationConstraint(
      new int[] { JvmManagementMib.JvmThreadContentionMonitoringEnum.enabled,
                  JvmManagementMib.JvmThreadContentionMonitoringEnum.disabled });
    scalar.addMOValueValidationListener(
        new ValueConstraintValidator(jvmThreadContentionMonitoringVC));
    scalar = (MOScalar)
        server.getManagedObject(JvmManagementMib.oidJvmThreadCpuTimeMonitoring,
                                null);
    ValueConstraint jvmThreadCpuTimeMonitoringVC = new EnumerationConstraint(
      new int[] { JvmManagementMib.JvmThreadContentionMonitoringEnum.enabled,
                  JvmManagementMib.JvmThreadContentionMonitoringEnum.disabled });
    scalar.addMOValueValidationListener(
        new ValueConstraintValidator(jvmThreadCpuTimeMonitoringVC));
  }
View Full Code Here


    this.transportMappings = transportMappings;
    createMOs();
  }

  private void createMOs() {
    snmpEngineID = new MOScalar(new OID("1.3.6.1.6.3.10.2.1.1.0"),
                                MOAccessImpl.ACCESS_READ_ONLY,
                                null) {
      public Variable getValue() {
        return new OctetString(getUSM().getLocalEngineID());
      }
    };
    snmpEngineBoots = new MOScalar(new OID("1.3.6.1.6.3.10.2.1.2.0"),
                                   MOAccessImpl.ACCESS_READ_ONLY,
                                   null) {
      public Variable getValue() {
        return new Integer32(getUSM().getEngineBoots());
      }
    };
    snmpEngineTime = new MOScalar(new OID("1.3.6.1.6.3.10.2.1.3.0"),
                                  MOAccessImpl.ACCESS_READ_ONLY,
                                  null) {
      public Variable getValue() {
        return new Integer32(getUSM().getEngineTime());
      }
    };
    Integer32 maxMsgSize = new Integer32(getMaxMessageSize());
    snmpEngineMaxMessageSize = new MOScalar(new OID("1.3.6.1.6.3.10.2.1.4.0"),
                                            MOAccessImpl.ACCESS_READ_ONLY,
                                            maxMsgSize);
  }
View Full Code Here

   */
  public static MOScalar createMOScalar(final OID oid,
                                        final MOAccess access,
                                        final OctetString value,
                                        final boolean localtime) {
    return new MOScalar(oid, access, value) {
      public int isValueOK(SubRequest sreq) {
        return validateDateAndTime(sreq.getVariableBinding().getVariable());
      }

      public Variable getValue() {
View Full Code Here

    public void setValue(String key, Integer value) throws Exception {
        if (!scalars.containsKey(key)) {
            if (!oidMap.containsKey(key))
                throw new Exception("OID for " + key + " not registered. ");
            OID oid = oidMap.get(key);
            MOScalar mo = MOScalarFactory.createReadOnly(oid, key);
            scalars.put(key, mo);
            registerManagedObject(mo, oid.toString());
        }
        MOScalar mo = scalars.get(key);
        if (mo != null) {
            mo.setValue(new Integer32(value));
        }
    }
View Full Code Here

import org.snmp4j.smi.Variable;

class MOScalarFactory {

    static MOScalar createReadOnly(OID oid, Object value) {
        return new MOScalar(oid, MOAccessImpl.ACCESS_READ_ONLY, getVariable(value));
    }
View Full Code Here

TOP

Related Classes of org.snmp4j.agent.mo.MOScalar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.