func (nc *NodeController) updateEvictionMetric(metric *prometheus.GaugeVec, data *evictionData) { data.slideWindow() zones := data.getZones() for _, z := range zones { metric.WithLabelValues(z).Set(float64(data.countEvictions(z))) } }
func process(node *types.Container, credential *types.Credential, gauge *prometheus.GaugeVec) error { var err error //logit.Info.Println("dbsize node=" + node.Name + " credentials Username:"******" Password:"******" Database:" + credential.Database + " Host:" + credential.Host) var db *sql.DB db, err = util.GetMonitoringConnection(credential.Host, credential.Username, credential.Port, credential.Database, credential.Password) defer db.Close() if err != nil { logit.Error.Println("error in getting connectionto " + credential.Host) return err } var metrics []DBMetric //logit.Info.Println("dbsize running pg2 on " + node.Name) metrics, err = pg2(db) //write metrcs to prometheus i := 0 for i = range metrics { //logit.Info.Println("dbsize setting dbsize metric") gauge.WithLabelValues(node.Name, metrics[i].Name).Set(metrics[i].Value) i++ } return nil }