Exemple #1
0
  /**
   * This method schedules a {@link SnmpCollection} for node for each package. Also schedule
   * discovery link on package when not still activated.
   *
   * @param node
   */
  private void scheduleCollectionForNode(final LinkableNode node) {

    for (final SnmpCollection snmpcoll :
        getSnmpCollections(node.getNodeId(), node.getSnmpPrimaryIpAddr(), node.getSysoid())) {
      if (m_activepackages.contains(snmpcoll.getPackageName())) {
        LogUtils.debugf(
            this, "ScheduleCollectionForNode: package active: %s", snmpcoll.getPackageName());
      } else {
        // schedule discovery link
        LogUtils.debugf(
            this,
            "ScheduleCollectionForNode: Scheduling Discovery Link for Active Package: %s",
            snmpcoll.getPackageName());
        final DiscoveryLink discovery = this.getDiscoveryLink(snmpcoll.getPackageName());
        if (discovery.getScheduler() == null) {
          discovery.setScheduler(m_scheduler);
        }
        discovery.schedule();
        m_activepackages.add(snmpcoll.getPackageName());
      }
      if (snmpcoll.getScheduler() == null) {
        snmpcoll.setScheduler(m_scheduler);
      }
      LogUtils.debugf(
          this,
          "ScheduleCollectionForNode: Scheduling SNMP Collection for Package/NodeId: %s/%d/%s",
          snmpcoll.getPackageName(),
          node.getNodeId(),
          snmpcoll.getInfo());
      snmpcoll.schedule();
    }
  }
Exemple #2
0
  public boolean runSingleCollection(final int nodeId) {
    try {
      final LinkableNode node = m_queryMgr.getSnmpNode(nodeId);

      for (final SnmpCollection snmpColl :
          getSnmpCollections(nodeId, node.getSnmpPrimaryIpAddr(), node.getSysoid())) {
        snmpColl.setScheduler(m_scheduler);
        snmpColl.run();

        final DiscoveryLink link = getDiscoveryLink(snmpColl.getPackageName());
        link.setScheduler(m_scheduler);
        link.run();
      }

      return true;
    } catch (final SQLException e) {
      LogUtils.debugf(
          this,
          "runSingleCollection: unable to get linkable node from database with ID %d",
          nodeId);
    }
    return false;
  }