Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

配置了ignore_file但并没有真正忽略掉这些metrics #42

Open
ghost opened this issue Nov 5, 2018 · 2 comments
Open

配置了ignore_file但并没有真正忽略掉这些metrics #42

ghost opened this issue Nov 5, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented Nov 5, 2018

由于mysql监控项太多了,想忽略些监控项,因此配置了ignore_file,但是虽然配置了ignore_file,发现还是有大量的忽略监控项上报,且监控项前面还多了"_",并没有真正忽略掉这些metrics。

@sylzd
Copy link
Contributor

sylzd commented Nov 6, 2018

咱们的ignore功能,是用来屏蔽之前zaifalcon中设好的报警项,更改名称之后,原有的报警策略不再生效。由于falcon中的屏蔽策略,只能屏蔽endpoint级别,所以在mymon中的ignore功能是帮助提高了报警屏蔽粒度,而非忽略该metric的上报。文档中没有描述清楚,实在抱歉!马上提交相关文档的pr~

sylzd added a commit to sylzd/mymon that referenced this issue Nov 6, 2018
@DonnieBwin
Copy link

由于mysql监控项太多了,想忽略些监控项,因此配置了ignore_file,但是虽然配置了ignore_file,发现还是有大量的忽略监控项上报,且监控项前面还多了"_",并没有真正忽略掉这些metrics。
将senddata.go 中的senddata替换成下列,过滤一下即可
var Filter_data []*MetaData

// SendData Post the json of all result to falcon-agent
func SendData(conf *common.Config, data []*MetaData) ([]byte, error) {
data = filterIgnoreData(conf, data)
for , eachData := range data {
eachdata := eachData
if strings.HasPrefix(eachdata.Metric, "
") {
continue
} else {
Filter_data = append(Filter_data, eachdata)
}
}
js, err := json.Marshal(Filter_data)
if err != nil {
Log.Debug("parse json data error: %+v", err)
return nil, err
}
Log.Info("Send to %s, size: %d", conf.Base.FalconClient, len(data))
for _, m := range data {
Log.Info("%v", m)
}

    res, err := http.Post(conf.Base.FalconClient, "Content-Type: application/json", bytes.NewBuffer(js))
    if err != nil {
            Log.Debug("send data to falcon-agent error: %+v", err)
            return nil, err
    }

    defer func() { _ = res.Body.Close() }()
    return ioutil.ReadAll(res.Body)

}

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants