Skip to content

Commit 4e42205

Browse files
committed
new
1 parent ad22003 commit 4e42205

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

.idea/workspace.xml

Lines changed: 11 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/node.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ package api
22

33
import (
44
"encoding/json"
5-
"fmt"
65
"github.com/prometheus/client_golang/prometheus"
7-
log "github.com/sirupsen/logrus"
86
)
97

108
// 定义desc,调用MustNewConstMetric生产指标并通过channel传递数据
@@ -97,8 +95,7 @@ func (ScrapeNode) Scrape(client *MqClient, ch chan<- prometheus.Metric) error {
9795
var t node
9896
err = json.Unmarshal(data, &t)
9997
if err != nil {
100-
reason := fmt.Sprintf("%v,%v", endpoint, err)
101-
log.Errorf("Unmarshal JSON err:%v", endpoint, reason)
98+
return err
10299
}
103100
// 设定值
104101
for _, v := range t {

api/overview.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ package api
22

33
import (
44
"encoding/json"
5-
"fmt"
65
"github.com/prometheus/client_golang/prometheus"
7-
log "github.com/sirupsen/logrus"
86
)
97

108
// 定义desc,调用MustNewConstMetric生产指标并通过channel传递数据
@@ -81,8 +79,7 @@ func (ScrapeOverview) Scrape(client *MqClient, ch chan<- prometheus.Metric) erro
8179
var t overview
8280
err = json.Unmarshal(data, &t)
8381
if err != nil {
84-
reason := fmt.Sprintf("%v,%v", endpoint, err)
85-
log.Errorf("Unmarshal JSON err:%v", endpoint, reason)
82+
return err
8683
}
8784
// 设定值
8885
ch <- prometheus.MustNewConstMetric(overviewhealth, prometheus.GaugeValue, 1.0, endpoint)

api/queue.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ package api
22

33
import (
44
"encoding/json"
5-
"fmt"
65
"github.com/prometheus/client_golang/prometheus"
7-
log "github.com/sirupsen/logrus"
86
)
97

108
var (
@@ -60,8 +58,7 @@ func (ScrapeQueue) Scrape(client *MqClient, ch chan<- prometheus.Metric) error {
6058
var t queue
6159
err = json.Unmarshal(data, &t)
6260
if err != nil {
63-
reason := fmt.Sprintf("%v,%v", endpoint, err)
64-
log.Errorf("Unmarshal JSON err:%v", endpoint, reason)
61+
return err
6562
}
6663
for _, v := range t {
6764
ch <- prometheus.MustNewConstMetric(queuehealth, prometheus.GaugeValue, 1.0, endpoint)

api/rabbitmq.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ type MqClient struct {
3636

3737
// 赋值MqOpts
3838
func (m *MqOpts) AddFlag() {
39-
flag.StringVar(&m.Url, "mq.url", "http://testmojing.ts/api", "HTTP API address of a mq server or agent. (prefix with https:// to connect over HTTPS)")
40-
flag.StringVar(&m.Username, "mq.user", "user", "mq username")
41-
flag.StringVar(&m.Password, "mq.pwd", "2Jv4v3Qjrx", "mq password")
39+
flag.StringVar(&m.Url, "mq.url", "http://127.0.0.1:15672/api", "HTTP API address of a mq server or agent. (prefix with https:// to connect over HTTPS)")
40+
flag.StringVar(&m.Username, "mq.user", "admin", "mq username")
41+
flag.StringVar(&m.Password, "mq.pwd", "123456", "mq password")
4242
//flag.StringVar(&m.UA, "harbor-ua", "harbor_exporter", "user agent of the harbor http client")
4343
flag.DurationVar(&m.Timeout, "timeout", time.Second*5, "Timeout on HTTP requests to the harbor API.")
4444
//flag.BoolVar(&m.Insecure, "insecure", true, "Disable TLS host verification.")

main.exe

-12.9 MB
Binary file not shown.

rabbitmq_exporter.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ After=network.target
44

55
[Service]
66
Type=simple
7-
ExecStart=/export/rabbitmq_exporter --mq.user=admin --mq.passwd=123456
7+
ExecStart=/export/rabbitmq_exporter --mq.user=admin --mq.pwd=123456
88
Restart=on-failure
99
[Install]
1010
WantedBy=multi-user.target

0 commit comments

Comments
 (0)