Beispiel #1
0
func Test_QueryPage(t *testing.T) {
	m := new(models.MonitorApp)
	params, num, err := m.QueryMonitorAppPage(1, 10)
	if err != nil {
		t.Error(err)
	}
	t.Log(num)
	t.Log(params)
}
Beispiel #2
0
func (c *Collector) start() {
	m := new(models.MonitorApp)
	beego.Info("collector is running")
	apps, _, err := m.QueryMonitorAppPage(0, 10000)
	if err != nil {
		beego.Error(err)
	}
	for _, app := range apps {
		gm.NewLoopGoroutine(strconv.Itoa(app.Id), c.StartInterval, app)
	}
}
Beispiel #3
0
func (this *MonitorAppController) MonitorAppList() {
	this.Data["xsrf_token"] = this.XsrfToken()
	m := new(models.MonitorApp)
	cnt, _ := models.CountObjects(m.Query())
	pager := this.SetPaginator(this.pagesize, cnt)
	apps, num, err := m.QueryMonitorAppPage(pager.Offset(), this.pagesize)
	if err != nil {
		beego.Error(err)
	}
	beego.Info(num)
	beego.Info(apps)
	this.Data["apps"] = apps
	if beego.AppConfig.String("runmode") == "dev" {
		beego.Debug(apps)
	}
	beego.Info(this.Ctx.Request.RequestURI)
	this.View("index")
}