Esempio n. 1
0
        private static int getMatchingDatasourceIndex(RrdDb rrd1, int dsIndex, RrdDb rrd2)
        {
            String dsName = rrd1.getDatasource(dsIndex).DsName;

            try
            {
                return(rrd2.getDsIndex(dsName));
            }
            catch (ArgumentException e)
            {
                return(-1);
            }
        }
Esempio n. 2
0
 private static int getMatchingDatasourceIndex(RrdDb rrd1, int dsIndex, RrdDb rrd2)
 {
    String dsName = rrd1.getDatasource(dsIndex).DsName;
    try
    {
       return rrd2.getDsIndex(dsName);
    }
    catch (ArgumentException e)
    {
       return -1;
    }
 }
Esempio n. 3
0
      public void UpdateDataSource(DatabaseData srcDatabase, DsDef updatedDsDef, DsDef originalDsDef)
      {
         RrdDb database = null;

         try
         {
            database = new RrdDb(srcDatabase.Definition.Path, false);
            Datasource datasource = database.getDatasource(originalDsDef.getDsName());
            if (datasource == null)
               throw new ArgumentException(updatedDsDef.getDsName() + " datasource don't exist");
            if (datasource.DsName != updatedDsDef.DsName)
               datasource.setDsName(updatedDsDef.getDsName());
            datasource.setDsType(updatedDsDef.getDsType());
            datasource.setHeartbeat(updatedDsDef.getHeartbeat());
            datasource.setMaxValue(updatedDsDef.getMaxValue(), true);
            datasource.setMinValue(updatedDsDef.getMinValue(), true);

         }
         catch (FileNotFoundException ex)
         {
            Logger.Error("Update datasource failed", ex);
            throw new ApplicationException("Can't update datasource until database saved!", ex);
         }
         finally
         {
            if (database != null)
               database.close();
         }
      }