Ejemplo n.º 1
0
  /* (non-Javadoc)
   * @see org.opennms.netmgt.collectd.ServiceCollector#initialize(java.util.Map)
   */
  @Override
  public void initialize(Map<String, String> parameters) throws CollectionInitializationException {
    LOG.debug("initialize: initializing TCA collector");

    // Initialize SNMP Factory
    try {
      SnmpPeerFactory.init();
    } catch (IOException e) {
      LOG.error("initSnmpPeerFactory: Failed to load SNMP configuration: {}", e, e);
      throw new UndeclaredThrowableException(e);
    }

    // Retrieve the DAO for our configuration file.
    if (m_configDao == null)
      m_configDao =
          BeanUtils.getBean(
              "daoContext", "tcaDataCollectionConfigDao", TcaDataCollectionConfigDao.class);

    // If the RRD file repository directory does NOT already exist, create it.
    LOG.debug("initialize: Initializing RRD repo from XmlCollector...");
    File f = new File(m_configDao.getConfig().getRrdRepository());
    if (!f.isDirectory()) {
      if (!f.mkdirs()) {
        throw new CollectionInitializationException(
            "Unable to create RRD file repository.  Path doesn't already exist and could not make directory: "
                + m_configDao.getConfig().getRrdRepository());
      }
    }
  }
Ejemplo n.º 2
0
 /* (non-Javadoc)
  * @see org.opennms.netmgt.collectd.ServiceCollector#getRrdRepository(java.lang.String)
  */
 @Override
 public RrdRepository getRrdRepository(String collectionName) {
   return m_configDao.getConfig().buildRrdRepository(collectionName);
 }