Package org.snmp4j.smi

Examples of org.snmp4j.smi.Variable


            continue;
          }

          // Check the OID
          OID oid = provider.getOID(itemName);
          Variable variable = pdu.getVariable(oid);
          if (variable != null) {
            Class<? extends Item> itemType = provider.getItemType(itemName);

            // Do any transformations
            String value = variable.toString();
            try {
              value = provider.doTransformation(itemName, value);
            } catch (TransformationException e) {
              logger.error("Transformation error with item {}: {}", itemName, e);
            }

            // Change to a state
            State state = null;
            if (itemType.isAssignableFrom(StringItem.class)) {
              state = StringType.valueOf(value);
            } else if (itemType.isAssignableFrom(NumberItem.class)) {
              state = DecimalType.valueOf(value);
            } else if (itemType.isAssignableFrom(SwitchItem.class)) {
              state = OnOffType.valueOf(value);
            }

            if (state != null) {
              eventPublisher.postUpdate(itemName, state);
            } else {
              logger.debug(
                  "'{}' couldn't be parsed to a State. Valid State-Types are String and Number",
                  variable.toString());
            }
          } else {
            logger.trace("PDU doesn't contain a variable with OID ‘{}‘", oid.toString());
          }
        }
View Full Code Here


      target.setAddress(providerCmd.getAddress(itemName, command));
      target.setRetries(retries);
      target.setTimeout(timeout);
      target.setVersion(SnmpConstants.version1);

    Variable var = providerCmd.getValue(itemName, command);
    OID oid = providerCmd.getOID(itemName, command);
      VariableBinding varBind = new VariableBinding(oid,var);

    // Create the PDU
    PDU pdu = new PDU();
View Full Code Here

TOP

Related Classes of org.snmp4j.smi.Variable

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.