public void SetDatabaseDefinition(string command)
        {
            RrdDbParser parser = new RrdDbParser(command);
            RrdDef      rrdDef = parser.CreateDatabaseDef();

            if (model.DatabaseExist(rrdDef.Path))
            {
                throw new ApplicationException("Datbase " + rrdDef.Path + " already exist!");
            }
            model.CreateDatabase(rrdDef);
        }
示例#2
0
        static RrdDb BuildRRd(string filePath, DateTime startTime)
        {
            //rrdtool create net_test.rrd --start 920804400 DS:speed:COUNTER:600:U:U RRA:AVERAGE:0.5:1:24 RRA:AVERAGE:0.5:6:10

            RrdDef rrdDef;// = new RrdDef(filePath, startTime, 300);
            //rrdDef.addDatasource("speed", new DsType(DsType.DsTypes.COUNTER), 600, Double.NaN, Double.NaN);
            //rrdDef.addArchive(new ConsolFun(ConsolFun.ConsolFunTypes.AVERAGE), 0.5, 1, 24);
            //rrdDef.addArchive(new ConsolFun(ConsolFun.ConsolFunTypes.AVERAGE), 0.5, 6, 10);
            //Console.WriteLine(rrdDef.dump());
            DateTime    startDateTime = rrd4n.Common.Util.getDate(920804400);
            RrdDbParser parser        = new RrdDbParser("net_test.rrd --start \"" + startDateTime.ToString() + "\" DS:speed:COUNTER:600:U:U RRA:AVERAGE:0,5:1:24 RRA:AVERAGE:0,5:6:10");

            rrdDef = parser.CreateDatabaseDef();
            Console.WriteLine(rrdDef.dump());
            Console.WriteLine("Estimated file size: " + rrdDef.getEstimatedSize());
            return(new RrdDb(rrdDef));
        }