func creat_rrd() {
	// Create
	read_dev()
	c := rrd.NewCreator(dbfile, time.Now(), step)
	for key, _ := range traffic_in_map {

		c.RRA("AVERAGE", 0.5, 1, 600)
		fmt.Println("122")
		c.RRA("AVERAGE", 0.5, 5, 600)
		in_name := key + "_in"
		out_name := key + "_out"
		fmt.Println(in_name)
		c.DS(in_name, "COUNTER", heartbeat, 0, "U")
		c.DS(out_name, "COUNTER", heartbeat, 0, "U")
	}
	// c.RRA("AVERAGE", 0.5, 5, 600)
	// c.RRA("AVERAGE", 0.5, 5, 600)
	// c.DS("p4p1_in", "COUNTER", heartbeat, 0, "U")
	// c.DS("p4p1_out", "COUNTER", heartbeat, 0, "U")

	err := c.Create(true)
	if err != nil {
		fmt.Println(err)
	}
}
Exemple #2
0
func creat_rrd() {
	// Create
	c := rrd.NewCreator(dbfile, time.Now(), step)
	//	for key,_ := range traffic_in_map {
	//		c.RRA("AVERAGE", 0.5, 1, 100)
	//		c.RRA("AVERAGE", 0.5, 5, 100)
	//		in_name := key + "_in"
	//		out_name := key + "_out"
	//		fmt.Println(in_name)
	//		c.DS(in_name,"GAUGE",heartbeat,0,100)
	//		c.DS(out_name,"GAUGE",heartbeat,0,100)
	//	}
	c.RRA("AVERAGE", 0.5, 5, 600)
	c.RRA("AVERAGE", 0.5, 5, 600)

	c.RRA("AVERAGE", 0.5, 5, 600)

	c.DS("p4p1_in", "COUNTER", heartbeat, 0, "U")
	c.DS("p4p1_out", "COUNTER", heartbeat, 0, "U")
	c.DS("cnt", "COUNTER", heartbeat, 0, "U")

	err := c.Create(true)
	if err != nil {
		fmt.Println(err)
	}
}