Skip to content

Commit

Permalink
4.0.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
freedomkk-qfeng committed Aug 16, 2017
1 parent a7b7e86 commit f6f9574
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 10 deletions.
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Changelog #
## 4.0.6.1 ##
#### bug修复 ####
1. 现在当采集异常 Channel 关闭时,应该会正常的抛弃而不会给 transfer 上报一个空的 endpoint 了

## 4.0.6 ##
#### 新功能 ####
1. 增加接口速率的采集
Expand All @@ -23,6 +27,7 @@


## 3.2.1.1 ##
#### 新功能 ####
1. debugmetric 现在支持配置多个 endpoint 和 metric 了
## 3.2.1 ##
#### 新功能 ####
Expand Down
9 changes: 4 additions & 5 deletions cfg.example.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"debug": true,
"lowermetrics": true,
"debug": false,
"debugmetric":{
"endpoints":["vpn-lw"],
"metrics":["AnyconnectSession","ConnectionStat"],
Expand Down Expand Up @@ -39,11 +38,11 @@
"limitCon": 4
},
"switchhosts":{
"enabled":true,
"enabled":false,
"hosts":"./hosts.json"
},
"customMetrics":{
"enabled":true,
"enabled":false,
"template":"./custom.json"
},
"transfer": {
Expand All @@ -53,7 +52,7 @@
"timeout": 1000
},
"http": {
"enabled": true,
"enabled": false,
"listen": ":1989"
}
}
5 changes: 4 additions & 1 deletion funcs/custmetric.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ func CustMetrics() (L []*model.MetricValue) {
}
}
for _, ch := range chs {
custm := <-ch
custm, ok := <-ch
if !ok {
continue
}
for _, custmmetric := range custm.custmMetrics {
if custmmetric.metrictype == "GAUGE" {
L = append(L, GaugeValueIp(time.Now().Unix(), custm.Ip, custmmetric.metric, custmmetric.value, custmmetric.tag))
Expand Down
5 changes: 4 additions & 1 deletion funcs/swcpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ func CpuMetrics() (L []*model.MetricValue) {
}

for _, ch := range chs {
swCpu := <-ch
swCpu, ok := <-ch
if !ok {
continue
}
L = append(L, GaugeValueIp(time.Now().Unix(), swCpu.Ip, "switch.CpuUtilization", swCpu.CpuUtil))
}

Expand Down
5 changes: 4 additions & 1 deletion funcs/swifstat.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ func swIfMetrics() (L []*model.MetricValue) {
}
for i, ch := range chs {
select {
case chIfStat := <-ch:
case chIfStat, ok := <-ch:
if !ok {
continue
}

if chIfStat.PingResult == true && !slice.ContainsString(AliveIp, chIfStat.Ip) {
AliveIp = append(AliveIp, chIfStat.Ip)
Expand Down
5 changes: 4 additions & 1 deletion funcs/swmem.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ func MemMetrics() (L []*model.MetricValue) {
}

for _, ch := range chs {
swMem := <-ch
swMem, ok := <-ch
if !ok {
continue
}
L = append(L, GaugeValueIp(time.Now().Unix(), swMem.Ip, "switch.MemUtilization", swMem.MemUtili))
}

Expand Down
3 changes: 2 additions & 1 deletion g/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import (
// 4.0.2 fix speedpercent bug
// 4.0.4 add lock on map;add limconn for switch snmp request
// 4.0.5 add custom metric,custom host
// 4.0.6.1 fix channal closed bug
const (
VERSION = "4.0.6"
VERSION = "4.0.6.1"
COLLECT_INTERVAL = time.Second
)

0 comments on commit f6f9574

Please sign in to comment.