1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- package http
- import (
- "go-common/app/admin/main/aegis/model/monitor"
- "go-common/library/ecode"
- "go-common/library/log"
- bm "go-common/library/net/http/blademaster"
- "strconv"
- )
- func monitorRuleResult(c *bm.Context) {
- var (
- err error
- bidStr string
- bid int64
- res []*monitor.RuleResultData
- )
- bidStr = c.Request.Form.Get("bid")
- if bid, err = strconv.ParseInt(bidStr, 10, 64); err != nil {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- if bid == 0 {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- if res, err = srv.MonitorBuzResult(c, bid); err != nil {
- log.Error("srv.MonitorResult(%d) error(%v)", bid, err)
- c.JSON(nil, ecode.RequestErr)
- return
- }
- c.JSON(res, nil)
- }
- func monitorResultOids(c *bm.Context) {
- var (
- err error
- idStr string
- id int64
- res []struct {
- OID int64 `json:"oid"`
- Time int `json:"time"`
- }
- oidMap map[int64]int
- )
- idStr = c.Request.Form.Get("id")
- if id, err = strconv.ParseInt(idStr, 10, 64); err != nil {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- if id == 0 {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- if oidMap, err = srv.MonitorResultOids(c, id); err != nil {
- log.Error("srv.MonitorResultOids(%d) error(%v)", id, err)
- c.JSON(nil, ecode.RequestErr)
- return
- }
- for k, v := range oidMap {
- res = append(res, struct {
- OID int64 `json:"oid"`
- Time int `json:"time"`
- }{OID: k, Time: v})
- }
- c.JSON(res, nil)
- }
- func monitorRuleUpdate(c *bm.Context) {
- }
|