예제 #1
0
 /**
  * <p>Returns RRD definition object which can be used to create new RRD
  * with the same creation parameters but with no data in it.</p>
  * <p/>
  * <p>Example:</p>
  * <p/>
  * <pre>
  * RrdDb rrd1 = new RrdDb("original.rrd");
  * RrdDef def = rrd1.getRrdDef();
  * // fix path
  * def.setPath("empty_copy.rrd");
  * // create new RRD file
  * RrdDb rrd2 = new RrdDb(def);
  * </pre>
  *
  * @return RRD definition.
  */
 public RrdDef getRrdDef()
 {
     lock (sync)
     {
         // set header
         long   startTime = header.getLastUpdateTime();
         long   step      = header.getStep();
         String path      = backend.getPath();
         RrdDef rrdDef    = new RrdDef(path, startTime, step);
         // add Datasources
         foreach (Datasource Datasource in Datasources)
         {
             DsDef dsDef = new DsDef(Datasource.DsName,
                                     Datasource.DsType, Datasource.Heartbeat,
                                     Datasource.MinValue, Datasource.MaxValue);
             rrdDef.addDatasource(dsDef);
         }
         // add archives
         foreach (Archive archive in archives)
         {
             ArcDef arcDef = new ArcDef(archive.getConsolFun(),
                                        archive.getXff(), archive.getSteps(), archive.getRows());
             rrdDef.addArchive(arcDef);
         }
         return(rrdDef);
     }
 }
예제 #2
0
        public long getEstimatedSize()
        {
            int dsCount  = getDsCount();
            int arcCount = getArcCount();
            int rowCount = 0;

            for (int i = 0; i < arcCount; i++)
            {
                rowCount += getRows(i);
            }
            return(RrdDef.calculateSize(dsCount, arcCount, rowCount));
        }
예제 #3
0
 /**
  * Requests a RrdDb reference for the given RRD file definition object.<p>
  * <ul>
  * <li>If the file with the path specified in the RrdDef object is already open,
  * the method blocks until the file is closed.
  * <li>If the file is not already open and the number of already open RRD files is less than
  * {@link #INITIAL_CAPACITY}, a new RRD file will be created and a its RrdDb reference will be returned.
  * If the file is not already open and the number of already open RRD files is equal to
  * {@link #INITIAL_CAPACITY}, the method blocks until some RRD file is closed.
  * </ul>
  *
  * @param rrdDef Definition of the RRD file to be created
  * @return Reference to the newly created RRD file
  * @  Thrown in case of I/O error
  */
 public RrdDb requestRrdDb(RrdDef rrdDef)
 {
     lock (sync)
     {
         String canonicalPath = Util.getCanonicalPath(rrdDef.getPath());
         while (rrdMap.ContainsKey(canonicalPath) || rrdMap.Count >= capacity)
         {
             Thread.Sleep(10);
         }
         RrdDb rrdDb = new RrdDb(rrdDef);
         rrdMap.Add(canonicalPath, new RrdEntry(rrdDb));
         return(rrdDb);
     }
 }
예제 #4
0
        public Header(RrdDb parentDb, RrdDef rrdDef, String initSignature)
        {
            this.parentDb = parentDb;

            signature      = new RrdString(this);               // NOT constant, may be cached
            step           = new RrdLong(this, true);           // constant, may be cached
            dsCount        = new RrdInt(this, true);            // constant, may be cached
            arcCount       = new RrdInt(this, true);            // constant, may be cached
            lastUpdateTime = new RrdLong(this);

            if (rrdDef != null)
            {
                signature.set(initSignature);
                step.set(rrdDef.getStep());
                dsCount.set(rrdDef.getDsCount());
                arcCount.set(rrdDef.getArcCount());
                lastUpdateTime.set(rrdDef.getStartTime());
            }
        }
예제 #5
0
파일: Header.cs 프로젝트: mujing/rrd4net
        public Header(RrdDb parentDb, RrdDef rrdDef, String initSignature)
        {
            this.parentDb = parentDb;

            signature = new RrdString(this);	 		// NOT constant, may be cached
            step = new RrdLong(this, true); 			// constant, may be cached
            dsCount = new RrdInt(this, true); 			// constant, may be cached
            arcCount = new RrdInt(this, true); 			// constant, may be cached
            lastUpdateTime = new RrdLong(this);

            if (rrdDef != null)
            {
                signature.set(initSignature);
                step.set(rrdDef.getStep());
                dsCount.set(rrdDef.getDsCount());
                arcCount.set(rrdDef.getArcCount());
                lastUpdateTime.set(rrdDef.getStartTime());
            }
        }
예제 #6
0
      public RrdDef CreateDatabaseDef()
      {
         long start;
         DateTime startDateTime;
         string startOption = getOptionValue("b", "start", DEFAULT_START);

         try
         {
            if (DateTime.TryParse(startOption, out startDateTime))
               start = Util.getTimestamp(startDateTime);
            else
               start = long.Parse(startOption);
         }
         catch (FormatException ex)
         {
            throw new ApplicationException("Bad date format:[" + startOption + "]." + ex.Message);
         }

         String stepOption = getOptionValue("s", "step", DEFAULT_STEP);
         long step = long.Parse(stepOption);

         String[] words = getRemainingWords();
         if (words.Length < 3) throw new ArgumentException("To few arguments! Use: create name DS:name:heartbeat:min:max [RRAdef]");
         if (words[0] != "create") throw new ArgumentException("Wrong command format! Use: create name DS:name:heartbeat:min:max [RRAdef]");
         RrdDef rrdDef = new RrdDef(words[1], start, step);

         for (int i = 2; i < words.Length; i++)
         {
            if (words[i].StartsWith("DS:"))
               rrdDef.addDatasource(parseDef(words[i]));
            else if (words[i].StartsWith("RRA:"))
               rrdDef.addArchive(parseRra(words[i]));
            else
               throw new ArgumentException("Invalid rrdcreate syntax. Not a DSDef or RRADef  " + words[i] + "\nUse: create name DS:name:heartbeat:min:max [RRAdef]");
         }
         if (rrdDef.getDsCount() == 0)
            throw new ArgumentException("No a Data source defined.\nUse: create name DS:name:heartbeat:min:max [RRAdef]");

         return rrdDef;
      }
예제 #7
0
        /**
         * Constructor used to create new RRD object from the definition object but with a storage
         * (backend) different from default.
         *
         * <p>Rrd4n uses <i>factories</i> to create RRD backend objecs. There are three different
         * backend factories supplied with Rrd4n, and each factory has its unique name:</p>
         * <p/>
         * <ul>
         * <li><b>FILE</b>: backends created from this factory will store RRD data to files by using
         * java.io.* classes and methods
         * <li><b>NIO</b>: backends created from this factory will store RRD data to files by using
         * java.nio.* classes and methods
         * <li><b>MEMORY</b>: backends created from this factory will store RRD data in memory. This might
         * be useful in runtime environments which prohibit disk utilization, or for storing temporary,
         * non-critical data (it gets lost as soon as JVM exits).
         * </ul>
         * <p/>
         * <p>For example, to create RRD in memory, use the following code</p>
         * <pre>
         * RrdBackendFactory factory = RrdBackendFactory.getFactory("MEMORY");
         * RrdDb rrdDb = new RrdDb(rrdDef, factory);
         * rrdDb.close();
         * </pre>
         * <p/>
         * <p>New RRD file structure is specified with an object of class
         * {@link RrdDef <b>RrdDef</b>}. The underlying RRD storage is created as soon
         * as the constructor returns.</p>
         *
         * @param rrdDef  RRD definition object
         * @param factory The factory which will be used to create storage for this RRD
         * @Thrown in case of I/O error
         * @see RrdBackendFactory
         */
        public RrdDb(RrdDef rrdDef, RrdBackendFactory factory)
        {
            if (!rrdDef.hasDatasources())
            {
                throw new ArgumentException("No RRD Datasource specified. At least one is needed.");
            }
            if (!rrdDef.hasArchives())
            {
                throw new ArgumentException("No RRD archive specified. At least one is needed.");
            }

            String path = rrdDef.getPath();

            backend = factory.open(path, false);
            try
            {
                backend.setLength(rrdDef.getEstimatedSize());
                // create header
                header = new Header(this, rrdDef);
                // create Datasources
                DsDef[] dsDefs = rrdDef.getDsDefs();
                Datasources = new Datasource[dsDefs.Length];
                for (int i = 0; i < dsDefs.Length; i++)
                {
                    Datasources[i] = new Datasource(this, dsDefs[i]);
                }
                // create archives
                ArcDef[] arcDefs = rrdDef.getArcDefs();
                archives = new Archive[arcDefs.Length];
                for (int i = 0; i < arcDefs.Length; i++)
                {
                    archives[i] = new Archive(this, arcDefs[i]);
                }
            }
            catch (IOException e)
            {
                backend.close();
                throw;
            }
        }
예제 #8
0
파일: RrdDbPool.cs 프로젝트: mujing/rrd4net
        /**
         * Requests a RrdDb reference for the given RRD file definition object.<p>
         * <ul>
         * <li>If the file with the path specified in the RrdDef object is already open,
         * the method blocks until the file is closed.
         * <li>If the file is not already open and the number of already open RRD files is less than
         * {@link #INITIAL_CAPACITY}, a new RRD file will be created and a its RrdDb reference will be returned.
         * If the file is not already open and the number of already open RRD files is equal to
         * {@link #INITIAL_CAPACITY}, the method blocks until some RRD file is closed.
         * </ul>
         *
         * @param rrdDef Definition of the RRD file to be created
         * @return Reference to the newly created RRD file
         * @  Thrown in case of I/O error
         */
        public RrdDb requestRrdDb(RrdDef rrdDef)
        {

            lock (sync)
            {
                String canonicalPath = Util.getCanonicalPath(rrdDef.getPath());
                while (rrdMap.ContainsKey(canonicalPath) || rrdMap.Count >= capacity)
                {
                    Thread.Sleep(10);
                }
                RrdDb rrdDb = new RrdDb(rrdDef);
                rrdMap.Add(canonicalPath, new RrdEntry(rrdDb));
                return rrdDb;
            }
        }
예제 #9
0
파일: Model.cs 프로젝트: mujing/rrd4net
      public DatabaseData CreateDatabase(RrdDef rrdDef)
      {

         EditingDatabaseData = new DatabaseData();
         EditingDatabaseData.Definition = rrdDef;
         EditingDatabaseData.LastUpdated = rrdDef.getStartDateTime();
         EditingDatabaseData.LastValue = double.NaN;
         EditingDatabaseData.SourceDatabasePath = null;
         DatabaseDirty = true;
         return EditingDatabaseData;
      }
예제 #10
0
 private void DatabaseSelected(RrdDef databaseDefinition)
 {
    //rrdDbForm.SetDatabaseData(model.EditingDatabaseData.Definition, model.DatabaseLastUpdateTime, model.LastValue);
 }
예제 #11
0
파일: MainForm.cs 프로젝트: mujing/rrd4net
      private void LoadTree(RrdDef databaseDefinition)
      {
         rrdDbTreeView.Nodes.Clear();

         var databaseNode = rrdDbTreeView.Nodes.Add("databasenode",Path.GetFileNameWithoutExtension(databaseDefinition.Path));
         var datasources = databaseNode.Nodes.Add(dataSourceNodesName, dataSourceNodesName);
         foreach (var datasource in databaseDefinition.getDsDefs())
         {
            var datasourceNode = datasources.Nodes.Add(datasource.DsName);
            datasourceNode.Tag = datasource;
            foreach (var arcDef in databaseDefinition.getArcDefs())
            {
               string nodeText = string.Format("RRA:{0}:{1}:{2}:{3}", arcDef.getConsolFun().Name,
                                                arcDef.Xff, arcDef.Steps, arcDef.Rows);
               var archiveNode = datasourceNode.Nodes.Add(nodeText);
               archiveNode.Tag = arcDef;
            }
         }
         databaseNode.Nodes.Add(archiveNodesName, archiveNodesName);
      }
예제 #12
0
파일: MainForm.cs 프로젝트: mujing/rrd4net
 public void SetDatabaseData(RrdDef rrdDef, DateTime lastUpdated, double lastValue)
 {
    LoadDatabaseView(rrdDef, lastUpdated, lastValue);
 }
예제 #13
0
파일: MainForm.cs 프로젝트: mujing/rrd4net
 public void SetDatabaseDefinition(RrdDef rrdDef,bool dirty)
 {
    LoadTree(rrdDef);
    Text = string.Format("RrdDb Configuration [{0}{1}]", Path.GetFileNameWithoutExtension(rrdDef.Path), dirty ? "*" : "");
 }
예제 #14
0
파일: MainForm.cs 프로젝트: mujing/rrd4net
      private void LoadDatabaseView(RrdDef rrDef, DateTime lastUpdated, double lastValue)
      {
         dataSourceListView.Columns.Clear();
         dataSourceListView.Columns.Add("Name");
         dataSourceListView.Columns.Add("Value", 200);

         dataSourceListView.Items.Clear();
         if (rrDef == null)
            return;
         ListViewItem lvi = dataSourceListView.Items.Add("Tick");
         lvi.SubItems.Add(rrDef.getStepTimeSpan().ToString());
         lvi = dataSourceListView.Items.Add(dataSourceNodesName);
         lvi.SubItems.Add(rrDef.getDsCount().ToString());
         lvi = dataSourceListView.Items.Add(archiveNodesName);
         lvi.SubItems.Add(rrDef.getArcCount().ToString());
         lvi = dataSourceListView.Items.Add("Estimated size");
         lvi.SubItems.Add(rrDef.getEstimatedSize().ToString());
         if (lastUpdated != DateTime.MinValue)
         {
            lvi = dataSourceListView.Items.Add("Last update time");
            lvi.SubItems.Add(lastUpdated.ToString());
         }
         lvi = dataSourceListView.Items.Add("Last Value");
         lvi.SubItems.Add(lastValue.ToString());
      }
예제 #15
0
        /**
         * Compares the current RrdDef with another. RrdDefs are considered equal if:<p>
         *<ul>
         * <li>RRD steps match
         * <li>all datasources have exactly the same definition in both RrdDef objects (datasource names,
         * types, heartbeat, min and max values must match)
         * <li>all archives have exactly the same definition in both RrdDef objects (archive consolidation
         * functions, X-file factors, step and row counts must match)
         * </ul>
         * @param obj The second RrdDef object
         * @return true if RrdDefs match exactly, false otherwise
         */
        public bool equals(Object obj)
        {
            if (obj == null || (obj.GetType() != typeof(RrdDef)))
            {
                return(false);
            }
            RrdDef rrdDef2 = (RrdDef)obj;

            // check primary RRD step
            if (step != rrdDef2.step)
            {
                return(false);
            }
            // check datasources
            DsDef[] dsDefs = getDsDefs(), dsDefs2 = rrdDef2.getDsDefs();
            if (dsDefs.Length != dsDefs2.Length)
            {
                return(false);
            }
            foreach (DsDef dsDef in dsDefs)
            {
                bool matched = false;
                foreach (DsDef aDsDefs2 in dsDefs2)
                {
                    if (dsDef.exactlyEqual(aDsDefs2))
                    {
                        matched = true;
                        break;
                    }
                }
                // this datasource could not be matched
                if (!matched)
                {
                    return(false);
                }
            }
            // check archives
            ArcDef[] arcDefs = getArcDefs(), arcDefs2 = rrdDef2.getArcDefs();
            if (arcDefs.Length != arcDefs2.Length)
            {
                return(false);
            }
            foreach (ArcDef arcDef in arcDefs)
            {
                bool matched = false;
                foreach (ArcDef anArcDefs2 in arcDefs2)
                {
                    if (arcDef.exactlyEqual(anArcDefs2))
                    {
                        matched = true;
                        break;
                    }
                }
                // this archive could not be matched
                if (!matched)
                {
                    return(false);
                }
            }
            // everything matches
            return(true);
        }
예제 #16
0
파일: Header.cs 프로젝트: mujing/rrd4net
 public Header(RrdDb parentDb, RrdDef rrdDef)
     : this(parentDb, rrdDef, DEFAULT_SIGNATURE)
 {
 }
예제 #17
0
파일: Model.cs 프로젝트: mujing/rrd4net
      public DatabaseData SetDatabaseAsEdit(DatabaseData srcDatabaseData)
      {
         if (!databases.ContainsKey(srcDatabaseData.Definition.Path))
            throw new ApplicationException("Database not open in model");

         // Make a clone of the source database definition and give it a new name
         RrdDb rrdDb = new RrdDb(srcDatabaseData.Definition.Path, true);
         databaseDefinition = rrdDb.getRrdDef();
         rrdDb.close();

         DatabaseData dstDatabaseData = new DatabaseData();
         dstDatabaseData.SourceDatabasePath = srcDatabaseData.Definition.Path;
         dstDatabaseData.Saved = false;
         dstDatabaseData.Definition = databaseDefinition;
         dstDatabaseData.Definition.Path = Path.GetFileNameWithoutExtension(databaseDefinition.Path) + "_";
         dstDatabaseData.LastUpdated = dstDatabaseData.Definition.getStartDateTime();
         dstDatabaseData.LastValue = double.NaN;
         DatabaseDirty = true;
         EditingDatabaseData = dstDatabaseData;
         databases.Add(dstDatabaseData.Definition.Path,dstDatabaseData);
         return dstDatabaseData;
      }
예제 #18
0
 /**
  * <p>Constructor used to create new RRD object from the definition. This RRD object will be backed
  * with a storage (backend) of the default type. Initially, storage type defaults to "NIO"
  * (RRD bytes will be put in a file on the disk). Default storage type can be changed with a static
  * {@link RrdBackendFactory#setDefaultFactory(String)} method call.</p>
  * <p/>
  * <p>New RRD file structure is specified with an object of class
  * {@link RrdDef <b>RrdDef</b>}. The underlying RRD storage is created as soon
  * as the constructor returns.</p>
  * <p/>
  * <p>Typical scenario:</p>
  * <p/>
  * <pre>
  * // create new RRD definition
  * RrdDef def = new RrdDef("test.rrd", 300);
  * def.addDatasource("input", DsType.DT_COUNTER, 600, 0, Double.NaN);
  * def.addDatasource("output", DsType.DT_COUNTER, 600, 0, Double.NaN);
  * def.addArchive(ConsolFun.CF_AVERAGE, 0.5, 1, 600);
  * def.addArchive(ConsolFun.CF_AVERAGE, 0.5, 6, 700);
  * def.addArchive(ConsolFun.CF_AVERAGE, 0.5, 24, 797);
  * def.addArchive(ConsolFun.CF_AVERAGE, 0.5, 288, 775);
  * def.addArchive(ConsolFun.CF_MAX, 0.5, 1, 600);
  * def.addArchive(ConsolFun.CF_MAX, 0.5, 6, 700);
  * def.addArchive(ConsolFun.CF_MAX, 0.5, 24, 797);
  * def.addArchive(ConsolFun.CF_MAX, 0.5, 288, 775);
  * <p/>
  * // RRD definition is now completed, create the database!
  * RrdDb rrd = new RrdDb(def);
  * // new RRD file has been created on your disk
  * </pre>
  *
  * @param rrdDef Object describing the structure of the new RRD file.
  * @Thrown in case of I/O error.
  */
 public RrdDb(RrdDef rrdDef)
     : this(rrdDef, RrdFileBackendFactory.getDefaultFactory())
 {
 }
예제 #19
0
파일: RrdDb.cs 프로젝트: mujing/rrd4net
 /**
  * <p>Constructor used to create new RRD object from the definition. This RRD object will be backed
  * with a storage (backend) of the default type. Initially, storage type defaults to "NIO"
  * (RRD bytes will be put in a file on the disk). Default storage type can be changed with a static
  * {@link RrdBackendFactory#setDefaultFactory(String)} method call.</p>
  * <p/>
  * <p>New RRD file structure is specified with an object of class
  * {@link RrdDef <b>RrdDef</b>}. The underlying RRD storage is created as soon
  * as the constructor returns.</p>
  * <p/>
  * <p>Typical scenario:</p>
  * <p/>
  * <pre>
  * // create new RRD definition
  * RrdDef def = new RrdDef("test.rrd", 300);
  * def.addDatasource("input", DsType.DT_COUNTER, 600, 0, Double.NaN);
  * def.addDatasource("output", DsType.DT_COUNTER, 600, 0, Double.NaN);
  * def.addArchive(ConsolFun.CF_AVERAGE, 0.5, 1, 600);
  * def.addArchive(ConsolFun.CF_AVERAGE, 0.5, 6, 700);
  * def.addArchive(ConsolFun.CF_AVERAGE, 0.5, 24, 797);
  * def.addArchive(ConsolFun.CF_AVERAGE, 0.5, 288, 775);
  * def.addArchive(ConsolFun.CF_MAX, 0.5, 1, 600);
  * def.addArchive(ConsolFun.CF_MAX, 0.5, 6, 700);
  * def.addArchive(ConsolFun.CF_MAX, 0.5, 24, 797);
  * def.addArchive(ConsolFun.CF_MAX, 0.5, 288, 775);
  * <p/>
  * // RRD definition is now completed, create the database!
  * RrdDb rrd = new RrdDb(def);
  * // new RRD file has been created on your disk
  * </pre>
  *
  * @param rrdDef Object describing the structure of the new RRD file.
  * @Thrown in case of I/O error.
  */
 public RrdDb(RrdDef rrdDef)
    : this(rrdDef, RrdFileBackendFactory.getDefaultFactory())
 { }
예제 #20
0
파일: RrdDb.cs 프로젝트: mujing/rrd4net
      /**
       * Constructor used to create new RRD object from the definition object but with a storage
       * (backend) different from default.
       *
       * <p>Rrd4n uses <i>factories</i> to create RRD backend objecs. There are three different
       * backend factories supplied with Rrd4n, and each factory has its unique name:</p>
       * <p/>
       * <ul>
       * <li><b>FILE</b>: backends created from this factory will store RRD data to files by using
       * java.io.* classes and methods
       * <li><b>NIO</b>: backends created from this factory will store RRD data to files by using
       * java.nio.* classes and methods
       * <li><b>MEMORY</b>: backends created from this factory will store RRD data in memory. This might
       * be useful in runtime environments which prohibit disk utilization, or for storing temporary,
       * non-critical data (it gets lost as soon as JVM exits).
       * </ul>
       * <p/>
       * <p>For example, to create RRD in memory, use the following code</p>
       * <pre>
       * RrdBackendFactory factory = RrdBackendFactory.getFactory("MEMORY");
       * RrdDb rrdDb = new RrdDb(rrdDef, factory);
       * rrdDb.close();
       * </pre>
       * <p/>
       * <p>New RRD file structure is specified with an object of class
       * {@link RrdDef <b>RrdDef</b>}. The underlying RRD storage is created as soon
       * as the constructor returns.</p>
       *
       * @param rrdDef  RRD definition object
       * @param factory The factory which will be used to create storage for this RRD
       * @Thrown in case of I/O error
       * @see RrdBackendFactory
       */
      public RrdDb(RrdDef rrdDef, RrdBackendFactory factory)
      {
         if (!rrdDef.hasDatasources())
         {
            throw new ArgumentException("No RRD Datasource specified. At least one is needed.");
         }
         if (!rrdDef.hasArchives())
         {
            throw new ArgumentException("No RRD archive specified. At least one is needed.");
         }

         String path = rrdDef.getPath();
         backend = factory.open(path, false);
         try
         {
            backend.setLength(rrdDef.getEstimatedSize());
            // create header
            header = new Header(this, rrdDef);
            // create Datasources
            DsDef[] dsDefs = rrdDef.getDsDefs();
            Datasources = new Datasource[dsDefs.Length];
            for (int i = 0; i < dsDefs.Length; i++)
            {
               Datasources[i] = new Datasource(this, dsDefs[i]);
            }
            // create archives
            ArcDef[] arcDefs = rrdDef.getArcDefs();
            archives = new Archive[arcDefs.Length];
            for (int i = 0; i < arcDefs.Length; i++)
            {
               archives[i] = new Archive(this, arcDefs[i]);
            }
         }
         catch (IOException e)
         {
            backend.close();
            throw;
         }
      }
예제 #21
0
파일: RrdDb.cs 프로젝트: mujing/rrd4net
 /**
  * <p>Returns RRD definition object which can be used to create new RRD
  * with the same creation parameters but with no data in it.</p>
  * <p/>
  * <p>Example:</p>
  * <p/>
  * <pre>
  * RrdDb rrd1 = new RrdDb("original.rrd");
  * RrdDef def = rrd1.getRrdDef();
  * // fix path
  * def.setPath("empty_copy.rrd");
  * // create new RRD file
  * RrdDb rrd2 = new RrdDb(def);
  * </pre>
  *
  * @return RRD definition.
  */
 public RrdDef getRrdDef()
 {
    lock (sync)
    {
       // set header
       long startTime = header.getLastUpdateTime();
       long step = header.getStep();
       String path = backend.getPath();
       RrdDef rrdDef = new RrdDef(path, startTime, step);
       // add Datasources
       foreach (Datasource Datasource in Datasources)
       {
          DsDef dsDef = new DsDef(Datasource.DsName,
                  Datasource.DsType, Datasource.Heartbeat,
                  Datasource.MinValue, Datasource.MaxValue);
          rrdDef.addDatasource(dsDef);
       }
       // add archives
       foreach (Archive archive in archives)
       {
          ArcDef arcDef = new ArcDef(archive.getConsolFun(),
                  archive.getXff(), archive.getSteps(), archive.getRows());
          rrdDef.addArchive(arcDef);
       }
       return rrdDef;
    }
 }
예제 #22
0
파일: RrdDbForm.cs 프로젝트: mujing/rrd4net
 public void SetDatabaseData(RrdDef rrdDef, DateTime lastUpdated, double lastValue)
 {
 }
예제 #23
0
 public Header(RrdDb parentDb, RrdDef rrdDef)
     : this(parentDb, rrdDef, DEFAULT_SIGNATURE)
 {
 }