Package org.snmp4j.smi

Examples of org.snmp4j.smi.OctetString


  public SnmpAgent()
      throws IOException
  {
    super(new File("snmpAgentBC.cfg"),
          null,
          new CommandProcessor(new OctetString(MPv3.createLocalEngineID())));
    setSysDescr(new OctetString("Cipango-" + Server.getSipVersion()));
    setSysOID(NEXCOM_ENTREPRISE_OID);
    agent = new CommandProcessor(new OctetString(MPv3.createLocalEngineID()));
  }
View Full Code Here


  }
 
  protected void addCommunities(SnmpCommunityMIB communityMIB)
  {
    Variable[] com2sec = new Variable[]
    { new OctetString("public"), // community name
        new OctetString("public"), // security name
        getAgent().getContextEngineID(), // local engine ID
        new OctetString(), // default context name
        new OctetString(), // transport tag
        new Integer32(StorageType.nonVolatile), // storage type
        new Integer32(RowStatus.active) // row status
    };
    MOTableRow row = communityMIB.getSnmpCommunityEntry().createRow(
        new OctetString("public2public").toSubIndex(true), com2sec);
    communityMIB.getSnmpCommunityEntry().addRow(row);
  }
View Full Code Here

  protected void addNotificationTargets(SnmpTargetMIB targetMIB,
      SnmpNotificationMIB notificationMIB)
  {
    targetMIB.addDefaultTDomains();

    notificationMIB.addNotifyEntry(new OctetString("default"),
        new OctetString("notify"),
        SnmpNotificationMIB.SnmpNotifyTypeEnum.trap,
        StorageType.permanent);

    for (int i = 0; i < _trapReceivers.length; i++)
    {
      addTrapHost(_trapReceivers[i]);
    }
   
    targetMIB.addTargetParams(new OctetString("v2c"),
                MessageProcessingModel.MPv2c,
                SecurityModel.SECURITY_MODEL_SNMPv2c,
                new OctetString("public"),
                SecurityLevel.NOAUTH_NOPRIV,
                StorageType.permanent);
  }
View Full Code Here

      if (address.isUdp())
        transportIpAddress = new UdpAddress(address.getInetAddress(), address.getPort());
      else
        transportIpAddress = new TcpAddress(address.getInetAddress(), address.getPort());
 
      snmpTargetMIB.addTargetAddress(new OctetString("notification" + address.getHost()),
          address.getTransportDomain(),
          new OctetString(transportIpAddress.getValue()),
          200, 1,
          new OctetString("notify"),
          new OctetString("v2c"),
          StorageType.permanent);

      Log.info("Add SNMP trap receiver: " + address);
    }
    catch (Exception e)
View Full Code Here

    }
  }

  protected void addUsmUser(USM usm)
  {
     UsmUser user = new UsmUser(new OctetString("SHADES"),
                 AuthSHA.ID,
                 new OctetString("SHADESAuthPassword"),
                 PrivDES.ID,
                 new OctetString("SHADESPrivPassword"));
    usm.addUser(user.getSecurityName(), usm.getLocalEngineID(), user);
    user = new UsmUser(new OctetString("TEST"),
                     AuthSHA.ID,
                     new OctetString("maplesyrup"),
                     PrivDES.ID,
                     new OctetString("maplesyrup"));
    usm.addUser(user.getSecurityName(), usm.getLocalEngineID(), user);
    user = new UsmUser(new OctetString("SHA"),
                     AuthSHA.ID,
                     new OctetString("SHAAuthPassword"),
                     null,
                     null);
    usm.addUser(user.getSecurityName(), usm.getLocalEngineID(), user);
  }
View Full Code Here

  }

  protected void addViews(VacmMIB vacm)
  {
       vacm.addGroup(SecurityModel.SECURITY_MODEL_SNMPv1,
                    new OctetString("public"),
                    new OctetString("v1v2group"),
                    StorageType.nonVolatile);
      vacm.addGroup(SecurityModel.SECURITY_MODEL_SNMPv2c,
                    new OctetString("public"),
                    new OctetString("v1v2group"),
                    StorageType.nonVolatile);
      vacm.addGroup(SecurityModel.SECURITY_MODEL_USM,
                    new OctetString("SHADES"),
                    new OctetString("v3group"),
                    StorageType.nonVolatile);
      vacm.addGroup(SecurityModel.SECURITY_MODEL_USM,
                    new OctetString("TEST"),
                    new OctetString("v3test"),
                    StorageType.nonVolatile);
      vacm.addGroup(SecurityModel.SECURITY_MODEL_USM,
                    new OctetString("SHA"),
                    new OctetString("v3restricted"),
                    StorageType.nonVolatile);

      vacm.addAccess(new OctetString("v1v2group"), new OctetString(),
                     SecurityModel.SECURITY_MODEL_ANY,
                     SecurityLevel.NOAUTH_NOPRIV,
                     MutableVACM.VACM_MATCH_EXACT,
                     new OctetString("fullReadView"),
                     new OctetString("fullWriteView"),
                     new OctetString("fullNotifyView"),
                     StorageType.nonVolatile);
      vacm.addAccess(new OctetString("v3group"), new OctetString(),
                     SecurityModel.SECURITY_MODEL_USM,
                     SecurityLevel.AUTH_PRIV,
                     MutableVACM.VACM_MATCH_EXACT,
                     new OctetString("fullReadView"),
                     new OctetString("fullWriteView"),
                     new OctetString("fullNotifyView"),
                     StorageType.nonVolatile);
      vacm.addAccess(new OctetString("v3restricted"), new OctetString(),
                     SecurityModel.SECURITY_MODEL_USM,
                     SecurityLevel.AUTH_NOPRIV,
                     MutableVACM.VACM_MATCH_EXACT,
                     new OctetString("restrictedReadView"),
                     new OctetString("restrictedWriteView"),
                     new OctetString("restrictedNotifyView"),
                     StorageType.nonVolatile);
      vacm.addAccess(new OctetString("v3test"), new OctetString(),
                     SecurityModel.SECURITY_MODEL_USM,
                     SecurityLevel.AUTH_PRIV,
                     MutableVACM.VACM_MATCH_EXACT,
                     new OctetString("testReadView"),
                     new OctetString("testWriteView"),
                     new OctetString("testNotifyView"),
                     StorageType.nonVolatile);

      vacm.addViewTreeFamily(new OctetString("fullReadView"), new OID("1.3"),
                             new OctetString(), VacmMIB.vacmViewIncluded,
                             StorageType.nonVolatile);
      vacm.addViewTreeFamily(new OctetString("fullWriteView"), new OID("1.3"),
                             new OctetString(), VacmMIB.vacmViewIncluded,
                             StorageType.nonVolatile);
      vacm.addViewTreeFamily(new OctetString("fullNotifyView"), new OID("1.3"),
                             new OctetString(), VacmMIB.vacmViewIncluded,
                             StorageType.nonVolatile);
  }
View Full Code Here

              for (int i=oldReceivers.length;i-->0;)
              {
                  if (oldReceivers[i]!=null)
                  {
                    String key = "notification" + oldReceivers[i].getHost();
                      snmpTargetMIB.removeTargetAddress(new OctetString(key));
                  }
              }
          }
         
          if (_trapReceivers!=null)
View Full Code Here

  protected void createMO(MOFactory moFactory)
  {
    MOAccess readOnly = moFactory.createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_ONLY);
    _scalars.add(moFactory.createScalar(OID_MESSAGES_RECEIVED, readOnly, new Counter32()));
    _scalars.add(moFactory.createScalar(OID_MESSAGES_SENT, readOnly, new Counter32()));
    _scalars.add(moFactory.createScalar(OID_SIP_VERSION, readOnly, new OctetString()));
  }
View Full Code Here

    {
      int event = Integer.parseInt(notification.getType());
      switch (event)
      {
      case Events.START:
         _agent.getNotificationOriginator().notify(new OctetString(), SnmpConstants.coldStart,
                       new VariableBinding[0]);
        break;
      case Events.DEPLOY_FAIL:
 
        break;
      case Events.CALLS_THRESHOLD_READCHED:
         _agent.getNotificationOriginator().notify(new OctetString(), OID_THRESHOLD_SESSIONS,
                        new VariableBinding[0]);
        break;
      default:
        break;
      }
View Full Code Here

                return "0.0";
              }
              OID rowPointer = new OID(JvmManagementMib.oidJvmThreadInstanceEntry);
              rowPointer.append(JvmManagementMib.colJvmThreadInstId);
              String index = Long.toHexString(result.longValue());
              OctetString os = new OctetString();
              os.fromHexString(index);
              rowPointer.append(os.toSubIndex(true));
              return rowPointer.toString();
            }
          }},
          new String[] { "ThreadId" },
          new JMXIndexSupport() {
        public ObjectName mapToRowMBean(Object rowIdentifier) {
          return null;
        }

        public Object getRowIdentifier(Object nativeRowId, int nativeIndex) {
          return nativeRowId;
        }

        public OID mapToIndex(Object rowIdentifier) {
          Long l = (Long)rowIdentifier;
          return OctetString.fromHexString(Long.toHexString(l)).toSubIndex(true);
        }

        public Object mapToRowIdentifier(OID rowIndex) {
          if (rowIndex == null) {
            return null;
          }
          OctetString os = new OctetString();
          os.fromSubIndex(rowIndex, true);
          String hexString = os.toHexString();
          return new Long(Long.parseLong(hexString, 16));
        }
      }));

      ObjectName onameJvmClasses =
View Full Code Here

TOP

Related Classes of org.snmp4j.smi.OctetString

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.