Merge branch 'master' into feature/docker
This commit is contained in:
commit
8709136ec1
|
@ -4,7 +4,7 @@ logger:
|
|||
keepHours: 2
|
||||
identity:
|
||||
specify: ""
|
||||
shell: /usr/sbin/ifconfig `/usr/sbin/route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|head -n 1
|
||||
shell: ifconfig `route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F ':' '{print $NF}'|head -n 1
|
||||
sys:
|
||||
# timeout in ms
|
||||
# interval in second
|
||||
|
|
|
@ -4,4 +4,4 @@ logger:
|
|||
keepHours: 2
|
||||
identity:
|
||||
specify: ""
|
||||
shell: /usr/sbin/ifconfig `/usr/sbin/route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|head -n 1
|
||||
shell: ifconfig `route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F ':' '{print $NF}'|head -n 1
|
||||
|
|
|
@ -14,9 +14,9 @@ redis:
|
|||
|
||||
identity:
|
||||
specify: ""
|
||||
shell: /usr/sbin/ifconfig `/usr/sbin/route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|head -n 1
|
||||
shell: ifconfig `route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F ':' '{print $NF}'|head -n 1
|
||||
|
||||
logger:
|
||||
dir: logs/judge
|
||||
level: WARNING
|
||||
keepHours: 2
|
||||
keepHours: 2
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
n9e-collector
|
|
@ -1 +0,0 @@
|
|||
sshd
|
|
@ -0,0 +1 @@
|
|||
n9e-monapi
|
|
@ -0,0 +1 @@
|
|||
n9e-transfer
|
|
@ -0,0 +1 @@
|
|||
n9e-tsdb
|
|
@ -0,0 +1 @@
|
|||
n9e-index
|
|
@ -0,0 +1 @@
|
|||
n9e-judge
|
|
@ -62,16 +62,16 @@ func Parse(conf string) error {
|
|||
"enable": true,
|
||||
"timeout": 1000,
|
||||
"interval": 10, //采集策略更新时间
|
||||
"portPath": "/home/n9e/etc/port",
|
||||
"procPath": "/home/n9e/etc/proc",
|
||||
"logPath": "/home/n9e/etc/log",
|
||||
"portPath": "./etc/port",
|
||||
"procPath": "./etc/proc",
|
||||
"logPath": "./etc/log",
|
||||
"api": "/api/portal/collects/",
|
||||
})
|
||||
|
||||
viper.SetDefault("sys", map[string]interface{}{
|
||||
"timeout": 1000, //请求超时时间
|
||||
"interval": 10, //基础指标上报周期
|
||||
"plugin": "/home/n9e/plugin",
|
||||
"plugin": "./plugin",
|
||||
})
|
||||
|
||||
err = viper.Unmarshal(&Config)
|
||||
|
|
|
@ -30,8 +30,9 @@ func (t *TagkvIndex) GetTagkv() []*TagPair {
|
|||
t.RLock()
|
||||
defer t.RUnlock()
|
||||
tagkvs := []*TagPair{}
|
||||
var vs []string
|
||||
|
||||
for k, vm := range t.Tagkv {
|
||||
var vs []string
|
||||
for v, _ := range vm {
|
||||
vs = append(vs, v)
|
||||
}
|
||||
|
@ -50,8 +51,8 @@ func (t *TagkvIndex) GetTagkvMap() map[string][]string {
|
|||
defer t.RUnlock()
|
||||
tagkvs := make(map[string][]string)
|
||||
|
||||
var vs []string
|
||||
for k, vm := range t.Tagkv {
|
||||
var vs []string
|
||||
for v, _ := range vm {
|
||||
vs = append(vs, v)
|
||||
}
|
||||
|
|
|
@ -93,9 +93,8 @@ func GetTagPairs(c *gin.Context) {
|
|||
|
||||
resp := []*IndexTagkvResp{}
|
||||
|
||||
tagkvFilter := make(map[string]map[string]struct{})
|
||||
|
||||
for _, metric := range recv.Metrics {
|
||||
tagkvFilter := make(map[string]map[string]struct{})
|
||||
tagkvs := []*cache.TagPair{}
|
||||
|
||||
for _, endpoint := range recv.Endpoints {
|
||||
|
@ -107,6 +106,7 @@ func GetTagPairs(c *gin.Context) {
|
|||
}
|
||||
|
||||
tagkvMap := metricIndex.TagkvMap.GetTagkvMap()
|
||||
|
||||
for tagk, tagvs := range tagkvMap {
|
||||
tagvFilter, exists := tagkvFilter[tagk]
|
||||
if !exists {
|
||||
|
|
|
@ -58,7 +58,7 @@ func consume(event *model.Event) {
|
|||
SetEventStatus(event, model.STATUS_UPGRADE)
|
||||
|
||||
if needNotify {
|
||||
if event.EventType == config.ALERT && NeedCallback(event.Sid) {
|
||||
if NeedCallback(event.Sid) {
|
||||
if err := PushCallbackEvent(event); err != nil {
|
||||
logger.Errorf("push event to callback queue failed, callbackEvent: %+v", event)
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ func consume(event *model.Event) {
|
|||
return
|
||||
}
|
||||
|
||||
if event.EventType == config.ALERT && NeedCallback(event.Sid) {
|
||||
if NeedCallback(event.Sid) {
|
||||
if err := PushCallbackEvent(event); err != nil {
|
||||
logger.Errorf("push event to callback queue failed, callbackEvent: %+v", event)
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ func Config(r *gin.Engine) {
|
|||
sys.GET("/alive-judges", judges)
|
||||
|
||||
sys.POST("/push", PushData)
|
||||
sys.POST("/data", QueryDataForJudge)
|
||||
sys.POST("/data", QueryData)
|
||||
sys.POST("/data/ui", QueryDataForUI)
|
||||
}
|
||||
|
||||
|
|
|
@ -3,12 +3,17 @@ package stats
|
|||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"github.com/didi/nightingale/src/dataobj"
|
||||
"github.com/didi/nightingale/src/toolkits/address"
|
||||
|
||||
"github.com/toolkits/pkg/file"
|
||||
"github.com/toolkits/pkg/logger"
|
||||
"github.com/toolkits/pkg/runner"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -16,8 +21,14 @@ var (
|
|||
)
|
||||
|
||||
func Init(prefix string, addr ...string) {
|
||||
if len(addr) > 0 {
|
||||
if len(addr) > 0 && addr[0] != "" {
|
||||
//如果配置了 addr,使用 addr 参数
|
||||
PushUrl = addr[0]
|
||||
|
||||
} else if file.IsExist(path.Join(runner.Cwd, "etc", "address.yml")) {
|
||||
//address.yml 存在,则使用配置文件的地址
|
||||
port := address.GetHTTPPort("collector")
|
||||
PushUrl = fmt.Sprintf("http://127.0.0.1:%d/api/collector/push", port)
|
||||
}
|
||||
|
||||
Counter = NewCounter(prefix)
|
||||
|
|
Loading…
Reference in New Issue