提交 a73f2654 编写于 作者: 7 710leo

bugfix: aggr output and alert

上级 22f0aee5
......@@ -393,13 +393,16 @@ func Parse(ymlFile string) error {
}
fmt.Println("config.file:", ymlFile)
Ident, _ = identity.GetIdent()
if err := parseOps(); err != nil {
return err
}
return identity.Parse()
if err := identity.Parse(); err != nil {
return err
}
Ident, _ = identity.GetIdent()
return nil
}
// map["node"]="host1,host2" --> map["node"]=["host1", "host2"]
......
......@@ -410,13 +410,6 @@ func eventCurClaim(c *gin.Context) {
var f claimForm
errors.Dangerous(c.ShouldBind(&f))
eventCur := mustEventCur(f.Id)
can, err := models.UsernameCandoNodeOp(username, "mon_event_write", eventCur.Nid)
errors.Dangerous(err)
if !can {
errors.Bomb(_s("no privilege"))
}
id := f.Id
nodePath := f.NodePath
......@@ -429,9 +422,28 @@ func eventCurClaim(c *gin.Context) {
}
if id != 0 {
eventCur := mustEventCur(id)
can, err := models.UsernameCandoNodeOp(username, "mon_event_write", eventCur.Nid)
errors.Dangerous(err)
if !can {
errors.Bomb(_s("no privilege"))
}
renderMessage(c, models.UpdateClaimantsById(users[0].Id, id))
return
}
node, err := models.NodeGet("path=?", nodePath)
errors.Dangerous(err)
if node == nil {
errors.Bomb(_s("node not found"))
}
can, err := models.UsernameCandoNodeOp(username, "mon_event_write", node.Id)
errors.Dangerous(err)
if !can {
errors.Bomb(_s("no privilege"))
}
renderMessage(c, models.UpdateClaimantsByNodePath(users[0].Id, nodePath))
}
......@@ -5,6 +5,7 @@ import (
"log"
"os"
"os/signal"
"strings"
"github.com/didi/nightingale/v4/src/common/dataobj"
"github.com/didi/nightingale/v4/src/common/stats"
......@@ -95,7 +96,7 @@ func aggrOut2MetricValue(out *dataobj.AggrOut) *dataobj.MetricValue {
Metric: cache.AggrCalcMap.GetMetric(out.Data.Sid),
Timestamp: out.Data.Timestamp / 1000,
Step: out.Data.Step,
Tags: out.Data.GroupTag,
Tags: strings.Replace(out.Data.GroupTag, "||", ",", -1),
ValueUntyped: out.Data.Value,
CounterType: "GAUGE",
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册