Exemple #1
0
func AddHost(serie *influxClient.Series) *influxClient.Series {
	serie.Columns = append(serie.Columns, "host")

	for i := 0; i < len(serie.Points); i++ {
		serie.Points[i] = append(serie.Points[i], hostname)
	}
	return serie
}
func fillPoints(serie *influxClient.Series, pts *[][]interface{}, sizeX int, sizeY int) {
	for i := 0; i < sizeX; i++ {
		if len(serie.Columns) <= i {
			serie.Columns = append(serie.Columns, fmt.Sprintf("col%d", i))
			serie.Points = append(serie.Points, []interface{}{})
		}
		*pts = append(*pts, []interface{}{})

		for j := 0; j < sizeY; j++ {
			tmp := rand.Int()
			(*pts)[i] = append((*pts)[i], tmp)
			if len(serie.Points[i]) <= j {
				serie.Points[i] = append(serie.Points[i], tmp)
			} else {
				serie.Points[i][j] = tmp
			}
		}
	}
}