Exemplo n.º 1
0
  /** run */
  @Override
  public void run() {
    if (polling()) {
      log().debug("run: polling Selta STED on primary address: " + getIpaddress());

      boolean pollhierarchy = true;
      SnmpValue lastCommit =
          SnmpUtils.get(getAgentConfig(), SnmpObjId.get(SeltaMibCommon.OID_S_lastCommit));
      if (lastCommit != null) {
        String lastCommitString = SeltaUtils.ConvertDateToString(lastCommit.getBytes());
        if (getLastCommit() == null || !getLastCommit().equals(lastCommitString)) {
          log().info("lastCommit changed from " + getLastCommit() + " to " + lastCommitString);
          setLastCommit(lastCommitString);
          storeProperty("nePrimaryIP", getIpaddress().toString());
          createInventory();
          savePropertiesFile("STED properties");
          pollhierarchy = false;
        }
      }

      SnmpValue lastAlarm =
          SnmpUtils.get(getAgentConfig(), SnmpObjId.get(SeltaMibCommon.OID_S_lastAlarm));
      if (lastAlarm != null) {
        String lastAlarmString = SeltaUtils.ConvertDateToString(lastAlarm.getBytes());
        if (getLastAlarm() == null || !getLastAlarm().equals(lastAlarmString)) {
          log().info("lastAlarm changed from " + getLastAlarm() + " to " + lastAlarmString);
          setLastAlarm(lastAlarmString);
          poll(pollhierarchy);
          savePropertiesFile("STED properties");
        }
      }
    } else {
      log().info("not polling: " + getIpaddress());
    }
  }