Compare commits

..

3 Commits

Author SHA1 Message Date
ning
cbcd2a0ca1 refactor 2024-05-24 12:13:17 +08:00
ning
3f865e2d19 code refactor 2024-05-22 10:47:37 +08:00
ning
e3ea65d098 code refactor 2024-05-22 10:34:34 +08:00
324 changed files with 86247 additions and 107472 deletions

67
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@@ -0,0 +1,67 @@
name: Bug Report
description: Report a bug encountered while running Nightingale
labels: ["kind/bug"]
body:
- type: markdown
attributes:
value: |
Thanks for taking time to fill out this bug report!
The more detailed the form is filled in, the easier the problem will be solved.
- type: textarea
id: config
attributes:
label: Your config.toml
description: Place config in the toml code section. This will be automatically formatted into toml, so no need for backticks.
render: toml
validations:
required: true
- type: textarea
id: logs
attributes:
label: Relevant logs
description: categraf | telegraf | n9e | prometheus | chrome request/response ...
render: text
validations:
required: true
- type: input
id: system-info
attributes:
label: System info
description: Include nightingale version, operating system, and other relevant details
placeholder: ex. n9e 5.9.2, n9e-fe 5.5.0, categraf 0.1.0, Ubuntu 20.04, Docker 20.10.8
validations:
required: true
- type: textarea
id: reproduce
attributes:
label: Steps to reproduce
description: Describe the steps to reproduce the bug.
value: |
1.
2.
3.
...
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected behavior
description: Describe what you expected to happen when you performed the above steps.
validations:
required: true
- type: textarea
id: actual-behavior
attributes:
label: Actual behavior
description: Describe what actually happened when you performed the above steps.
validations:
required: true
- type: textarea
id: additional-info
attributes:
label: Additional info
description: Include gist of relevant config, logs, etc.
validations:
required: false

View File

@@ -1,33 +0,0 @@
name: Bug Report & Usage Question
description: Reporting a bug or asking a question about how to use Nightingale
labels: []
body:
- type: markdown
attributes:
value: |
The more detailed the form is filled in, the easier the problem will be solved.
提供的信息越详细,问题解决的可能性就越大。另外, 提问之前请先搜索历史 issue (包括 close 的), 以免重复提问。
- type: textarea
id: question
attributes:
label: Question and Steps to reproduce
description: Describe your question and steps to reproduce the bug. 描述问题以及复现步骤
validations:
required: true
- type: textarea
id: logs
attributes:
label: Relevant logs and configurations
description: Relevant logs and configurations. 报错日志([查看方法](https://flashcat.cloud/docs/content/flashcat-monitor/nightingale-v6/faq/how-to-check-logs/))以及各个相关组件的配置信息
render: text
validations:
required: true
- type: textarea
id: system-info
attributes:
label: Version
description: Include nightingale version, operating system, and other relevant details. 请告知夜莺的版本、操作系统的版本、CPU架构等信息
validations:
required: true

View File

@@ -26,8 +26,7 @@ jobs:
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: '~> v1'
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -36,7 +36,7 @@
## 快速开始
- 👉[文档中心](https://flashcat.cloud/docs/) | [下载中心](https://flashcat.cloud/download/nightingale/)
- ❤️[报告 Bug](https://github.com/ccfos/nightingale/issues/new?assignees=&labels=&projects=&template=question.yml)
- ❤️[报告 Bug](https://github.com/ccfos/nightingale/issues/new?assignees=&labels=kind%2Fbug&projects=&template=bug_report.yml)
- ℹ️为了提供更快速的访问体验,上述文档和下载站点托管于 [FlashcatCloud](https://flashcat.cloud)
## 功能特点
@@ -78,17 +78,6 @@
![边缘部署模式](https://download.flashcat.cloud/ulric/20240222102119.png)
## 近期计划
- [ ] 仪表盘:支持内嵌 Grafana
- [ ] 告警规则:通知时支持配置过滤标签,避免告警事件中一堆不重要的标签
- [x] 告警规则:支持配置恢复时的 Promql告警恢复通知也可以带上恢复时的值了
- [ ] 机器管理自定义标签拆分管理agent 自动上报的标签和用户在页面自定义的标签分开管理,对于 agent 自动上报的标签,以 agent 为准,直接覆盖服务端 DB 中的数据
- [ ] 机器管理:机器支持角色字段,即无头标签,用于描述混部场景
- [ ] 机器管理:把业务组的 busigroup 标签迁移到机器的属性里,让机器支持挂到多个业务组
- [ ] 告警规则:增加 Host Metrics 类别,支持按照业务组、角色、标签等筛选机器,规则 promql 支持变量,支持在机器颗粒度配置变量值
- [ ] 告警通知:重构整个通知逻辑,引入事件处理的 pipeline支持对告警事件做自定义处理和灵活分派
## 交流渠道
- 报告Bug优先推荐提交[夜莺GitHub Issue](https://github.com/ccfos/nightingale/issues/new?assignees=&labels=kind%2Fbug&projects=&template=bug_report.yml)
- 推荐完整浏览[夜莺文档站点](https://flashcat.cloud/docs/content/flashcat-monitor/nightingale-v7/introduction/),了解更多信息

View File

@@ -53,7 +53,7 @@ func Initialize(configDir string, cryptoKey string) (func(), error) {
alertStats := astats.NewSyncStats()
configCache := memsto.NewConfigCache(ctx, syncStats, nil, "")
targetCache := memsto.NewTargetCache(ctx, syncStats, redis)
targetCache := memsto.NewTargetCache(ctx, syncStats, nil)
busiGroupCache := memsto.NewBusiGroupCache(ctx, syncStats)
alertMuteCache := memsto.NewAlertMuteCache(ctx, syncStats)
alertRuleCache := memsto.NewAlertRuleCache(ctx, syncStats)
@@ -106,7 +106,7 @@ func Start(alertc aconf.Alert, pushgwc pconf.Pushgw, syncStats *memsto.Stats, al
busiGroupCache, alertMuteCache, datasourceCache, promClients, tdendgineClients, naming, ctx, alertStats)
dp := dispatch.NewDispatch(alertRuleCache, userCache, userGroupCache, alertSubscribeCache, targetCache, notifyConfigCache, taskTplsCache, alertc.Alerting, ctx, alertStats)
consumer := dispatch.NewConsumer(alertc.Alerting, ctx, dp, promClients)
consumer := dispatch.NewConsumer(alertc.Alerting, ctx, dp)
go dp.ReloadTpls()
go consumer.LoopConsume()

View File

@@ -1,19 +1,14 @@
package dispatch
import (
"encoding/json"
"fmt"
"strings"
"time"
"github.com/ccfos/nightingale/v6/alert/aconf"
"github.com/ccfos/nightingale/v6/alert/common"
"github.com/ccfos/nightingale/v6/alert/queue"
"github.com/ccfos/nightingale/v6/models"
"github.com/ccfos/nightingale/v6/pkg/ctx"
"github.com/ccfos/nightingale/v6/pkg/poster"
promsdk "github.com/ccfos/nightingale/v6/pkg/prom"
"github.com/ccfos/nightingale/v6/prom"
"github.com/toolkits/pkg/concurrent/semaphore"
"github.com/toolkits/pkg/logger"
@@ -23,17 +18,15 @@ type Consumer struct {
alerting aconf.Alerting
ctx *ctx.Context
dispatch *Dispatch
promClients *prom.PromClientMap
dispatch *Dispatch
}
// 创建一个 Consumer 实例
func NewConsumer(alerting aconf.Alerting, ctx *ctx.Context, dispatch *Dispatch, promClients *prom.PromClientMap) *Consumer {
func NewConsumer(alerting aconf.Alerting, ctx *ctx.Context, dispatch *Dispatch) *Consumer {
return &Consumer{
alerting: alerting,
ctx: ctx,
dispatch: dispatch,
promClients: promClients,
alerting: alerting,
ctx: ctx,
dispatch: dispatch,
}
}
@@ -80,19 +73,17 @@ func (e *Consumer) consumeOne(event *models.AlertCurEvent) {
event.RuleName = fmt.Sprintf("failed to parse rule name: %v", err)
}
if err := event.ParseRule("rule_note"); err != nil {
logger.Warningf("ruleid:%d failed to parse rule note: %v", event.RuleId, err)
event.RuleNote = fmt.Sprintf("failed to parse rule note: %v", err)
}
if err := event.ParseRule("annotations"); err != nil {
logger.Warningf("ruleid:%d failed to parse annotations: %v", event.RuleId, err)
event.Annotations = fmt.Sprintf("failed to parse annotations: %v", err)
event.AnnotationsJSON["error"] = event.Annotations
}
e.queryRecoveryVal(event)
if err := event.ParseRule("rule_note"); err != nil {
logger.Warningf("ruleid:%d failed to parse rule note: %v", event.RuleId, err)
event.RuleNote = fmt.Sprintf("failed to parse rule note: %v", err)
}
e.persist(event)
if event.IsRecovered && event.NotifyRecovered == 0 {
@@ -124,68 +115,3 @@ func (e *Consumer) persist(event *models.AlertCurEvent) {
e.dispatch.Astats.CounterRuleEvalErrorTotal.WithLabelValues(fmt.Sprintf("%v", event.DatasourceId), "persist_event").Inc()
}
}
func (e *Consumer) queryRecoveryVal(event *models.AlertCurEvent) {
if !event.IsRecovered {
return
}
// If the event is a recovery event, execute the recovery_promql query
promql, ok := event.AnnotationsJSON["recovery_promql"]
if !ok {
return
}
promql = strings.TrimSpace(promql)
if promql == "" {
logger.Warningf("rule_eval:%s promql is blank", getKey(event))
return
}
if e.promClients.IsNil(event.DatasourceId) {
logger.Warningf("rule_eval:%s error reader client is nil", getKey(event))
return
}
readerClient := e.promClients.GetCli(event.DatasourceId)
var warnings promsdk.Warnings
value, warnings, err := readerClient.Query(e.ctx.Ctx, promql, time.Now())
if err != nil {
logger.Errorf("rule_eval:%s promql:%s, error:%v", getKey(event), promql, err)
event.AnnotationsJSON["recovery_promql_error"] = fmt.Sprintf("promql:%s error:%v", promql, err)
b, err := json.Marshal(event.AnnotationsJSON)
if err != nil {
event.AnnotationsJSON = make(map[string]string)
event.AnnotationsJSON["error"] = fmt.Sprintf("failed to parse annotations: %v", err)
} else {
event.Annotations = string(b)
}
return
}
if len(warnings) > 0 {
logger.Errorf("rule_eval:%s promql:%s, warnings:%v", getKey(event), promql, warnings)
}
anomalyPoints := common.ConvertAnomalyPoints(value)
if len(anomalyPoints) == 0 {
logger.Warningf("rule_eval:%s promql:%s, result is empty", getKey(event), promql)
event.AnnotationsJSON["recovery_promql_error"] = fmt.Sprintf("promql:%s error:%s", promql, "result is empty")
} else {
event.AnnotationsJSON["recovery_value"] = fmt.Sprintf("%v", anomalyPoints[0].Value)
}
b, err := json.Marshal(event.AnnotationsJSON)
if err != nil {
event.AnnotationsJSON = make(map[string]string)
event.AnnotationsJSON["error"] = fmt.Sprintf("failed to parse annotations: %v", err)
} else {
event.Annotations = string(b)
}
}
func getKey(event *models.AlertCurEvent) string {
return common.RuleKey(event.DatasourceId, event.RuleId)
}

View File

@@ -4,9 +4,7 @@ import (
"bytes"
"encoding/json"
"html/template"
"net/url"
"strconv"
"strings"
"sync"
"time"
@@ -33,7 +31,6 @@ type Dispatch struct {
alerting aconf.Alerting
Senders map[string]sender.Sender
CallBacks map[string]sender.CallBacker
tpls map[string]*template.Template
ExtraSenders map[string]sender.Sender
BeforeSenderHook func(*models.AlertCurEvent) bool
@@ -102,17 +99,6 @@ func (e *Dispatch) relaodTpls() error {
models.FeishuCard: sender.NewSender(models.FeishuCard, tmpTpls),
}
// domain -> Callback()
callbacks := map[string]sender.CallBacker{
models.DingtalkDomain: sender.NewCallBacker(models.DingtalkDomain, e.targetCache, e.userCache, e.taskTplsCache, tmpTpls),
models.WecomDomain: sender.NewCallBacker(models.WecomDomain, e.targetCache, e.userCache, e.taskTplsCache, tmpTpls),
models.FeishuDomain: sender.NewCallBacker(models.FeishuDomain, e.targetCache, e.userCache, e.taskTplsCache, tmpTpls),
models.TelegramDomain: sender.NewCallBacker(models.TelegramDomain, e.targetCache, e.userCache, e.taskTplsCache, tmpTpls),
models.FeishuCardDomain: sender.NewCallBacker(models.FeishuCardDomain, e.targetCache, e.userCache, e.taskTplsCache, tmpTpls),
models.IbexDomain: sender.NewCallBacker(models.IbexDomain, e.targetCache, e.userCache, e.taskTplsCache, tmpTpls),
models.DefaultDomain: sender.NewCallBacker(models.DefaultDomain, e.targetCache, e.userCache, e.taskTplsCache, tmpTpls),
}
e.RwLock.RLock()
for channelName, extraSender := range e.ExtraSenders {
senders[channelName] = extraSender
@@ -122,7 +108,6 @@ func (e *Dispatch) relaodTpls() error {
e.RwLock.Lock()
e.tpls = tmpTpls
e.Senders = senders
e.CallBacks = callbacks
e.RwLock.Unlock()
return nil
}
@@ -258,7 +243,7 @@ func (e *Dispatch) Send(rule *models.AlertRule, event *models.AlertCurEvent, not
}
// handle event callbacks
e.SendCallbacks(rule, notifyTarget, event)
sender.SendCallbacks(e.ctx, notifyTarget.ToCallbackList(), event, e.targetCache, e.userCache, e.taskTplsCache, e.Astats)
// handle global webhooks
sender.SendWebhooks(notifyTarget.ToWebhookList(), event, e.Astats)
@@ -267,47 +252,6 @@ func (e *Dispatch) Send(rule *models.AlertRule, event *models.AlertCurEvent, not
go sender.MayPluginNotify(e.genNoticeBytes(event), e.notifyConfigCache.GetNotifyScript(), e.Astats)
}
func (e *Dispatch) SendCallbacks(rule *models.AlertRule, notifyTarget *NotifyTarget, event *models.AlertCurEvent) {
uids := notifyTarget.ToUidList()
urls := notifyTarget.ToCallbackList()
for _, urlStr := range urls {
if len(urlStr) == 0 {
continue
}
cbCtx := sender.BuildCallBackContext(e.ctx, urlStr, rule, []*models.AlertCurEvent{event}, uids, e.userCache, e.Astats)
if strings.HasPrefix(urlStr, "${ibex}") {
e.CallBacks[models.IbexDomain].CallBack(cbCtx)
continue
}
if !(strings.HasPrefix(urlStr, "http://") || strings.HasPrefix(urlStr, "https://")) {
cbCtx.CallBackURL = "http://" + urlStr
}
parsedURL, err := url.Parse(urlStr)
if err != nil {
logger.Errorf("SendCallbacks: failed to url.Parse(urlStr=%s): %v", urlStr, err)
continue
}
// process feishu card
if parsedURL.Host == models.FeishuDomain && parsedURL.Query().Get("card") == "1" {
e.CallBacks[models.FeishuCardDomain].CallBack(cbCtx)
continue
}
callBacker, ok := e.CallBacks[parsedURL.Host]
if ok {
callBacker.CallBack(cbCtx)
} else {
e.CallBacks[models.DefaultDomain].CallBack(cbCtx)
}
}
}
type Notice struct {
Event *models.AlertCurEvent `json:"event"`
Tpls map[string]string `json:"tpls"`

View File

@@ -84,14 +84,6 @@ func (s *NotifyTarget) ToWebhookList() []*models.Webhook {
return webhooks
}
func (s *NotifyTarget) ToUidList() []int64 {
uids := make([]int64, len(s.userMap))
for uid, _ := range s.userMap {
uids = append(uids, uid)
}
return uids
}
// Dispatch 抽象由告警事件到信息接收者的路由策略
// rule: 告警规则
// event: 告警事件

View File

@@ -219,6 +219,7 @@ func (arw *AlertRuleWorker) GetPromAnomalyPoint(ruleConfig string) []common.Anom
logger.Errorf("rule_eval:%s promql:%s, warnings:%v", arw.Key(), promql, warnings)
arw.processor.Stats.CounterQueryDataErrorTotal.WithLabelValues(fmt.Sprintf("%d", arw.datasourceId)).Inc()
arw.processor.Stats.CounterRuleEvalErrorTotal.WithLabelValues(fmt.Sprintf("%v", arw.processor.DatasourceId()), QUERY_DATA).Inc()
continue
}
logger.Debugf("rule_eval:%s query:%+v, value:%v", arw.Key(), query, value)
@@ -345,7 +346,7 @@ func (arw *AlertRuleWorker) GetHostAnomalyPoint(ruleConfig string) []common.Anom
missTargets = append(missTargets, ident)
}
}
logger.Debugf("rule_eval:%s missTargets:%v", arw.Key(), missTargets)
targets := arw.processor.TargetCache.Gets(missTargets)
for _, target := range targets {
m := make(map[string]string)
@@ -383,6 +384,7 @@ func (arw *AlertRuleWorker) GetHostAnomalyPoint(ruleConfig string) []common.Anom
// means this target is not collect by categraf, do not check offset
continue
}
if target, exists := targetMap[ident]; exists {
if now-target.UpdateAt > 120 {
// means this target is not a active host, do not check offset
@@ -396,7 +398,6 @@ func (arw *AlertRuleWorker) GetHostAnomalyPoint(ruleConfig string) []common.Anom
}
}
logger.Debugf("rule_eval:%s offsetIdents:%v", arw.Key(), offsetIdents)
for host, offset := range offsetIdents {
m := make(map[string]string)
target, exists := arw.processor.TargetCache.Get(host)
@@ -431,7 +432,7 @@ func (arw *AlertRuleWorker) GetHostAnomalyPoint(ruleConfig string) []common.Anom
missTargets = append(missTargets, ident)
}
}
logger.Debugf("rule_eval:%s missTargets:%v", arw.Key(), missTargets)
pct := float64(len(missTargets)) / float64(len(idents)) * 100
if pct >= float64(trigger.Percent) {
lst = append(lst, common.NewAnomalyPoint(trigger.Type, nil, now, pct, trigger.Severity))

View File

@@ -79,25 +79,48 @@ func (n *Naming) loopHeartbeat() {
func (n *Naming) heartbeat() error {
var datasourceIds []int64
var myDatasourceIds []int64
var err error
// 在页面上维护实例和集群的对应关系
datasourceIds, err = models.GetDatasourceIdsByEngineName(n.ctx, n.heartbeatConfig.EngineName)
if err != nil {
return err
// 如果是中心机房的 leader 机器,沟通全量的数据源的 hash ring给智能告警模块使用
if n.IamLeader() {
datasources, err := models.GetDatasources(n.ctx)
if err != nil {
logger.Warningf("get datasources err:%v", err)
return err
}
for i := 0; i < len(datasources); i++ {
datasourceIds = append(datasourceIds, datasources[i].Id)
}
myDatasourceIds, err = models.GetDatasourceIdsByEngineName(n.ctx, n.heartbeatConfig.EngineName)
if err != nil {
logger.Warningf("get datasource ids by engine name err:%v", err)
return err
}
} else {
// 在页面上维护实例和集群的对应关系
datasourceIds, err = models.GetDatasourceIdsByEngineName(n.ctx, n.heartbeatConfig.EngineName)
if err != nil {
return err
}
myDatasourceIds = datasourceIds
}
if len(datasourceIds) == 0 {
// 上报心跳
if len(myDatasourceIds) == 0 {
err := models.AlertingEngineHeartbeatWithCluster(n.ctx, n.heartbeatConfig.Endpoint, n.heartbeatConfig.EngineName, 0)
if err != nil {
logger.Warningf("heartbeat with cluster %s err:%v", "", err)
n.astats.CounterHeartbeatErrorTotal.WithLabelValues().Inc()
}
} else {
for i := 0; i < len(datasourceIds); i++ {
err := models.AlertingEngineHeartbeatWithCluster(n.ctx, n.heartbeatConfig.Endpoint, n.heartbeatConfig.EngineName, datasourceIds[i])
for i := 0; i < len(myDatasourceIds); i++ {
err := models.AlertingEngineHeartbeatWithCluster(n.ctx, n.heartbeatConfig.Endpoint, n.heartbeatConfig.EngineName, myDatasourceIds[i])
if err != nil {
logger.Warningf("heartbeat with cluster %d err:%v", datasourceIds[i], err)
logger.Warningf("heartbeat with cluster %d err:%v", myDatasourceIds[i], err)
n.astats.CounterHeartbeatErrorTotal.WithLabelValues().Inc()
}
}

View File

@@ -1,8 +1,9 @@
package sender
import (
"html/template"
"net/url"
"encoding/json"
"fmt"
"strconv"
"strings"
"time"
@@ -12,122 +13,37 @@ import (
"github.com/ccfos/nightingale/v6/pkg/ctx"
"github.com/ccfos/nightingale/v6/pkg/poster"
imodels "github.com/flashcatcloud/ibex/src/models"
"github.com/flashcatcloud/ibex/src/storage"
"github.com/toolkits/pkg/logger"
)
type (
// CallBacker 进行回调的接口
CallBacker interface {
CallBack(ctx CallBackContext)
}
// CallBackContext 回调时所需的上下文
CallBackContext struct {
Ctx *ctx.Context
CallBackURL string
Users []*models.User
Rule *models.AlertRule
Events []*models.AlertCurEvent
Stats *astats.Stats
}
DefaultCallBacker struct{}
)
func BuildCallBackContext(ctx *ctx.Context, callBackURL string, rule *models.AlertRule, events []*models.AlertCurEvent,
uids []int64, userCache *memsto.UserCacheType, stats *astats.Stats) CallBackContext {
users := userCache.GetByUserIds(uids)
return CallBackContext{
Ctx: ctx,
CallBackURL: callBackURL,
Rule: rule,
Events: events,
Users: users,
Stats: stats,
}
}
func ExtractAtsParams(rawURL string) []string {
ans := make([]string, 0, 1)
parsedURL, err := url.Parse(rawURL)
if err != nil {
logger.Errorf("ExtractAtsParams(url=%s), err: %v", rawURL, err)
return ans
}
queryParams := parsedURL.Query()
atParam := queryParams.Get("ats")
if atParam == "" {
return ans
}
// Split the atParam by comma and return the result as a slice
return strings.Split(atParam, ",")
}
func NewCallBacker(
key string,
targetCache *memsto.TargetCacheType,
userCache *memsto.UserCacheType,
taskTplCache *memsto.TaskTplCache,
tpls map[string]*template.Template,
) CallBacker {
switch key {
case models.IbexDomain: // Distribute to Ibex
return &IbexCallBacker{
targetCache: targetCache,
userCache: userCache,
taskTplCache: taskTplCache,
func SendCallbacks(ctx *ctx.Context, urls []string, event *models.AlertCurEvent, targetCache *memsto.TargetCacheType, userCache *memsto.UserCacheType,
taskTplCache *memsto.TaskTplCache, stats *astats.Stats) {
for _, url := range urls {
if url == "" {
continue
}
case models.DefaultDomain: // default callback
return &DefaultCallBacker{}
case models.DingtalkDomain:
return &DingtalkSender{tpl: tpls[models.Dingtalk]}
case models.WecomDomain:
return &WecomSender{tpl: tpls[models.Wecom]}
case models.FeishuDomain:
return &FeishuSender{tpl: tpls[models.Feishu]}
case models.FeishuCardDomain:
return &FeishuCardSender{tpl: tpls[models.FeishuCard]}
//case models.Mm:
// return &MmSender{tpl: tpls[models.Mm]}
case models.TelegramDomain:
return &TelegramSender{tpl: tpls[models.Telegram]}
}
return nil
}
if strings.HasPrefix(url, "${ibex}") {
if !event.IsRecovered {
handleIbex(ctx, url, event, targetCache, userCache, taskTplCache)
}
continue
}
func (c *DefaultCallBacker) CallBack(ctx CallBackContext) {
if len(ctx.CallBackURL) == 0 || len(ctx.Events) == 0 {
return
}
if !(strings.HasPrefix(url, "http://") || strings.HasPrefix(url, "https://")) {
url = "http://" + url
}
event := ctx.Events[0]
ctx.Stats.AlertNotifyTotal.WithLabelValues("rule_callback").Inc()
resp, code, err := poster.PostJSON(ctx.CallBackURL, 5*time.Second, event, 3)
if err != nil {
logger.Errorf("event_callback_fail(rule_id=%d url=%s), resp: %s, err: %v, code: %d",
event.RuleId, ctx.CallBackURL, string(resp), err, code)
ctx.Stats.AlertNotifyErrorTotal.WithLabelValues("rule_callback").Inc()
} else {
logger.Infof("event_callback_succ(rule_id=%d url=%s), resp: %s, code: %d",
event.RuleId, ctx.CallBackURL, string(resp), code)
}
}
func doSend(url string, body interface{}, channel string, stats *astats.Stats) {
stats.AlertNotifyTotal.WithLabelValues(channel).Inc()
res, code, err := poster.PostJSON(url, time.Second*5, body, 3)
if err != nil {
logger.Errorf("%s_sender: result=fail url=%s code=%d error=%v req:%v response=%s", channel, url, code, err, body, string(res))
stats.AlertNotifyErrorTotal.WithLabelValues(channel).Inc()
} else {
logger.Infof("%s_sender: result=succ url=%s code=%d req:%v response=%s", channel, url, code, body, string(res))
stats.AlertNotifyTotal.WithLabelValues("rule_callback").Inc()
resp, code, err := poster.PostJSON(url, 5*time.Second, event, 3)
if err != nil {
logger.Errorf("event_callback_fail(rule_id=%d url=%s), resp: %s, err: %v, code: %d", event.RuleId, url, string(resp), err, code)
stats.AlertNotifyErrorTotal.WithLabelValues("rule_callback").Inc()
} else {
logger.Infof("event_callback_succ(rule_id=%d url=%s), resp: %s, code: %d", event.RuleId, url, string(resp), code)
}
}
}
@@ -135,3 +51,226 @@ type TaskCreateReply struct {
Err string `json:"err"`
Dat int64 `json:"dat"` // task.id
}
func handleIbex(ctx *ctx.Context, url string, event *models.AlertCurEvent, targetCache *memsto.TargetCacheType, userCache *memsto.UserCacheType,
taskTplCache *memsto.TaskTplCache) {
if imodels.DB() == nil {
logger.Warning("event_callback_ibex: db is nil")
return
}
arr := strings.Split(url, "/")
var idstr string
var host string
if len(arr) > 1 {
idstr = arr[1]
}
if len(arr) > 2 {
host = arr[2]
}
id, err := strconv.ParseInt(idstr, 10, 64)
if err != nil {
logger.Errorf("event_callback_ibex: failed to parse url: %s", url)
return
}
if host == "" {
// 用户在callback url中没有传入host就从event中解析
host = event.TargetIdent
}
if host == "" {
logger.Error("event_callback_ibex: failed to get host")
return
}
tpl := taskTplCache.Get(id)
if tpl == nil {
logger.Errorf("event_callback_ibex: no such tpl(%d)", id)
return
}
// check perm
// tpl.GroupId - host - account 三元组校验权限
can, err := canDoIbex(tpl.UpdateBy, tpl, host, targetCache, userCache)
if err != nil {
logger.Errorf("event_callback_ibex: check perm fail: %v", err)
return
}
if !can {
logger.Errorf("event_callback_ibex: user(%s) no permission", tpl.UpdateBy)
return
}
tagsMap := make(map[string]string)
for i := 0; i < len(event.TagsJSON); i++ {
pair := strings.TrimSpace(event.TagsJSON[i])
if pair == "" {
continue
}
arr := strings.Split(pair, "=")
if len(arr) != 2 {
continue
}
tagsMap[arr[0]] = arr[1]
}
// 附加告警级别 告警触发值标签
tagsMap["alert_severity"] = strconv.Itoa(event.Severity)
tagsMap["alert_trigger_value"] = event.TriggerValue
tags, err := json.Marshal(tagsMap)
if err != nil {
logger.Errorf("event_callback_ibex: failed to marshal tags to json: %v", tagsMap)
return
}
// call ibex
in := models.TaskForm{
Title: tpl.Title + " FH: " + host,
Account: tpl.Account,
Batch: tpl.Batch,
Tolerance: tpl.Tolerance,
Timeout: tpl.Timeout,
Pause: tpl.Pause,
Script: tpl.Script,
Args: tpl.Args,
Stdin: string(tags),
Action: "start",
Creator: tpl.UpdateBy,
Hosts: []string{host},
AlertTriggered: true,
}
id, err = TaskAdd(in, tpl.UpdateBy, ctx.IsCenter)
if err != nil {
logger.Errorf("event_callback_ibex: call ibex fail: %v", err)
return
}
// write db
record := models.TaskRecord{
Id: id,
EventId: event.Id,
GroupId: tpl.GroupId,
Title: in.Title,
Account: in.Account,
Batch: in.Batch,
Tolerance: in.Tolerance,
Timeout: in.Timeout,
Pause: in.Pause,
Script: in.Script,
Args: in.Args,
CreateAt: time.Now().Unix(),
CreateBy: in.Creator,
}
if err = record.Add(ctx); err != nil {
logger.Errorf("event_callback_ibex: persist task_record fail: %v", err)
}
}
func canDoIbex(username string, tpl *models.TaskTpl, host string, targetCache *memsto.TargetCacheType, userCache *memsto.UserCacheType) (bool, error) {
user := userCache.GetByUsername(username)
if user != nil && user.IsAdmin() {
return true, nil
}
target, has := targetCache.Get(host)
if !has {
return false, nil
}
return target.GroupId == tpl.GroupId, nil
}
func TaskAdd(f models.TaskForm, authUser string, isCenter bool) (int64, error) {
hosts := cleanHosts(f.Hosts)
if len(hosts) == 0 {
return 0, fmt.Errorf("arg(hosts) empty")
}
taskMeta := &imodels.TaskMeta{
Title: f.Title,
Account: f.Account,
Batch: f.Batch,
Tolerance: f.Tolerance,
Timeout: f.Timeout,
Pause: f.Pause,
Script: f.Script,
Args: f.Args,
Stdin: f.Stdin,
Creator: f.Creator,
}
err := taskMeta.CleanFields()
if err != nil {
return 0, err
}
taskMeta.HandleFH(hosts[0])
// 任务类型分为"告警规则触发"和"n9e center用户下发"两种;
// 边缘机房"告警规则触发"的任务不需要规划并且它可能是失联的无法使用db资源所以放入redis缓存中直接下发给agentd执行
if !isCenter && f.AlertTriggered {
if err := taskMeta.Create(); err != nil {
// 当网络不连通时生成唯一的id防止边缘机房中不同任务的id相同
// 方法是redis自增id去防止同一个机房的不同n9e edge生成的id相同
// 但没法防止不同边缘机房生成同样的id所以生成id的数据不会上报存入数据库只用于闭环执行。
taskMeta.Id, err = storage.IdGet()
if err != nil {
return 0, err
}
}
taskHost := imodels.TaskHost{
Id: taskMeta.Id,
Host: hosts[0],
Status: "running",
}
if err = taskHost.Create(); err != nil {
logger.Warningf("task_add_fail: authUser=%s title=%s err=%s", authUser, taskMeta.Title, err.Error())
}
// 缓存任务元信息和待下发的任务
err = taskMeta.Cache(hosts[0])
if err != nil {
return 0, err
}
} else {
// 如果是中心机房,还是保持之前的逻辑
err = taskMeta.Save(hosts, f.Action)
if err != nil {
return 0, err
}
}
logger.Infof("task_add_succ: authUser=%s title=%s", authUser, taskMeta.Title)
return taskMeta.Id, nil
}
func cleanHosts(formHosts []string) []string {
cnt := len(formHosts)
arr := make([]string, 0, cnt)
for i := 0; i < cnt; i++ {
item := strings.TrimSpace(formHosts[i])
if item == "" {
continue
}
if strings.HasPrefix(item, "#") {
continue
}
arr = append(arr, item)
}
return arr
}

View File

@@ -1,9 +1,15 @@
package sender
import (
"github.com/ccfos/nightingale/v6/models"
"html/template"
"strings"
"time"
"github.com/ccfos/nightingale/v6/alert/astats"
"github.com/ccfos/nightingale/v6/models"
"github.com/ccfos/nightingale/v6/pkg/poster"
"github.com/toolkits/pkg/logger"
)
type dingtalkMarkdown struct {
@@ -22,10 +28,6 @@ type dingtalk struct {
At dingtalkAt `json:"at"`
}
var (
_ CallBacker = (*DingtalkSender)(nil)
)
type DingtalkSender struct {
tpl *template.Template
}
@@ -70,37 +72,6 @@ func (ds *DingtalkSender) Send(ctx MessageContext) {
}
}
func (ds *DingtalkSender) CallBack(ctx CallBackContext) {
if len(ctx.Events) == 0 || len(ctx.CallBackURL) == 0 {
return
}
body := dingtalk{
Msgtype: "markdown",
Markdown: dingtalkMarkdown{
Title: ctx.Events[0].RuleName,
},
}
ats := ExtractAtsParams(ctx.CallBackURL)
message := BuildTplMessage(models.Dingtalk, ds.tpl, ctx.Events)
if len(ats) > 0 {
body.Markdown.Text = message + "\n@" + strings.Join(ats, "@")
body.At = dingtalkAt{
AtMobiles: ats,
IsAtAll: false,
}
} else {
// NoAt in url
body.Markdown.Text = message
}
doSend(ctx.CallBackURL, body, models.Dingtalk, ctx.Stats)
ctx.Stats.AlertNotifyTotal.WithLabelValues("rule_callback").Inc()
}
// extract urls and ats from Users
func (ds *DingtalkSender) extract(users []*models.User) ([]string, []string) {
urls := make([]string, 0, len(users))
@@ -120,3 +91,15 @@ func (ds *DingtalkSender) extract(users []*models.User) ([]string, []string) {
}
return urls, ats
}
func doSend(url string, body interface{}, channel string, stats *astats.Stats) {
stats.AlertNotifyTotal.WithLabelValues(channel).Inc()
res, code, err := poster.PostJSON(url, time.Second*5, body, 3)
if err != nil {
logger.Errorf("%s_sender: result=fail url=%s code=%d error=%v req:%v response=%s", channel, url, code, err, body, string(res))
stats.AlertNotifyErrorTotal.WithLabelValues(channel).Inc()
} else {
logger.Infof("%s_sender: result=succ url=%s code=%d req:%v response=%s", channel, url, code, body, string(res))
}
}

View File

@@ -1,7 +1,6 @@
package sender
import (
"fmt"
"html/template"
"strings"
@@ -23,41 +22,10 @@ type feishu struct {
At feishuAt `json:"at"`
}
var (
_ CallBacker = (*FeishuSender)(nil)
)
type FeishuSender struct {
tpl *template.Template
}
func (fs *FeishuSender) CallBack(ctx CallBackContext) {
if len(ctx.Events) == 0 || len(ctx.CallBackURL) == 0 {
return
}
ats := ExtractAtsParams(ctx.CallBackURL)
message := BuildTplMessage(models.Feishu, fs.tpl, ctx.Events)
if len(ats) > 0 {
atTags := ""
for _, at := range ats {
atTags += fmt.Sprintf("<at user_id=\"%s\"></at> ", at)
}
message = atTags + message
}
body := feishu{
Msgtype: "text",
Content: feishuContent{
Text: message,
},
}
doSend(ctx.CallBackURL, body, models.Feishu, ctx.Stats)
ctx.Stats.AlertNotifyTotal.WithLabelValues("rule_callback").Inc()
}
func (fs *FeishuSender) Send(ctx MessageContext) {
if len(ctx.Users) == 0 || len(ctx.Events) == 0 {
return

View File

@@ -3,7 +3,6 @@ package sender
import (
"fmt"
"html/template"
"net/url"
"strings"
"github.com/ccfos/nightingale/v6/models"
@@ -92,37 +91,6 @@ var (
}
)
func (fs *FeishuCardSender) CallBack(ctx CallBackContext) {
if len(ctx.Events) == 0 || len(ctx.CallBackURL) == 0 {
return
}
message := BuildTplMessage(models.FeishuCard, fs.tpl, ctx.Events)
color := "red"
lowerUnicode := strings.ToLower(message)
if strings.Count(lowerUnicode, Recovered) > 0 && strings.Count(lowerUnicode, Triggered) > 0 {
color = "orange"
} else if strings.Count(lowerUnicode, Recovered) > 0 {
color = "green"
}
SendTitle := fmt.Sprintf("🔔 %s", ctx.Events[0].RuleName)
body.Card.Header.Title.Content = SendTitle
body.Card.Header.Template = color
body.Card.Elements[0].Text.Content = message
body.Card.Elements[2].Elements[0].Content = SendTitle
// This is to be compatible with the feishucard interface, if with query string parameters, the request will fail
// Remove query parameters from the URL,
parsedURL, err := url.Parse(ctx.CallBackURL)
if err != nil {
return
}
parsedURL.RawQuery = ""
doSend(parsedURL.String(), body, models.FeishuCard, ctx.Stats)
}
func (fs *FeishuCardSender) Send(ctx MessageContext) {
if len(ctx.Users) == 0 || len(ctx.Events) == 0 {
return

View File

@@ -1,265 +0,0 @@
// @Author: Ciusyan 6/5/24
package sender
import (
"encoding/json"
"fmt"
"strconv"
"strings"
"time"
"github.com/ccfos/nightingale/v6/memsto"
"github.com/ccfos/nightingale/v6/models"
"github.com/ccfos/nightingale/v6/pkg/ctx"
imodels "github.com/flashcatcloud/ibex/src/models"
"github.com/flashcatcloud/ibex/src/storage"
"github.com/toolkits/pkg/logger"
)
var (
_ CallBacker = (*IbexCallBacker)(nil)
)
type IbexCallBacker struct {
targetCache *memsto.TargetCacheType
userCache *memsto.UserCacheType
taskTplCache *memsto.TaskTplCache
}
func (c *IbexCallBacker) CallBack(ctx CallBackContext) {
if len(ctx.CallBackURL) == 0 || len(ctx.Events) == 0 {
return
}
event := ctx.Events[0]
if event.IsRecovered {
return
}
c.handleIbex(ctx.Ctx, ctx.CallBackURL, event)
}
func (c *IbexCallBacker) handleIbex(ctx *ctx.Context, url string, event *models.AlertCurEvent) {
if imodels.DB() == nil && ctx.IsCenter {
logger.Warning("event_callback_ibex: db is nil")
return
}
arr := strings.Split(url, "/")
var idstr string
var host string
if len(arr) > 1 {
idstr = arr[1]
}
if len(arr) > 2 {
host = arr[2]
}
id, err := strconv.ParseInt(idstr, 10, 64)
if err != nil {
logger.Errorf("event_callback_ibex: failed to parse url: %s", url)
return
}
if host == "" {
// 用户在callback url中没有传入host就从event中解析
host = event.TargetIdent
}
if host == "" {
logger.Error("event_callback_ibex: failed to get host")
return
}
tpl := c.taskTplCache.Get(id)
if tpl == nil {
logger.Errorf("event_callback_ibex: no such tpl(%d)", id)
return
}
// check perm
// tpl.GroupId - host - account 三元组校验权限
can, err := canDoIbex(tpl.UpdateBy, tpl, host, c.targetCache, c.userCache)
if err != nil {
logger.Errorf("event_callback_ibex: check perm fail: %v", err)
return
}
if !can {
logger.Errorf("event_callback_ibex: user(%s) no permission", tpl.UpdateBy)
return
}
tagsMap := make(map[string]string)
for i := 0; i < len(event.TagsJSON); i++ {
pair := strings.TrimSpace(event.TagsJSON[i])
if pair == "" {
continue
}
arr := strings.Split(pair, "=")
if len(arr) != 2 {
continue
}
tagsMap[arr[0]] = arr[1]
}
// 附加告警级别 告警触发值标签
tagsMap["alert_severity"] = strconv.Itoa(event.Severity)
tagsMap["alert_trigger_value"] = event.TriggerValue
tags, err := json.Marshal(tagsMap)
if err != nil {
logger.Errorf("event_callback_ibex: failed to marshal tags to json: %v", tagsMap)
return
}
// call ibex
in := models.TaskForm{
Title: tpl.Title + " FH: " + host,
Account: tpl.Account,
Batch: tpl.Batch,
Tolerance: tpl.Tolerance,
Timeout: tpl.Timeout,
Pause: tpl.Pause,
Script: tpl.Script,
Args: tpl.Args,
Stdin: string(tags),
Action: "start",
Creator: tpl.UpdateBy,
Hosts: []string{host},
AlertTriggered: true,
}
id, err = TaskAdd(in, tpl.UpdateBy, ctx.IsCenter)
if err != nil {
logger.Errorf("event_callback_ibex: call ibex fail: %v", err)
return
}
// write db
record := models.TaskRecord{
Id: id,
EventId: event.Id,
GroupId: tpl.GroupId,
Title: in.Title,
Account: in.Account,
Batch: in.Batch,
Tolerance: in.Tolerance,
Timeout: in.Timeout,
Pause: in.Pause,
Script: in.Script,
Args: in.Args,
CreateAt: time.Now().Unix(),
CreateBy: in.Creator,
}
if err = record.Add(ctx); err != nil {
logger.Errorf("event_callback_ibex: persist task_record fail: %v", err)
}
}
func canDoIbex(username string, tpl *models.TaskTpl, host string, targetCache *memsto.TargetCacheType, userCache *memsto.UserCacheType) (bool, error) {
user := userCache.GetByUsername(username)
if user != nil && user.IsAdmin() {
return true, nil
}
target, has := targetCache.Get(host)
if !has {
return false, nil
}
return target.GroupId == tpl.GroupId, nil
}
func TaskAdd(f models.TaskForm, authUser string, isCenter bool) (int64, error) {
hosts := cleanHosts(f.Hosts)
if len(hosts) == 0 {
return 0, fmt.Errorf("arg(hosts) empty")
}
taskMeta := &imodels.TaskMeta{
Title: f.Title,
Account: f.Account,
Batch: f.Batch,
Tolerance: f.Tolerance,
Timeout: f.Timeout,
Pause: f.Pause,
Script: f.Script,
Args: f.Args,
Stdin: f.Stdin,
Creator: f.Creator,
}
err := taskMeta.CleanFields()
if err != nil {
return 0, err
}
taskMeta.HandleFH(hosts[0])
// 任务类型分为"告警规则触发"和"n9e center用户下发"两种;
// 边缘机房"告警规则触发"的任务不需要规划并且它可能是失联的无法使用db资源所以放入redis缓存中直接下发给agentd执行
if !isCenter && f.AlertTriggered {
if err := taskMeta.Create(); err != nil {
// 当网络不连通时生成唯一的id防止边缘机房中不同任务的id相同
// 方法是redis自增id去防止同一个机房的不同n9e edge生成的id相同
// 但没法防止不同边缘机房生成同样的id所以生成id的数据不会上报存入数据库只用于闭环执行。
taskMeta.Id, err = storage.IdGet()
if err != nil {
return 0, err
}
}
taskHost := imodels.TaskHost{
Id: taskMeta.Id,
Host: hosts[0],
Status: "running",
}
if err = taskHost.Create(); err != nil {
logger.Warningf("task_add_fail: authUser=%s title=%s err=%s", authUser, taskMeta.Title, err.Error())
}
// 缓存任务元信息和待下发的任务
err = taskMeta.Cache(hosts[0])
if err != nil {
return 0, err
}
} else {
// 如果是中心机房,还是保持之前的逻辑
err = taskMeta.Save(hosts, f.Action)
if err != nil {
return 0, err
}
}
logger.Infof("task_add_succ: authUser=%s title=%s", authUser, taskMeta.Title)
return taskMeta.Id, nil
}
func cleanHosts(formHosts []string) []string {
cnt := len(formHosts)
arr := make([]string, 0, cnt)
for i := 0; i < cnt; i++ {
item := strings.TrimSpace(formHosts[i])
if item == "" {
continue
}
if strings.HasPrefix(item, "#") {
continue
}
arr = append(arr, item)
}
return arr
}

View File

@@ -45,21 +45,6 @@ func (ms *MmSender) Send(ctx MessageContext) {
})
}
func (ms *MmSender) CallBack(ctx CallBackContext) {
if len(ctx.Events) == 0 || len(ctx.CallBackURL) == 0 {
return
}
message := BuildTplMessage(models.Mm, ms.tpl, ctx.Events)
SendMM(MatterMostMessage{
Text: message,
Tokens: []string{ctx.CallBackURL},
Stats: ctx.Stats,
})
ctx.Stats.AlertNotifyTotal.WithLabelValues("rule_callback").Inc()
}
func (ms *MmSender) extract(users []*models.User) []string {
tokens := make([]string, 0, len(users))
for _, user := range users {

View File

@@ -21,29 +21,10 @@ type telegram struct {
Text string `json:"text"`
}
var (
_ CallBacker = (*TelegramSender)(nil)
)
type TelegramSender struct {
tpl *template.Template
}
func (ts *TelegramSender) CallBack(ctx CallBackContext) {
if len(ctx.Events) == 0 || len(ctx.CallBackURL) == 0 {
return
}
message := BuildTplMessage(models.Telegram, ts.tpl, ctx.Events)
SendTelegram(TelegramMessage{
Text: message,
Tokens: []string{ctx.CallBackURL},
Stats: ctx.Stats,
})
ctx.Stats.AlertNotifyTotal.WithLabelValues("rule_callback").Inc()
}
func (ts *TelegramSender) Send(ctx MessageContext) {
if len(ctx.Users) == 0 || len(ctx.Events) == 0 {
return

View File

@@ -16,31 +16,10 @@ type wecom struct {
Markdown wecomMarkdown `json:"markdown"`
}
var (
_ CallBacker = (*WecomSender)(nil)
)
type WecomSender struct {
tpl *template.Template
}
func (ws *WecomSender) CallBack(ctx CallBackContext) {
if len(ctx.Events) == 0 || len(ctx.CallBackURL) == 0 {
return
}
message := BuildTplMessage(models.Wecom, ws.tpl, ctx.Events)
body := wecom{
Msgtype: "markdown",
Markdown: wecomMarkdown{
Content: message,
},
}
doSend(ctx.CallBackURL, body, models.Wecom, ctx.Stats)
ctx.Stats.AlertNotifyTotal.WithLabelValues("rule_callback").Inc()
}
func (ws *WecomSender) Send(ctx MessageContext) {
if len(ctx.Users) == 0 || len(ctx.Events) == 0 {
return

View File

@@ -12,7 +12,6 @@ type Center struct {
AnonymousAccess AnonymousAccess
UseFileAssets bool
FlashDuty FlashDuty
EventHistoryGroupView bool
}
type Plugin struct {

View File

@@ -76,8 +76,7 @@ ops:
- "/dashboards/add"
- "/dashboards/put"
- "/dashboards/del"
- "/embedded-dashboards/put"
- "/embedded-dashboards"
- "/dashboards-built-in"
- name: alert
cname: 告警规则
@@ -86,7 +85,7 @@ ops:
- "/alert-rules/add"
- "/alert-rules/put"
- "/alert-rules/del"
- "/alert-rules-built-in"
- name: alert-mutes
cname: 告警静默管理
ops:
@@ -181,14 +180,6 @@ ops:
- "/builtin-metrics/put"
- "/builtin-metrics/del"
- name: built-in-components
cname: 模版中心
ops:
- "/built-in-components"
- "/built-in-components/add"
- "/built-in-components/put"
- "/built-in-components/del"
- name: system
cname: 系统信息
ops:

View File

@@ -64,8 +64,6 @@ func Initialize(configDir string, cryptoKey string) (func(), error) {
migrate.Migrate(db)
models.InitRoot(ctx)
config.HTTP.JWTAuth.SigningKey = models.InitJWTSigningKey(ctx)
err = rsa.InitRSAConfig(ctx, &config.HTTP.RSA)
if err != nil {
return nil, err

View File

@@ -4,17 +4,15 @@ import (
"encoding/json"
"path"
"strings"
"time"
"github.com/ccfos/nightingale/v6/models"
"github.com/ccfos/nightingale/v6/pkg/ctx"
"github.com/toolkits/pkg/file"
"github.com/toolkits/pkg/ginx"
"github.com/toolkits/pkg/logger"
"github.com/toolkits/pkg/runner"
)
const SYSTEM = "system"
func Init(ctx *ctx.Context, builtinIntegrationsDir string) {
fp := builtinIntegrationsDir
if fp == "" {
@@ -23,10 +21,7 @@ func Init(ctx *ctx.Context, builtinIntegrationsDir string) {
// var fileList []string
dirList, err := file.DirsUnder(fp)
if err != nil {
logger.Warning("read builtin component dir fail ", err)
return
}
ginx.Dangerous(err)
for _, dir := range dirList {
// components icon
@@ -50,8 +45,7 @@ func Init(ctx *ctx.Context, builtinIntegrationsDir string) {
var readmeFile string
for _, file := range files {
if strings.HasSuffix(strings.ToLower(file), "md") {
readmeFile = componentDir + "/markdown/" + file
break
readmeFile = file
}
}
if readmeFile != "" {
@@ -63,47 +57,11 @@ func Init(ctx *ctx.Context, builtinIntegrationsDir string) {
exists, _ := models.BuiltinComponentExists(ctx, &component)
if !exists {
err = component.Add(ctx, SYSTEM)
err = component.Add(ctx, "system")
if err != nil {
logger.Warning("add builtin component fail ", component, err)
continue
}
} else {
old, err := models.BuiltinComponentGet(ctx, "ident = ?", component.Ident)
if err != nil {
logger.Warning("get builtin component fail ", component, err)
continue
}
if old == nil {
logger.Warning("get builtin component nil ", component)
continue
}
if old.UpdatedBy == SYSTEM {
now := time.Now().Unix()
old.CreatedAt = now
old.UpdatedAt = now
old.Readme = component.Readme
old.UpdatedBy = SYSTEM
err = models.DB(ctx).Model(old).Select("*").Updates(old).Error
if err != nil {
logger.Warning("update builtin component fail ", old, err)
}
}
}
// delete uuid is emtpy
err = models.DB(ctx).Exec("delete from builtin_payloads where uuid = 0 and type != 'collect' and (updated_by = 'system' or updated_by = '')").Error
if err != nil {
logger.Warning("delete builtin payloads fail ", err)
}
// delete builtin metrics uuid is emtpy
err = models.DB(ctx).Exec("delete from builtin_metrics where uuid = 0 and (updated_by = 'system' or updated_by = '')").Error
if err != nil {
logger.Warning("delete builtin metrics fail ", err)
}
// alerts
@@ -124,15 +82,7 @@ func Init(ctx *ctx.Context, builtinIntegrationsDir string) {
continue
}
newAlerts := []models.AlertRule{}
writeAlertFileFlag := false
for _, alert := range alerts {
if alert.UUID == 0 {
writeAlertFileFlag = true
alert.UUID = time.Now().UnixNano()
}
newAlerts = append(newAlerts, alert)
content, err := json.Marshal(alert)
if err != nil {
logger.Warning("marshal builtin alert fail ", alert, err)
@@ -145,49 +95,25 @@ func Init(ctx *ctx.Context, builtinIntegrationsDir string) {
Type: "alert",
Cate: cate,
Name: alert.Name,
Tags: alert.AppendTags,
Content: string(content),
UUID: alert.UUID,
}
old, err := models.BuiltinPayloadGet(ctx, "uuid = ?", alert.UUID)
exists, err := models.BuiltinPayloadExists(ctx, &builtinAlert)
if err != nil {
logger.Warning("get builtin alert fail ", builtinAlert, err)
logger.Warning("check builtin alert exists fail ", builtinAlert, err)
continue
}
if old == nil {
err := builtinAlert.Add(ctx, SYSTEM)
if err != nil {
logger.Warning("add builtin alert fail ", builtinAlert, err)
}
if exists {
continue
}
if old.UpdatedBy == SYSTEM {
old.Content = string(content)
old.Name = alert.Name
old.Tags = alert.AppendTags
err = models.DB(ctx).Model(old).Select("*").Updates(old).Error
if err != nil {
logger.Warningf("update builtin alert:%+v fail %v", builtinAlert, err)
}
err = builtinAlert.Add(ctx, "system")
if err != nil {
logger.Warningf("add builtin alert:%+v fail %v", builtinAlert, err)
continue
}
}
if writeAlertFileFlag {
bs, err = json.MarshalIndent(newAlerts, "", " ")
if err != nil {
logger.Warning("marshal builtin alerts fail ", newAlerts, err)
continue
}
_, err = file.WriteBytes(fp, bs)
if err != nil {
logger.Warning("write builtin alerts file fail ", f, err)
}
}
}
}
@@ -209,21 +135,6 @@ func Init(ctx *ctx.Context, builtinIntegrationsDir string) {
continue
}
if dashboard.UUID == 0 {
dashboard.UUID = time.Now().UnixNano()
// 补全文件中的 uuid
bs, err = json.MarshalIndent(dashboard, "", " ")
if err != nil {
logger.Warning("marshal builtin dashboard fail ", dashboard, err)
continue
}
_, err = file.WriteBytes(fp, bs)
if err != nil {
logger.Warning("write builtin dashboard file fail ", f, err)
}
}
content, err := json.Marshal(dashboard)
if err != nil {
logger.Warning("marshal builtin dashboard fail ", dashboard, err)
@@ -235,33 +146,23 @@ func Init(ctx *ctx.Context, builtinIntegrationsDir string) {
Type: "dashboard",
Cate: "",
Name: dashboard.Name,
Tags: dashboard.Tags,
Content: string(content),
UUID: dashboard.UUID,
}
old, err := models.BuiltinPayloadGet(ctx, "uuid = ?", dashboard.UUID)
exists, err := models.BuiltinPayloadExists(ctx, &builtinDashboard)
if err != nil {
logger.Warning("get builtin alert fail ", builtinDashboard, err)
logger.Warning("check builtin dashboard exists fail ", builtinDashboard, err)
continue
}
if old == nil {
err := builtinDashboard.Add(ctx, SYSTEM)
if err != nil {
logger.Warning("add builtin alert fail ", builtinDashboard, err)
}
if exists {
continue
}
if old.UpdatedBy == SYSTEM {
old.Content = string(content)
old.Name = dashboard.Name
old.Tags = dashboard.Tags
err = models.DB(ctx).Model(old).Select("*").Updates(old).Error
if err != nil {
logger.Warningf("update builtin alert:%+v fail %v", builtinDashboard, err)
}
err = builtinDashboard.Add(ctx, "system")
if err != nil {
logger.Warning("add builtin dashboard fail ", builtinDashboard, err)
continue
}
}
} else if err != nil {
@@ -280,64 +181,27 @@ func Init(ctx *ctx.Context, builtinIntegrationsDir string) {
}
metrics := []models.BuiltinMetric{}
newMetrics := []models.BuiltinMetric{}
err = json.Unmarshal(bs, &metrics)
if err != nil {
logger.Warning("parse builtin component metrics file fail", f, err)
continue
}
writeMetricFileFlag := false
for _, metric := range metrics {
if metric.UUID == 0 {
writeMetricFileFlag = true
metric.UUID = time.Now().UnixNano()
}
newMetrics = append(newMetrics, metric)
old, err := models.BuiltinMetricGet(ctx, "uuid = ?", metric.UUID)
exists, err := models.BuiltinMetricExists(ctx, &metric)
if err != nil {
logger.Warning("get builtin metrics fail ", metric, err)
logger.Warning("check builtin metric exists fail", metric, err)
continue
}
if old == nil {
err := metric.Add(ctx, SYSTEM)
if err != nil {
logger.Warning("add builtin metrics fail ", metric, err)
}
if exists {
continue
}
if old.UpdatedBy == SYSTEM {
old.Collector = metric.Collector
old.Typ = metric.Typ
old.Name = metric.Name
old.Unit = metric.Unit
old.Note = metric.Note
old.Lang = metric.Lang
old.Expression = metric.Expression
err = models.DB(ctx).Model(old).Select("*").Updates(old).Error
if err != nil {
logger.Warningf("update builtin metric:%+v fail %v", metric, err)
}
err = metric.Add(ctx, "system")
if err != nil {
logger.Warning("add builtin metric fail", metric, err)
continue
}
}
if writeMetricFileFlag {
bs, err = json.MarshalIndent(newMetrics, "", " ")
if err != nil {
logger.Warning("marshal builtin metrics fail ", newMetrics, err)
continue
}
_, err = file.WriteBytes(fp, bs)
if err != nil {
logger.Warning("write builtin metrics file fail ", f, err)
}
}
}
} else if err != nil {
logger.Warningf("read builtin component metrics dir fail %s %v", component.Ident, err)
@@ -361,5 +225,4 @@ type BuiltinBoard struct {
Bgids []int64 `json:"bgids" gorm:"-"`
BuiltIn int `json:"built_in"` // 0: false, 1: true
Hide int `json:"hide"` // 0: false, 1: true
UUID int64 `json:"uuid"`
}

View File

@@ -274,14 +274,13 @@ func (rt *Router) Config(r *gin.Engine) {
pages.POST("/builtin-cate-favorite", rt.auth(), rt.user(), rt.builtinCateFavoriteAdd)
pages.DELETE("/builtin-cate-favorite/:name", rt.auth(), rt.user(), rt.builtinCateFavoriteDel)
pages.GET("/builtin-boards", rt.builtinBoardGets)
pages.GET("/builtin-board/:name", rt.builtinBoardGet)
pages.GET("/dashboards/builtin/list", rt.builtinBoardGets)
pages.GET("/builtin-boards-cates", rt.auth(), rt.user(), rt.builtinBoardCateGets)
pages.POST("/builtin-boards-detail", rt.auth(), rt.user(), rt.builtinBoardDetailGets)
pages.GET("/integrations/icon/:cate/:name", rt.builtinIcon)
// pages.GET("/builtin-boards", rt.builtinBoardGets)
// pages.GET("/builtin-board/:name", rt.builtinBoardGet)
// pages.GET("/dashboards/builtin/list", rt.builtinBoardGets)
// pages.GET("/builtin-boards-cates", rt.auth(), rt.user(), rt.builtinBoardCateGets)
// pages.POST("/builtin-boards-detail", rt.auth(), rt.user(), rt.builtinBoardDetailGets)
// pages.GET("/integrations/makedown/:cate", rt.builtinMarkdown)
pages.GET("/integrations/makedown/:cate", rt.builtinMarkdown)
pages.GET("/busi-groups/public-boards", rt.auth(), rt.user(), rt.perm("/dashboards"), rt.publicBoardGets)
pages.GET("/busi-groups/boards", rt.auth(), rt.user(), rt.perm("/dashboards"), rt.boardGetsByGids)
@@ -300,8 +299,8 @@ func (rt *Router) Config(r *gin.Engine) {
pages.GET("/share-charts", rt.chartShareGets)
pages.POST("/share-charts", rt.auth(), rt.chartShareAdd)
// pages.GET("/alert-rules/builtin/alerts-cates", rt.auth(), rt.user(), rt.builtinAlertCateGets)
// pages.GET("/alert-rules/builtin/list", rt.auth(), rt.user(), rt.builtinAlertRules)
pages.GET("/alert-rules/builtin/alerts-cates", rt.auth(), rt.user(), rt.builtinAlertCateGets)
pages.GET("/alert-rules/builtin/list", rt.auth(), rt.user(), rt.builtinAlertRules)
pages.GET("/alert-rules/callbacks", rt.auth(), rt.user(), rt.alertRuleCallbacks)
pages.GET("/busi-groups/alert-rules", rt.auth(), rt.user(), rt.perm("/alert-rules"), rt.alertRuleGetsByGids)
@@ -342,15 +341,15 @@ func (rt *Router) Config(r *gin.Engine) {
pages.GET("/alert-cur-event/:eid", rt.alertCurEventGet)
pages.GET("/alert-his-event/:eid", rt.alertHisEventGet)
} else {
pages.GET("/alert-cur-event/:eid", rt.auth(), rt.user(), rt.alertCurEventGet)
pages.GET("/alert-his-event/:eid", rt.auth(), rt.user(), rt.alertHisEventGet)
pages.GET("/alert-cur-event/:eid", rt.auth(), rt.alertCurEventGet)
pages.GET("/alert-his-event/:eid", rt.auth(), rt.alertHisEventGet)
}
// card logic
pages.GET("/alert-cur-events/list", rt.auth(), rt.user(), rt.alertCurEventsList)
pages.GET("/alert-cur-events/card", rt.auth(), rt.user(), rt.alertCurEventsCard)
pages.GET("/alert-cur-events/list", rt.auth(), rt.alertCurEventsList)
pages.GET("/alert-cur-events/card", rt.auth(), rt.alertCurEventsCard)
pages.POST("/alert-cur-events/card/details", rt.auth(), rt.alertCurEventsCardDetails)
pages.GET("/alert-his-events/list", rt.auth(), rt.user(), rt.alertHisEventsList)
pages.GET("/alert-his-events/list", rt.auth(), rt.alertHisEventsList)
pages.DELETE("/alert-cur-events", rt.auth(), rt.user(), rt.perm("/alert-cur-events/del"), rt.alertCurEventDel)
pages.GET("/alert-cur-events/stats", rt.auth(), rt.alertCurEventsStatistics)
@@ -435,17 +434,16 @@ func (rt *Router) Config(r *gin.Engine) {
// for admin api
pages.GET("/user/busi-groups", rt.auth(), rt.admin(), rt.userBusiGroupsGets)
pages.GET("/builtin-components", rt.auth(), rt.user(), rt.builtinComponentsGets)
pages.POST("/builtin-components", rt.auth(), rt.user(), rt.perm("/built-in-components/add"), rt.builtinComponentsAdd)
pages.PUT("/builtin-components", rt.auth(), rt.user(), rt.perm("/built-in-components/put"), rt.builtinComponentsPut)
pages.DELETE("/builtin-components", rt.auth(), rt.user(), rt.perm("/built-in-components/del"), rt.builtinComponentsDel)
pages.POST("/builtin-components", rt.auth(), rt.user(), rt.perm("/builtin-components/add"), rt.builtinComponentsAdd)
pages.GET("/builtin-components", rt.auth(), rt.user(), rt.perm("/builtin-components"), rt.builtinComponentsGets)
pages.PUT("/builtin-components", rt.auth(), rt.user(), rt.perm("/builtin-components/put"), rt.builtinComponentsPut)
pages.DELETE("/builtin-components", rt.auth(), rt.user(), rt.perm("/builtin-components/del"), rt.builtinComponentsDel)
pages.GET("/builtin-payloads", rt.auth(), rt.user(), rt.builtinPayloadsGets)
pages.GET("/builtin-payloads/cates", rt.auth(), rt.user(), rt.builtinPayloadcatesGet)
pages.POST("/builtin-payloads", rt.auth(), rt.user(), rt.perm("/built-in-components/add"), rt.builtinPayloadsAdd)
pages.GET("/builtin-payload/:id", rt.auth(), rt.user(), rt.perm("/built-in-components"), rt.builtinPayloadGet)
pages.PUT("/builtin-payloads", rt.auth(), rt.user(), rt.perm("/built-in-components/put"), rt.builtinPayloadsPut)
pages.DELETE("/builtin-payloads", rt.auth(), rt.user(), rt.perm("/built-in-components/del"), rt.builtinPayloadsDel)
pages.POST("/builtin-payloads", rt.auth(), rt.user(), rt.perm("/builtin-payloads/add"), rt.builtinPayloadsAdd)
pages.GET("/builtin-payloads", rt.auth(), rt.user(), rt.perm("/builtin-payloads"), rt.builtinPayloadsGets)
pages.GET("/builtin-payload/:id", rt.auth(), rt.user(), rt.perm("/builtin-payloads"), rt.builtinPayloadGet)
pages.PUT("/builtin-payloads", rt.auth(), rt.user(), rt.perm("/builtin-payloads/put"), rt.builtinPayloadsPut)
pages.DELETE("/builtin-payloads", rt.auth(), rt.user(), rt.perm("/builtin-payloads/del"), rt.builtinPayloadsDel)
}
r.GET("/api/n9e/versions", func(c *gin.Context) {
@@ -479,14 +477,10 @@ func (rt *Router) Config(r *gin.Engine) {
service.GET("/user-group-members", rt.userGroupMemberGetsByService)
service.GET("/targets", rt.targetGetsByService)
service.GET("/target/extra-meta", rt.targetExtendInfoByIdent)
service.POST("/target/list", rt.targetGetsByHostFilter)
service.DELETE("/targets", rt.targetDelByService)
service.GET("/targets/tags", rt.targetGetTags)
service.POST("/targets/tags", rt.targetBindTagsByService)
service.DELETE("/targets/tags", rt.targetUnbindTagsByService)
service.PUT("/targets/note", rt.targetUpdateNoteByService)
service.PUT("/targets/bgid", rt.targetUpdateBgidByService)
service.POST("/alert-rules", rt.alertRuleAddByService)
service.POST("/alert-rule-add", rt.alertRuleAddOneByService)

View File

@@ -43,6 +43,7 @@ func (rt *Router) alertCurEventsCard(c *gin.Context) {
stime, etime := getTimeRange(c)
severity := ginx.QueryInt(c, "severity", -1)
query := ginx.QueryStr(c, "query", "")
busiGroupId := ginx.QueryInt64(c, "bgid", 0)
dsIds := queryDatasourceIds(c)
rules := parseAggrRules(c)
@@ -61,11 +62,8 @@ func (rt *Router) alertCurEventsCard(c *gin.Context) {
cates = strings.Split(cate, ",")
}
bgids, err := GetBusinessGroupIds(c, rt.Ctx, rt.Center.EventHistoryGroupView)
ginx.Dangerous(err)
// 最多获取50000个获取太多也没啥意义
list, err := models.AlertCurEventGets(rt.Ctx, prods, bgids, stime, etime, severity, dsIds, cates, query, 50000, 0)
list, err := models.AlertCurEventGets(rt.Ctx, prods, busiGroupId, stime, etime, severity, dsIds, cates, query, 50000, 0)
ginx.Dangerous(err)
cardmap := make(map[string]*AlertCard)
@@ -144,6 +142,7 @@ func (rt *Router) alertCurEventsList(c *gin.Context) {
severity := ginx.QueryInt(c, "severity", -1)
query := ginx.QueryStr(c, "query", "")
limit := ginx.QueryInt(c, "limit", 20)
busiGroupId := ginx.QueryInt64(c, "bgid", 0)
dsIds := queryDatasourceIds(c)
prod := ginx.QueryStr(c, "prods", "")
@@ -162,13 +161,10 @@ func (rt *Router) alertCurEventsList(c *gin.Context) {
cates = strings.Split(cate, ",")
}
bgids, err := GetBusinessGroupIds(c, rt.Ctx, rt.Center.EventHistoryGroupView)
total, err := models.AlertCurEventTotal(rt.Ctx, prods, busiGroupId, stime, etime, severity, dsIds, cates, query)
ginx.Dangerous(err)
total, err := models.AlertCurEventTotal(rt.Ctx, prods, bgids, stime, etime, severity, dsIds, cates, query)
ginx.Dangerous(err)
list, err := models.AlertCurEventGets(rt.Ctx, prods, bgids, stime, etime, severity, dsIds, cates, query, limit, ginx.Offset(c, limit))
list, err := models.AlertCurEventGets(rt.Ctx, prods, busiGroupId, stime, etime, severity, dsIds, cates, query, limit, ginx.Offset(c, limit))
ginx.Dangerous(err)
cache := make(map[int64]*models.UserGroup)
@@ -218,10 +214,6 @@ func (rt *Router) alertCurEventGet(c *gin.Context) {
ginx.Bomb(404, "No such active event")
}
if !rt.Center.AnonymousAccess.AlertDetail && rt.Center.EventHistoryGroupView {
rt.bgroCheck(c, event.GroupId)
}
ginx.NewRender(c).Data(event, nil)
}

View File

@@ -1,16 +1,13 @@
package router
import (
"fmt"
"strings"
"time"
"github.com/ccfos/nightingale/v6/models"
"github.com/ccfos/nightingale/v6/pkg/ctx"
"github.com/gin-gonic/gin"
"github.com/toolkits/pkg/ginx"
"golang.org/x/exp/slices"
)
func getTimeRange(c *gin.Context) (stime, etime int64) {
@@ -36,6 +33,7 @@ func (rt *Router) alertHisEventsList(c *gin.Context) {
recovered := ginx.QueryInt(c, "is_recovered", -1)
query := ginx.QueryStr(c, "query", "")
limit := ginx.QueryInt(c, "limit", 20)
busiGroupId := ginx.QueryInt64(c, "bgid", 0)
dsIds := queryDatasourceIds(c)
prod := ginx.QueryStr(c, "prods", "")
@@ -54,13 +52,10 @@ func (rt *Router) alertHisEventsList(c *gin.Context) {
cates = strings.Split(cate, ",")
}
bgids, err := GetBusinessGroupIds(c, rt.Ctx, rt.Center.EventHistoryGroupView)
total, err := models.AlertHisEventTotal(rt.Ctx, prods, busiGroupId, stime, etime, severity, recovered, dsIds, cates, query)
ginx.Dangerous(err)
total, err := models.AlertHisEventTotal(rt.Ctx, prods, bgids, stime, etime, severity, recovered, dsIds, cates, query)
ginx.Dangerous(err)
list, err := models.AlertHisEventGets(rt.Ctx, prods, bgids, stime, etime, severity, recovered, dsIds, cates, query, limit, ginx.Offset(c, limit))
list, err := models.AlertHisEventGets(rt.Ctx, prods, busiGroupId, stime, etime, severity, recovered, dsIds, cates, query, limit, ginx.Offset(c, limit))
ginx.Dangerous(err)
cache := make(map[int64]*models.UserGroup)
@@ -83,50 +78,5 @@ func (rt *Router) alertHisEventGet(c *gin.Context) {
ginx.Bomb(404, "No such alert event")
}
if !rt.Center.AnonymousAccess.AlertDetail && rt.Center.EventHistoryGroupView {
rt.bgroCheck(c, event.GroupId)
}
ginx.NewRender(c).Data(event, err)
}
func GetBusinessGroupIds(c *gin.Context, ctx *ctx.Context, eventHistoryGroupView bool) ([]int64, error) {
bgid := ginx.QueryInt64(c, "bgid", 0)
var bgids []int64
if !eventHistoryGroupView || strings.HasPrefix(c.Request.URL.Path, "/v1") {
if bgid > 0 {
return []int64{bgid}, nil
}
return bgids, nil
}
user := c.MustGet("user").(*models.User)
if user.IsAdmin() {
if bgid > 0 {
return []int64{bgid}, nil
}
return bgids, nil
}
bussGroupIds, err := models.MyBusiGroupIds(ctx, user.Id)
if err != nil {
return nil, err
}
if len(bussGroupIds) == 0 {
// 如果没查到用户属于任何业务组需要返回一个0否则会导致查询到全部告警历史
return []int64{0}, nil
}
if bgid > 0 && !slices.Contains(bussGroupIds, bgid) {
return nil, fmt.Errorf("business group ID not allowed")
}
if bgid > 0 {
// Pass filter parameters, priority to use
return []int64{bgid}, nil
}
return bussGroupIds, nil
}

View File

@@ -42,7 +42,7 @@ func (rt *Router) alertRuleGetsByGids(c *gin.Context) {
ginx.Dangerous(err)
if len(gids) == 0 {
ginx.NewRender(c).Data([]int{}, nil)
ginx.Bomb(http.StatusForbidden, "forbidden")
return
}
}

View File

@@ -44,7 +44,7 @@ func (rt *Router) alertSubscribeGetsByGids(c *gin.Context) {
ginx.Dangerous(err)
if len(gids) == 0 {
ginx.NewRender(c).Data([]int{}, nil)
ginx.Bomb(http.StatusForbidden, "forbidden")
return
}
}

View File

@@ -272,7 +272,7 @@ func (rt *Router) boardGetsByGids(c *gin.Context) {
ginx.Dangerous(err)
if len(gids) == 0 {
ginx.NewRender(c).Data([]int{}, nil)
ginx.Bomb(http.StatusForbidden, "forbidden")
return
}
}

View File

@@ -2,13 +2,11 @@ package router
import (
"net/http"
"time"
"github.com/ccfos/nightingale/v6/models"
"github.com/gin-gonic/gin"
"github.com/toolkits/pkg/ginx"
"github.com/toolkits/pkg/i18n"
)
// single or import
@@ -29,9 +27,8 @@ func (rt *Router) builtinMetricsAdd(c *gin.Context) {
reterr := make(map[string]string)
for i := 0; i < count; i++ {
lst[i].Lang = lang
lst[i].UUID = time.Now().UnixNano()
if err := lst[i].Add(rt.Ctx, username); err != nil {
reterr[lst[i].Name] = i18n.Sprintf(c.GetHeader("X-Language"), err.Error())
reterr[lst[i].Name] = err.Error()
}
}
ginx.NewRender(c).Data(reterr, nil)

View File

@@ -1,24 +1,13 @@
package router
import (
"encoding/json"
"net/http"
"strings"
"time"
"github.com/ccfos/nightingale/v6/models"
"github.com/gin-gonic/gin"
"github.com/toolkits/pkg/ginx"
"github.com/toolkits/pkg/i18n"
)
type Board struct {
Name string `json:"name"`
Tags string `json:"tags"`
Configs interface{} `json:"configs"`
UUID int64 `json:"uuid"`
}
func (rt *Router) builtinPayloadsAdd(c *gin.Context) {
var lst []models.BuiltinPayload
ginx.BindJSON(c, &lst)
@@ -32,138 +21,9 @@ func (rt *Router) builtinPayloadsAdd(c *gin.Context) {
reterr := make(map[string]string)
for i := 0; i < count; i++ {
if lst[i].Type == "alert" {
if strings.HasPrefix(strings.TrimSpace(lst[i].Content), "[") {
// 处理多个告警规则模板的情况
alertRules := []models.AlertRule{}
if err := json.Unmarshal([]byte(lst[i].Content), &alertRules); err != nil {
reterr[lst[i].Name] = err.Error()
}
for _, rule := range alertRules {
if rule.UUID == 0 {
rule.UUID = time.Now().UnixNano()
}
contentBytes, err := json.Marshal(rule)
if err != nil {
reterr[rule.Name] = err.Error()
continue
}
bp := models.BuiltinPayload{
Type: lst[i].Type,
Component: lst[i].Component,
Cate: lst[i].Cate,
Name: rule.Name,
Tags: rule.AppendTags,
UUID: rule.UUID,
Content: string(contentBytes),
CreatedBy: username,
UpdatedBy: username,
}
if err := bp.Add(rt.Ctx, username); err != nil {
reterr[bp.Name] = i18n.Sprintf(c.GetHeader("X-Language"), err.Error())
}
}
continue
}
alertRule := models.AlertRule{}
if err := json.Unmarshal([]byte(lst[i].Content), &alertRule); err != nil {
reterr[lst[i].Name] = err.Error()
continue
}
if alertRule.UUID == 0 {
alertRule.UUID = time.Now().UnixNano()
}
bp := models.BuiltinPayload{
Type: lst[i].Type,
Component: lst[i].Component,
Cate: lst[i].Cate,
Name: alertRule.Name,
Tags: alertRule.AppendTags,
UUID: alertRule.UUID,
Content: lst[i].Content,
CreatedBy: username,
UpdatedBy: username,
}
if err := bp.Add(rt.Ctx, username); err != nil {
reterr[bp.Name] = i18n.Sprintf(c.GetHeader("X-Language"), err.Error())
}
} else if lst[i].Type == "dashboard" {
if strings.HasPrefix(strings.TrimSpace(lst[i].Content), "[") {
// 处理多个告警规则模板的情况
dashboards := []Board{}
if err := json.Unmarshal([]byte(lst[i].Content), &dashboards); err != nil {
reterr[lst[i].Name] = err.Error()
}
for _, dashboard := range dashboards {
if dashboard.UUID == 0 {
dashboard.UUID = time.Now().UnixNano()
}
contentBytes, err := json.Marshal(dashboard)
if err != nil {
reterr[dashboard.Name] = err.Error()
continue
}
bp := models.BuiltinPayload{
Type: lst[i].Type,
Component: lst[i].Component,
Cate: lst[i].Cate,
Name: dashboard.Name,
Tags: dashboard.Tags,
UUID: dashboard.UUID,
Content: string(contentBytes),
CreatedBy: username,
UpdatedBy: username,
}
if err := bp.Add(rt.Ctx, username); err != nil {
reterr[bp.Name] = i18n.Sprintf(c.GetHeader("X-Language"), err.Error())
}
}
continue
}
dashboard := Board{}
if err := json.Unmarshal([]byte(lst[i].Content), &dashboard); err != nil {
reterr[lst[i].Name] = i18n.Sprintf(c.GetHeader("X-Language"), err.Error())
continue
}
if dashboard.UUID == 0 {
dashboard.UUID = time.Now().UnixNano()
}
bp := models.BuiltinPayload{
Type: lst[i].Type,
Component: lst[i].Component,
Cate: lst[i].Cate,
Name: dashboard.Name,
Tags: dashboard.Tags,
UUID: dashboard.UUID,
Content: lst[i].Content,
CreatedBy: username,
UpdatedBy: username,
}
if err := bp.Add(rt.Ctx, username); err != nil {
reterr[bp.Name] = i18n.Sprintf(c.GetHeader("X-Language"), err.Error())
}
} else {
if err := lst[i].Add(rt.Ctx, username); err != nil {
reterr[lst[i].Name] = i18n.Sprintf(c.GetHeader("X-Language"), err.Error())
}
if err := lst[i].Add(rt.Ctx, username); err != nil {
reterr[lst[i].Name] = err.Error()
}
}
ginx.NewRender(c).Data(reterr, nil)
@@ -173,18 +33,20 @@ func (rt *Router) builtinPayloadsGets(c *gin.Context) {
typ := ginx.QueryStr(c, "type", "")
component := ginx.QueryStr(c, "component", "")
cate := ginx.QueryStr(c, "cate", "")
query := ginx.QueryStr(c, "query", "")
name := ginx.QueryStr(c, "name", "")
limit := ginx.QueryInt(c, "limit", 20)
lst, err := models.BuiltinPayloadGets(rt.Ctx, typ, component, cate, query)
ginx.NewRender(c).Data(lst, err)
}
lst, err := models.BuiltinPayloadGets(rt.Ctx, typ, component, cate, name, limit, ginx.Offset(c, limit))
ginx.Dangerous(err)
m := make(map[string][]*models.BuiltinPayload)
for _, v := range lst {
if _, ok := m[v.Cate]; !ok {
m[v.Cate] = make([]*models.BuiltinPayload, 0)
}
m[v.Cate] = append(m[v.Cate], v)
}
func (rt *Router) builtinPayloadcatesGet(c *gin.Context) {
typ := ginx.QueryStr(c, "type", "")
component := ginx.QueryStr(c, "component", "")
cates, err := models.BuiltinPayloadCates(rt.Ctx, typ, component)
ginx.NewRender(c).Data(cates, err)
ginx.NewRender(c).Data(m, nil)
}
func (rt *Router) builtinPayloadGet(c *gin.Context) {
@@ -213,24 +75,6 @@ func (rt *Router) builtinPayloadsPut(c *gin.Context) {
return
}
if req.Type == "alert" {
alertRule := models.AlertRule{}
if err := json.Unmarshal([]byte(req.Content), &alertRule); err != nil {
ginx.Bomb(http.StatusBadRequest, err.Error())
}
req.Name = alertRule.Name
req.Tags = alertRule.AppendTags
} else if req.Type == "dashboard" {
dashboard := Board{}
if err := json.Unmarshal([]byte(req.Content), &dashboard); err != nil {
ginx.Bomb(http.StatusBadRequest, err.Error())
}
req.Name = dashboard.Name
req.Tags = dashboard.Tags
}
username := Username(c)
req.UpdatedBy = username

View File

@@ -262,15 +262,6 @@ func (rt *Router) loginCallback(c *gin.Context) {
user.FullSsoFields("oidc", ret.Username, ret.Nickname, ret.Phone, ret.Email, rt.Sso.OIDC.DefaultRoles)
// create user from oidc
ginx.Dangerous(user.Add(rt.Ctx))
if len(rt.Sso.OIDC.DefaultTeams) > 0 {
for _, gid := range rt.Sso.OIDC.DefaultTeams {
err = models.UserGroupMemberAdd(rt.Ctx, gid, user.Id)
if err != nil {
logger.Errorf("user:%v UserGroupMemberAdd: %s", user, err)
}
}
}
}
// set user login state

View File

@@ -35,7 +35,7 @@ func (rt *Router) alertMuteGetsByGids(c *gin.Context) {
ginx.Dangerous(err)
if len(gids) == 0 {
ginx.NewRender(c).Data([]int{}, nil)
ginx.Bomb(http.StatusForbidden, "forbidden")
return
}
}

View File

@@ -143,8 +143,6 @@ func (rt *Router) user() gin.HandlerFunc {
c.Set("user", user)
c.Set("isadmin", user.IsAdmin())
// Update user.LastActiveTime
rt.UserCache.SetLastActiveTime(user.Id, time.Now().Unix())
c.Next()
}
}

View File

@@ -34,7 +34,7 @@ func (rt *Router) recordingRuleGetsByGids(c *gin.Context) {
ginx.Dangerous(err)
if len(gids) == 0 {
ginx.NewRender(c).Data([]int{}, nil)
ginx.Bomb(http.StatusForbidden, "forbidden")
return
}
}

View File

@@ -153,242 +153,173 @@ func (rt *Router) targetGetTags(c *gin.Context) {
}
type targetTagsForm struct {
Idents []string `json:"idents" binding:"required_without=HostIps"`
HostIps []string `json:"host_ips" binding:"required_without=Idents"`
Tags []string `json:"tags" binding:"required"`
Idents []string `json:"idents" binding:"required"`
Tags []string `json:"tags" binding:"required"`
}
func (rt *Router) targetBindTagsByFE(c *gin.Context) {
var f targetTagsForm
var err error
var failedResults = make(map[string]string)
ginx.BindJSON(c, &f)
if len(f.Idents) == 0 && len(f.HostIps) == 0 {
ginx.Bomb(http.StatusBadRequest, "idents or host_ips must be provided")
}
// Acquire idents by idents and hostIps
failedResults, f.Idents, err = models.TargetsGetIdentsByIdentsAndHostIps(rt.Ctx, f.Idents, f.HostIps)
if err != nil {
ginx.Bomb(http.StatusBadRequest, err.Error())
if len(f.Idents) == 0 {
ginx.Bomb(http.StatusBadRequest, "idents empty")
}
rt.checkTargetPerm(c, f.Idents)
ginx.NewRender(c).Data(rt.targetBindTags(f, failedResults))
ginx.NewRender(c).Message(rt.targetBindTags(f))
}
func (rt *Router) targetBindTagsByService(c *gin.Context) {
var f targetTagsForm
var err error
var failedResults = make(map[string]string)
ginx.BindJSON(c, &f)
if len(f.Idents) == 0 && len(f.HostIps) == 0 {
ginx.Bomb(http.StatusBadRequest, "idents or host_ips must be provided")
}
// Acquire idents by idents and hostIps
failedResults, f.Idents, err = models.TargetsGetIdentsByIdentsAndHostIps(rt.Ctx, f.Idents, f.HostIps)
if err != nil {
ginx.Bomb(http.StatusBadRequest, err.Error())
if len(f.Idents) == 0 {
ginx.Bomb(http.StatusBadRequest, "idents empty")
}
ginx.NewRender(c).Data(rt.targetBindTags(f, failedResults))
ginx.NewRender(c).Message(rt.targetBindTags(f))
}
func (rt *Router) targetBindTags(f targetTagsForm, failedIdents map[string]string) (map[string]string, error) {
// 1. Check tags
if err := rt.validateTags(f.Tags); err != nil {
return nil, err
}
// 2. Acquire targets by idents
targets, err := models.TargetsGetByIdents(rt.Ctx, f.Idents)
if err != nil {
return nil, err
}
// 3. Add tags to targets
for _, target := range targets {
if err = rt.addTagsToTarget(target, f.Tags); err != nil {
failedIdents[target.Ident] = err.Error()
}
}
return failedIdents, nil
}
func (rt *Router) validateTags(tags []string) error {
for _, tag := range tags {
arr := strings.Split(tag, "=")
func (rt *Router) targetBindTags(f targetTagsForm) error {
for i := 0; i < len(f.Tags); i++ {
arr := strings.Split(f.Tags[i], "=")
if len(arr) != 2 {
return fmt.Errorf("invalid tag format: %s (expected format: key=value)", tag)
return fmt.Errorf("invalid tag(%s)", f.Tags[i])
}
key, value := strings.TrimSpace(arr[0]), strings.TrimSpace(arr[1])
if key == "" {
return fmt.Errorf("invalid tag: key is empty in tag %s", tag)
}
if value == "" {
return fmt.Errorf("invalid tag: value is empty in tag %s", tag)
if strings.TrimSpace(arr[0]) == "" || strings.TrimSpace(arr[1]) == "" {
return fmt.Errorf("invalid tag(%s)", f.Tags[i])
}
if strings.Contains(key, ".") {
return fmt.Errorf("invalid tag key: %s (key cannot contain '.')", key)
if strings.IndexByte(arr[0], '.') != -1 {
return fmt.Errorf("invalid tagkey(%s): cannot contains . ", arr[0])
}
if strings.Contains(key, "-") {
return fmt.Errorf("invalid tag key: %s (key cannot contain '-')", key)
if strings.IndexByte(arr[0], '-') != -1 {
return fmt.Errorf("invalid tagkey(%s): cannot contains -", arr[0])
}
if !model.LabelNameRE.MatchString(key) {
return fmt.Errorf("invalid tag key: %s "+
"(key must start with a letter or underscore, followed by letters, digits, or underscores)", key)
if !model.LabelNameRE.MatchString(arr[0]) {
return fmt.Errorf("invalid tagkey(%s)", arr[0])
}
}
for i := 0; i < len(f.Idents); i++ {
target, err := models.TargetGetByIdent(rt.Ctx, f.Idents[i])
if err != nil {
return err
}
if target == nil {
continue
}
// 不能有同key的标签否则附到时序数据上会产生覆盖让人困惑
for j := 0; j < len(f.Tags); j++ {
tagkey := strings.Split(f.Tags[j], "=")[0]
tagkeyPrefix := tagkey + "="
if strings.HasPrefix(target.Tags, tagkeyPrefix) {
return fmt.Errorf("duplicate tagkey(%s)", tagkey)
}
}
err = target.AddTags(rt.Ctx, f.Tags)
if err != nil {
return err
}
}
return nil
}
func (rt *Router) addTagsToTarget(target *models.Target, tags []string) error {
for _, tag := range tags {
tagKey := strings.Split(tag, "=")[0]
if strings.Contains(target.Tags, tagKey+"=") {
return fmt.Errorf("duplicate tagkey(%s)", tagKey)
}
}
return target.AddTags(rt.Ctx, tags)
}
func (rt *Router) targetUnbindTagsByFE(c *gin.Context) {
var f targetTagsForm
var err error
var failedResults = make(map[string]string)
ginx.BindJSON(c, &f)
if len(f.Idents) == 0 && len(f.HostIps) == 0 {
ginx.Bomb(http.StatusBadRequest, "idents or host_ips must be provided")
}
// Acquire idents by idents and hostIps
failedResults, f.Idents, err = models.TargetsGetIdentsByIdentsAndHostIps(rt.Ctx, f.Idents, f.HostIps)
if err != nil {
ginx.Bomb(http.StatusBadRequest, err.Error())
if len(f.Idents) == 0 {
ginx.Bomb(http.StatusBadRequest, "idents empty")
}
rt.checkTargetPerm(c, f.Idents)
ginx.NewRender(c).Data(rt.targetUnbindTags(f, failedResults))
ginx.NewRender(c).Message(rt.targetUnbindTags(f))
}
func (rt *Router) targetUnbindTagsByService(c *gin.Context) {
var f targetTagsForm
var err error
var failedResults = make(map[string]string)
ginx.BindJSON(c, &f)
if len(f.Idents) == 0 && len(f.HostIps) == 0 {
ginx.Bomb(http.StatusBadRequest, "idents or host_ips must be provided")
}
// Acquire idents by idents and hostIps
failedResults, f.Idents, err = models.TargetsGetIdentsByIdentsAndHostIps(rt.Ctx, f.Idents, f.HostIps)
if err != nil {
ginx.Bomb(http.StatusBadRequest, err.Error())
if len(f.Idents) == 0 {
ginx.Bomb(http.StatusBadRequest, "idents empty")
}
ginx.NewRender(c).Data(rt.targetUnbindTags(f, failedResults))
ginx.NewRender(c).Message(rt.targetUnbindTags(f))
}
func (rt *Router) targetUnbindTags(f targetTagsForm, failedIdents map[string]string) (map[string]string, error) {
// 1. Acquire targets by idents
targets, err := models.TargetsGetByIdents(rt.Ctx, f.Idents)
if err != nil {
return nil, err
}
// 2. Remove tags from targets
for _, target := range targets {
err = target.DelTags(rt.Ctx, f.Tags)
func (rt *Router) targetUnbindTags(f targetTagsForm) error {
for i := 0; i < len(f.Idents); i++ {
target, err := models.TargetGetByIdent(rt.Ctx, f.Idents[i])
if err != nil {
failedIdents[target.Ident] = err.Error()
return err
}
if target == nil {
continue
}
}
return failedIdents, nil
err = target.DelTags(rt.Ctx, f.Tags)
if err != nil {
return err
}
}
return nil
}
type targetNoteForm struct {
Idents []string `json:"idents" binding:"required_without=HostIps"`
HostIps []string `json:"host_ips" binding:"required_without=Idents"`
Note string `json:"note"`
Idents []string `json:"idents" binding:"required"`
Note string `json:"note"`
}
func (rt *Router) targetUpdateNote(c *gin.Context) {
var f targetNoteForm
var err error
var failedResults = make(map[string]string)
ginx.BindJSON(c, &f)
if len(f.Idents) == 0 && len(f.HostIps) == 0 {
ginx.Bomb(http.StatusBadRequest, "idents or host_ips must be provided")
}
// Acquire idents by idents and hostIps
failedResults, f.Idents, err = models.TargetsGetIdentsByIdentsAndHostIps(rt.Ctx, f.Idents, f.HostIps)
if err != nil {
ginx.Bomb(http.StatusBadRequest, err.Error())
if len(f.Idents) == 0 {
ginx.Bomb(http.StatusBadRequest, "idents empty")
}
rt.checkTargetPerm(c, f.Idents)
ginx.NewRender(c).Data(failedResults, models.TargetUpdateNote(rt.Ctx, f.Idents, f.Note))
ginx.NewRender(c).Message(models.TargetUpdateNote(rt.Ctx, f.Idents, f.Note))
}
func (rt *Router) targetUpdateNoteByService(c *gin.Context) {
var f targetNoteForm
var err error
var failedResults = make(map[string]string)
ginx.BindJSON(c, &f)
if len(f.Idents) == 0 && len(f.HostIps) == 0 {
ginx.Bomb(http.StatusBadRequest, "idents or host_ips must be provided")
if len(f.Idents) == 0 {
ginx.Bomb(http.StatusBadRequest, "idents empty")
}
// Acquire idents by idents and hostIps
failedResults, f.Idents, err = models.TargetsGetIdentsByIdentsAndHostIps(rt.Ctx, f.Idents, f.HostIps)
if err != nil {
ginx.Bomb(http.StatusBadRequest, err.Error())
}
ginx.NewRender(c).Data(failedResults, models.TargetUpdateNote(rt.Ctx, f.Idents, f.Note))
ginx.NewRender(c).Message(models.TargetUpdateNote(rt.Ctx, f.Idents, f.Note))
}
type targetBgidForm struct {
Idents []string `json:"idents" binding:"required_without=HostIps"`
HostIps []string `json:"host_ips" binding:"required_without=Idents"`
Bgid int64 `json:"bgid"`
Idents []string `json:"idents" binding:"required"`
Bgid int64 `json:"bgid"`
}
func (rt *Router) targetUpdateBgid(c *gin.Context) {
var f targetBgidForm
var err error
var failedResults = make(map[string]string)
ginx.BindJSON(c, &f)
if len(f.Idents) == 0 && len(f.HostIps) == 0 {
ginx.Bomb(http.StatusBadRequest, "idents or host_ips must be provided")
}
// Acquire idents by idents and hostIps
failedResults, f.Idents, err = models.TargetsGetIdentsByIdentsAndHostIps(rt.Ctx, f.Idents, f.HostIps)
if err != nil {
ginx.Bomb(http.StatusBadRequest, err.Error())
if len(f.Idents) == 0 {
ginx.Bomb(http.StatusBadRequest, "idents empty")
}
user := c.MustGet("user").(*models.User)
if user.IsAdmin() {
ginx.NewRender(c).Data(failedResults, models.TargetUpdateBgid(rt.Ctx, f.Idents, f.Bgid, false))
ginx.NewRender(c).Message(models.TargetUpdateBgid(rt.Ctx, f.Idents, f.Bgid, false))
return
}
@@ -430,69 +361,24 @@ func (rt *Router) targetUpdateBgid(c *gin.Context) {
ginx.Bomb(http.StatusBadRequest, "invalid bgid")
}
ginx.NewRender(c).Data(failedResults, models.TargetUpdateBgid(rt.Ctx, f.Idents, f.Bgid, false))
}
func (rt *Router) targetUpdateBgidByService(c *gin.Context) {
var f targetBgidForm
var err error
var failedResults = make(map[string]string)
ginx.BindJSON(c, &f)
if len(f.Idents) == 0 && len(f.HostIps) == 0 {
ginx.Bomb(http.StatusBadRequest, "idents or host_ips must be provided")
}
// Acquire idents by idents and hostIps
failedResults, f.Idents, err = models.TargetsGetIdentsByIdentsAndHostIps(rt.Ctx, f.Idents, f.HostIps)
if err != nil {
ginx.Bomb(http.StatusBadRequest, err.Error())
}
ginx.NewRender(c).Data(failedResults, models.TargetUpdateBgid(rt.Ctx, f.Idents, f.Bgid, false))
ginx.NewRender(c).Message(models.TargetUpdateBgid(rt.Ctx, f.Idents, f.Bgid, false))
}
type identsForm struct {
Idents []string `json:"idents" binding:"required_without=HostIps"`
HostIps []string `json:"host_ips" binding:"required_without=Idents"`
Idents []string `json:"idents" binding:"required"`
}
func (rt *Router) targetDel(c *gin.Context) {
var f identsForm
var err error
var failedResults = make(map[string]string)
ginx.BindJSON(c, &f)
if len(f.Idents) == 0 && len(f.HostIps) == 0 {
ginx.Bomb(http.StatusBadRequest, "idents or host_ips must be provided")
if len(f.Idents) == 0 {
ginx.Bomb(http.StatusBadRequest, "idents empty")
}
// Acquire idents by idents and hostIps
failedResults, f.Idents, err = models.TargetsGetIdentsByIdentsAndHostIps(rt.Ctx, f.Idents, f.HostIps)
if err != nil {
ginx.Bomb(http.StatusBadRequest, err.Error())
}
rt.checkTargetPerm(c, f.Idents)
ginx.NewRender(c).Data(failedResults, models.TargetDel(rt.Ctx, f.Idents))
}
func (rt *Router) targetDelByService(c *gin.Context) {
var f identsForm
var err error
var failedResults = make(map[string]string)
ginx.BindJSON(c, &f)
if len(f.Idents) == 0 && len(f.HostIps) == 0 {
ginx.Bomb(http.StatusBadRequest, "idents or host_ips must be provided")
}
// Acquire idents by idents and hostIps
failedResults, f.Idents, err = models.TargetsGetIdentsByIdentsAndHostIps(rt.Ctx, f.Idents, f.HostIps)
if err != nil {
ginx.Bomb(http.StatusBadRequest, err.Error())
}
ginx.NewRender(c).Data(failedResults, models.TargetDel(rt.Ctx, f.Idents))
ginx.NewRender(c).Message(models.TargetDel(rt.Ctx, f.Idents))
}
func (rt *Router) checkTargetPerm(c *gin.Context, idents []string) {

View File

@@ -1,6 +1,7 @@
package router
import (
"net/http"
"time"
"github.com/ccfos/nightingale/v6/alert/sender"
@@ -52,7 +53,7 @@ func (rt *Router) taskGetsByGids(c *gin.Context) {
ginx.Dangerous(err)
if len(gids) == 0 {
ginx.NewRender(c).Data([]int{}, nil)
ginx.Bomb(http.StatusForbidden, "forbidden")
return
}
}

View File

@@ -47,7 +47,7 @@ func (rt *Router) taskTplGetsByGids(c *gin.Context) {
ginx.Dangerous(err)
if len(gids) == 0 {
ginx.NewRender(c).Data([]int{}, nil)
ginx.Bomb(http.StatusForbidden, "forbidden")
return
}
}

View File

@@ -40,16 +40,13 @@ func (rt *Router) userFindAll(c *gin.Context) {
}
func (rt *Router) userGets(c *gin.Context) {
stime, etime := getTimeRange(c)
limit := ginx.QueryInt(c, "limit", 20)
query := ginx.QueryStr(c, "query", "")
order := ginx.QueryStr(c, "order", "username")
desc := ginx.QueryBool(c, "desc", false)
total, err := models.UserTotal(rt.Ctx, query, stime, etime)
total, err := models.UserTotal(rt.Ctx, query)
ginx.Dangerous(err)
list, err := models.UserGets(rt.Ctx, query, limit, ginx.Offset(c, limit), stime, etime, order, desc)
list, err := models.UserGets(rt.Ctx, query, limit, ginx.Offset(c, limit))
ginx.Dangerous(err)
user := c.MustGet("user").(*models.User)

View File

@@ -10,7 +10,6 @@ import (
"github.com/gin-gonic/gin"
"github.com/toolkits/pkg/ginx"
"github.com/toolkits/pkg/logger"
"github.com/toolkits/pkg/str"
)
func (rt *Router) checkBusiGroupPerm(c *gin.Context) {
@@ -32,36 +31,8 @@ func (rt *Router) userGroupGets(c *gin.Context) {
}
func (rt *Router) userGroupGetsByService(c *gin.Context) {
ids := str.IdsInt64(ginx.QueryStr(c, "ids", ""))
if len(ids) == 0 {
lst, err := models.UserGroupGetAll(rt.Ctx)
ginx.Dangerous(err)
for i := 0; i < len(lst); i++ {
ids, err := models.MemberIds(rt.Ctx, lst[i].Id)
ginx.Dangerous(err)
lst[i].Users, err = models.UserGetsByIds(rt.Ctx, ids)
ginx.Dangerous(err)
}
ginx.NewRender(c).Data(lst, err)
return
}
lst := make([]models.UserGroup, 0)
for _, id := range ids {
ug := UserGroup(rt.Ctx, id)
ids, err := models.MemberIds(rt.Ctx, ug.Id)
ginx.Dangerous(err)
ug.Users, err = models.UserGetsByIds(rt.Ctx, ids)
ginx.Dangerous(err)
lst = append(lst, *ug)
}
ginx.NewRender(c).Data(lst, nil)
lst, err := models.UserGroupGetAll(rt.Ctx)
ginx.NewRender(c).Data(lst, err)
}
// user group member get by service

View File

@@ -50,7 +50,7 @@ func Initialize(configDir string, cryptoKey string) (func(), error) {
syncStats := memsto.NewSyncStats()
targetCache := memsto.NewTargetCache(ctx, syncStats, redis)
targetCache := memsto.NewTargetCache(ctx, syncStats, nil)
busiGroupCache := memsto.NewBusiGroupCache(ctx, syncStats)
idents := idents.New(ctx, redis)
metas := metas.New(redis)

View File

@@ -55,6 +55,8 @@ Enable = true
user001 = "ccc26da7b9aba533cbb263a36c07dcc5"
[HTTP.JWTAuth]
# signing key
SigningKey = "5b94a0fd640fe2765af826acfe42d151"
# unit: min
AccessExpired = 1500
# unit: min

View File

@@ -55,6 +55,8 @@ Enable = true
user001 = "ccc26da7b9aba533cbb263a36c07dcc5"
[HTTP.JWTAuth]
# signing key
SigningKey = "5b94a0fd640fe2765af826acfe42d151"
# unit: min
AccessExpired = 1500
# unit: min

View File

@@ -55,6 +55,8 @@ Enable = true
user001 = "ccc26da7b9aba533cbb263a36c07dcc5"
[HTTP.JWTAuth]
# signing key
SigningKey = "5b94a0fd640fe2765af826acfe42d151"
# unit: min
AccessExpired = 1500
# unit: min

View File

@@ -10,7 +10,6 @@ CREATE TABLE users (
contacts varchar(1024),
maintainer boolean not null default false,
belong varchar(16) not null default '',
last_active_time bigint not null default 0,
create_at bigint not null default 0,
create_by varchar(64) not null default '',
update_at bigint not null default 0,
@@ -832,56 +831,4 @@ COMMENT ON COLUMN builtin_metrics.expression IS 'expression of metric';
COMMENT ON COLUMN builtin_metrics.created_at IS 'create time';
COMMENT ON COLUMN builtin_metrics.created_by IS 'creator';
COMMENT ON COLUMN builtin_metrics.updated_at IS 'update time';
COMMENT ON COLUMN builtin_metrics.updated_by IS 'updater';
CREATE TABLE metric_filter (
id BIGSERIAL PRIMARY KEY,
name VARCHAR(191) NOT NULL,
configs VARCHAR(4096) NOT NULL,
groups_perm TEXT,
create_at BIGINT NOT NULL DEFAULT 0,
create_by VARCHAR(191) NOT NULL DEFAULT '',
update_at BIGINT NOT NULL DEFAULT 0,
update_by VARCHAR(191) NOT NULL DEFAULT ''
);
CREATE INDEX idx_name ON metric_filter (name);
CREATE TABLE board_busigroup (
busi_group_id BIGINT NOT NULL DEFAULT 0,
board_id BIGINT NOT NULL DEFAULT 0,
PRIMARY KEY (busi_group_id, board_id)
);
CREATE TABLE builtin_components (
id BIGSERIAL PRIMARY KEY,
ident VARCHAR(191) NOT NULL,
logo VARCHAR(191) NOT NULL,
readme TEXT NOT NULL,
created_at BIGINT NOT NULL DEFAULT 0,
created_by VARCHAR(191) NOT NULL DEFAULT '',
updated_at BIGINT NOT NULL DEFAULT 0,
updated_by VARCHAR(191) NOT NULL DEFAULT ''
);
CREATE INDEX idx_ident ON builtin_components (ident);
CREATE TABLE builtin_payloads (
id BIGSERIAL PRIMARY KEY,
type VARCHAR(191) NOT NULL,
component VARCHAR(191) NOT NULL,
cate VARCHAR(191) NOT NULL,
name VARCHAR(191) NOT NULL,
tags VARCHAR(191) NOT NULL DEFAULT '',
content TEXT NOT NULL,
created_at BIGINT NOT NULL DEFAULT 0,
created_by VARCHAR(191) NOT NULL DEFAULT '',
updated_at BIGINT NOT NULL DEFAULT 0,
updated_by VARCHAR(191) NOT NULL DEFAULT ''
);
CREATE INDEX idx_component ON builtin_payloads (component);
CREATE INDEX idx_name ON builtin_payloads (name);
CREATE INDEX idx_cate ON builtin_payloads (cate);
CREATE INDEX idx_type ON builtin_payloads (type);
COMMENT ON COLUMN builtin_metrics.updated_by IS 'updater';

View File

@@ -55,6 +55,8 @@ Enable = true
user001 = "ccc26da7b9aba533cbb263a36c07dcc5"
[HTTP.JWTAuth]
# signing key
SigningKey = "5b94a0fd640fe2765af826acfe42d151"
# unit: min
AccessExpired = 1500
# unit: min

View File

@@ -16,7 +16,6 @@ CREATE TABLE `users` (
`contacts` varchar(1024) comment 'json e.g. {wecom:xx, dingtalk_robot_token:yy}',
`maintainer` tinyint(1) not null default 0,
`belong` varchar(16) not null default '' comment 'belong',
`last_active_time` bigint not null default 0,
`create_at` bigint not null default 0,
`create_by` varchar(64) not null default '',
`update_at` bigint not null default 0,
@@ -503,44 +502,6 @@ CREATE TABLE `alert_his_event` (
KEY (`trigger_time`, `group_id`)
) ENGINE=InnoDB DEFAULT CHARSET = utf8mb4;
CREATE TABLE `board_busigroup` (
`busi_group_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'busi group id',
`board_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'board id',
PRIMARY KEY (`busi_group_id`, `board_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `builtin_components` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '''unique identifier''',
`ident` varchar(191) NOT NULL COMMENT '''identifier of component''',
`logo` varchar(191) NOT NULL COMMENT '''logo of component''',
`readme` text NOT NULL COMMENT '''readme of component''',
`created_at` bigint(20) NOT NULL DEFAULT 0 COMMENT '''create time''',
`created_by` varchar(191) NOT NULL DEFAULT '' COMMENT '''creator''',
`updated_at` bigint(20) NOT NULL DEFAULT 0 COMMENT '''update time''',
`updated_by` varchar(191) NOT NULL DEFAULT '' COMMENT '''updater''',
PRIMARY KEY (`id`),
KEY `idx_ident` (`ident`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `builtin_payloads` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '''unique identifier''',
`type` varchar(191) NOT NULL COMMENT '''type of payload''',
`component` varchar(191) NOT NULL COMMENT '''component of payload''',
`cate` varchar(191) NOT NULL COMMENT '''category of payload''',
`name` varchar(191) NOT NULL COMMENT '''name of payload''',
`tags` varchar(191) NOT NULL DEFAULT '' COMMENT '''tags of payload''',
`content` longtext NOT NULL COMMENT '''content of payload''',
`created_at` bigint(20) NOT NULL DEFAULT 0 COMMENT '''create time''',
`created_by` varchar(191) NOT NULL DEFAULT '' COMMENT '''creator''',
`updated_at` bigint(20) NOT NULL DEFAULT 0 COMMENT '''update time''',
`updated_by` varchar(191) NOT NULL DEFAULT '' COMMENT '''updater''',
PRIMARY KEY (`id`),
KEY `idx_component` (`component`),
KEY `idx_name` (`name`),
KEY `idx_cate` (`cate`),
KEY `idx_type` (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `task_tpl`
(
`id` int unsigned NOT NULL AUTO_INCREMENT,

File diff suppressed because it is too large Load Diff

View File

@@ -31,47 +31,4 @@ CREATE TABLE `metric_filter` (
`update_by` varchar(191) NOT NULL DEFAULT '' COMMENT 'updater',
PRIMARY KEY (`id`),
KEY `idx_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `board_busigroup` (
`busi_group_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'busi group id',
`board_id` bigint(20) NOT NULL DEFAULT '0' COMMENT 'board id',
PRIMARY KEY (`busi_group_id`, `board_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/* v7.0.0-beta.6 */
CREATE TABLE `builtin_components` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '''unique identifier''',
`ident` varchar(191) NOT NULL COMMENT '''identifier of component''',
`logo` varchar(191) NOT NULL COMMENT '''logo of component''',
`readme` text NOT NULL COMMENT '''readme of component''',
`created_at` bigint(20) NOT NULL DEFAULT 0 COMMENT '''create time''',
`created_by` varchar(191) NOT NULL DEFAULT '' COMMENT '''creator''',
`updated_at` bigint(20) NOT NULL DEFAULT 0 COMMENT '''update time''',
`updated_by` varchar(191) NOT NULL DEFAULT '' COMMENT '''updater''',
PRIMARY KEY (`id`),
KEY `idx_ident` (`ident`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `builtin_payloads` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '''unique identifier''',
`type` varchar(191) NOT NULL COMMENT '''type of payload''',
`component` varchar(191) NOT NULL COMMENT '''component of payload''',
`cate` varchar(191) NOT NULL COMMENT '''category of payload''',
`name` varchar(191) NOT NULL COMMENT '''name of payload''',
`tags` varchar(191) NOT NULL DEFAULT '' COMMENT '''tags of payload''',
`content` longtext NOT NULL COMMENT '''content of payload''',
`created_at` bigint(20) NOT NULL DEFAULT 0 COMMENT '''create time''',
`created_by` varchar(191) NOT NULL DEFAULT '' COMMENT '''creator''',
`updated_at` bigint(20) NOT NULL DEFAULT 0 COMMENT '''update time''',
`updated_by` varchar(191) NOT NULL DEFAULT '' COMMENT '''updater''',
PRIMARY KEY (`id`),
KEY `idx_component` (`component`),
KEY `idx_name` (`name`),
KEY `idx_cate` (`cate`),
KEY `idx_type` (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/* v7.0.0-beta.7 */
ALTER TABLE users ADD COLUMN last_active_time BIGINT NOT NULL DEFAULT 0;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

View File

@@ -55,6 +55,8 @@ Enable = true
user001 = "ccc26da7b9aba533cbb263a36c07dcc5"
[HTTP.JWTAuth]
# signing key
SigningKey = "5b94a0fd640fe2765af826acfe42d151"
# unit: min
AccessExpired = 1500
# unit: min
@@ -75,11 +77,10 @@ OpenRSA = false
[DB]
# postgres: host=%s port=%s user=%s dbname=%s password=%s sslmode=%s
# postgres: DSN="host=127.0.0.1 port=5432 user=root dbname=n9e_v6 password=1234 sslmode=disable"
# sqlite: DSN="/path/to/filename.db"
DSN = "root:1234@tcp(127.0.0.1:3306)/n9e_v6?charset=utf8mb4&parseTime=True&loc=Local&allowNativePasswords=true"
DSN="root:1234@tcp(127.0.0.1:3306)/n9e_v6?charset=utf8mb4&parseTime=True&loc=Local&allowNativePasswords=true"
# enable debug mode or not
Debug = false
# mysql postgres sqlite
# mysql postgres
DBType = "mysql"
# unit: s
MaxLifetime = 7200

8
go.mod
View File

@@ -8,7 +8,7 @@ require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/expr-lang/expr v1.16.1
github.com/flashcatcloud/ibex v1.3.4
github.com/flashcatcloud/ibex v1.3.3
github.com/gin-contrib/pprof v1.4.0
github.com/gin-gonic/gin v1.9.1
github.com/go-ldap/ldap/v3 v3.4.4
@@ -33,14 +33,12 @@ require (
github.com/spaolacci/murmur3 v1.1.0
github.com/tidwall/gjson v1.14.0
github.com/toolkits/pkg v1.3.6
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1
golang.org/x/oauth2 v0.10.0
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
gopkg.in/yaml.v2 v2.4.0
gorm.io/driver/mysql v1.4.4
gorm.io/driver/postgres v1.4.5
gorm.io/driver/sqlite v1.5.5
gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde
gorm.io/gorm v1.24.2
)
require (
@@ -78,7 +76,6 @@ require (
github.com/josharian/intern v1.0.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/mattn/go-sqlite3 v1.14.17 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
@@ -93,6 +90,7 @@ require (
go.uber.org/automaxprocs v1.5.2 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect
golang.org/x/image v0.13.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sys v0.18.0 // indirect

12
go.sum
View File

@@ -47,8 +47,8 @@ github.com/fatih/camelcase v1.0.0 h1:hxNvNX/xYBp0ovncs8WyWZrOrpBNub/JfaMvbURyft8
github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc=
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/flashcatcloud/ibex v1.3.4 h1:s5MgQmDIYR18liBKPNl96kC/h1jOTZjIOlUWeSx0710=
github.com/flashcatcloud/ibex v1.3.4/go.mod h1:T8hbMUySK2q6cXUaYp0AUVeKkU9Od2LjzwmB5lmTRBM=
github.com/flashcatcloud/ibex v1.3.3 h1:1Bxk5sgpsq4+e9bMchucGttg8Sw4KEpZy9tctFfj/cE=
github.com/flashcatcloud/ibex v1.3.3/go.mod h1:T8hbMUySK2q6cXUaYp0AUVeKkU9Od2LjzwmB5lmTRBM=
github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
github.com/garyburd/redigo v1.6.2/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
@@ -209,8 +209,6 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM=
github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -466,11 +464,9 @@ gorm.io/driver/mysql v1.4.4 h1:MX0K9Qvy0Na4o7qSC/YI7XxqUw5KDw01umqgID+svdQ=
gorm.io/driver/mysql v1.4.4/go.mod h1:BCg8cKI+R0j/rZRQxeKis/forqRwRSYOR8OM3Wo6hOM=
gorm.io/driver/postgres v1.4.5 h1:mTeXTTtHAgnS9PgmhN2YeUbazYpLhUI1doLnw42XUZc=
gorm.io/driver/postgres v1.4.5/go.mod h1:GKNQYSJ14qvWkvPwXljMGehpKrhlDNsqYRr5HnYGncg=
gorm.io/driver/sqlite v1.5.5 h1:7MDMtUZhV065SilG62E0MquljeArQZNfJnjd9i9gx3E=
gorm.io/driver/sqlite v1.5.5/go.mod h1:6NgQ7sQWAIFsPrJJl1lSNSu2TABh0ZZ/zm5fosATavE=
gorm.io/gorm v1.23.8/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk=
gorm.io/gorm v1.24.1-0.20221019064659-5dd2bb482755/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA=
gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde h1:9DShaph9qhkIYw7QF91I/ynrr4cOO2PZra2PFD7Mfeg=
gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
gorm.io/gorm v1.24.2 h1:9wR6CFD+G8nOusLdvkZelOEhpJVwwHzpQOUM+REd6U0=
gorm.io/gorm v1.24.2/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,292 +1,280 @@
{
"id": 0,
"group_id": 0,
"name": "ARMS-DB",
"ident": "",
"tags": "ARMS",
"create_at": 0,
"create_by": "",
"update_at": 0,
"update_by": "",
"ident": "",
"configs": {
"version": "3.0.0",
"links": [],
"panels": [
{
"collapsed": true,
"id": "bd8c0aac-06df-4b2d-9456-cad8e7389499",
"layout": {
"h": 1,
"i": "bd8c0aac-06df-4b2d-9456-cad8e7389499",
"w": 24,
"x": 0,
"y": 0
},
"name": "概览(DB级别)",
"panels": [],
"type": "row",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "linear",
"lineWidth": 2,
"stack": "off",
"version": "3.0.0"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "8d2da301-e5e8-4b2f-9b31-59aa0835c312",
"layout": {
"h": 8,
"i": "8d2da301-e5e8-4b2f-9b31-59aa0835c312",
"w": 12,
"x": 0,
"y": 1
},
"links": [],
"maxPerRow": 4,
"name": "请求数/每分钟",
"options": {
"legend": {
"displayMode": "hidden"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum by (callType) (sum_over_time(arms_db_requests_count{endpoint=\"${instance}\",destId=~\"${db}\"}[1m]))",
"legend": "{{callType}}入口",
"refId": "B"
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "linear",
"lineWidth": 2,
"stack": "off",
"version": "3.0.0"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "ab2b0969-50e7-4e4b-962a-58be133e6aef",
"layout": {
"h": 8,
"i": "ab2b0969-50e7-4e4b-962a-58be133e6aef",
"w": 12,
"x": 12,
"y": 1
},
"links": [],
"maxPerRow": 4,
"name": "响应时间/每分钟",
"options": {
"legend": {
"displayMode": "hidden"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum by (callType) (sum_over_time(arms_db_requests_seconds{endpoint=\"$instance\",destId=~\"^$db$\"}[1m]))/sum by (callType) (sum_over_time(arms_db_requests_count{endpoint=\"$instance\",destId=~\"^$db$\"}[1m]))",
"legend": "{{callType}}入口",
"refId": "A"
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "linear",
"lineWidth": 2,
"stack": "off",
"version": "3.0.0"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "6bd5d219-0a94-4f90-b2e0-93ed3eeca9f0",
"layout": {
"h": 8,
"i": "6bd5d219-0a94-4f90-b2e0-93ed3eeca9f0",
"w": 12,
"x": 0,
"y": 9
},
"links": [],
"maxPerRow": 4,
"name": "错误数/每分钟",
"options": {
"legend": {
"displayMode": "hidden"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum by (callType) (sum_over_time(arms_db_requests_error_count{endpoint=\"$instance\",destId=~\"$db\"}[1m]))",
"legend": "{{callType}}入口",
"refId": "A"
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "linear",
"lineWidth": 2,
"stack": "off",
"version": "3.0.0"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"description": "针对所有SQL的聚和指标",
"id": "d9093b86-5796-471a-a28c-fe1d8daf1721",
"layout": {
"h": 8,
"i": "d9093b86-5796-471a-a28c-fe1d8daf1721",
"w": 12,
"x": 12,
"y": 9
},
"links": [],
"maxPerRow": 4,
"name": "性能一览/每分钟",
"options": {
"legend": {
"displayMode": "hidden"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(sum_over_time(arms_db_requests_count{endpoint=\"$instance\",destId=~\"$db\"}[1m]))",
"legend": "请求次数",
"refId": "A"
},
{
"expr": "sum(sum_over_time(arms_db_requests_seconds{endpoint=\"$instance\",destId=~\"$db\"}[1m]))/sum(sum_over_time(arms_db_requests_count{endpoint=\"$instance\",destId=~\"$db\"}[1m]))",
"legend": "平均耗时",
"refId": "B"
}
],
"type": "timeseries",
"version": "3.0.0"
}
],
"var": [
{
"definition": "prometheus",
"name": "datasource",
"type": "datasource"
"type": "datasource",
"definition": "prometheus"
},
{
"allOption": false,
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(arms_system_cpu_idle,service)",
"multi": false,
"type": "query",
"name": "service",
"reg": "",
"type": "query"
},
{
"definition": "label_values(arms_system_cpu_idle,service)",
"allOption": false,
"multi": false,
"reg": "",
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(arms_db_requests_count{service=\"$service\"},endpoint)",
"multi": false,
"name": "instance",
"reg": "",
"type": "query"
}
},
{
"allOption": true,
"allValue": ".*",
"type": "query",
"name": "instance",
"definition": "label_values(arms_db_requests_count{service=\"$service\"},endpoint)",
"allOption": false,
"multi": false,
"reg": "",
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(arms_db_requests_count{endpoint=\"${instance}\"},destId)",
"multi": false,
}
},
{
"type": "query",
"name": "db",
"definition": "label_values(arms_db_requests_count{endpoint=\"${instance}\"},destId)",
"allValue": ".*",
"allOption": true,
"multi": false,
"reg": "",
"type": "query"
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
}
}
],
"version": "3.0.0"
},
"public": 0,
"public_cate": 0,
"bgids": null,
"built_in": 0,
"hide": 0,
"uuid": 1717556327092680000
}
"panels": [
{
"version": "3.0.0",
"id": "bd8c0aac-06df-4b2d-9456-cad8e7389499",
"type": "row",
"name": "概览(DB级别)",
"collapsed": true,
"layout": {
"h": 1,
"w": 24,
"x": 0,
"y": 0,
"i": "bd8c0aac-06df-4b2d-9456-cad8e7389499"
},
"panels": []
},
{
"version": "3.0.0",
"id": "8d2da301-e5e8-4b2f-9b31-59aa0835c312",
"type": "timeseries",
"name": "请求数/每分钟",
"links": [],
"layout": {
"h": 8,
"w": 12,
"x": 0,
"y": 1,
"i": "8d2da301-e5e8-4b2f-9b31-59aa0835c312"
},
"targets": [
{
"refId": "B",
"expr": "sum by (callType) (sum_over_time(arms_db_requests_count{endpoint=\"${instance}\",destId=~\"${db}\"}[1m]))",
"legend": "{{callType}}入口"
}
],
"options": {
"tooltip": {
"mode": "all",
"sort": "none"
},
"legend": {
"displayMode": "hidden"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"value": null,
"type": "base"
}
]
}
},
"custom": {
"version": "3.0.0",
"drawStyle": "lines",
"lineInterpolation": "linear",
"fillOpacity": 0.3,
"stack": "off",
"lineWidth": 2,
"gradientMode": "opacity"
},
"maxPerRow": 4,
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"version": "3.0.0",
"id": "ab2b0969-50e7-4e4b-962a-58be133e6aef",
"type": "timeseries",
"name": "响应时间/每分钟",
"links": [],
"layout": {
"h": 8,
"w": 12,
"x": 12,
"y": 1,
"i": "ab2b0969-50e7-4e4b-962a-58be133e6aef"
},
"targets": [
{
"refId": "A",
"expr": "sum by (callType) (sum_over_time(arms_db_requests_seconds{endpoint=\"$instance\",destId=~\"^$db$\"}[1m]))/sum by (callType) (sum_over_time(arms_db_requests_count{endpoint=\"$instance\",destId=~\"^$db$\"}[1m]))",
"legend": "{{callType}}入口"
}
],
"options": {
"tooltip": {
"mode": "all",
"sort": "none"
},
"legend": {
"displayMode": "hidden"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"value": null,
"type": "base"
}
]
}
},
"custom": {
"version": "3.0.0",
"drawStyle": "lines",
"lineInterpolation": "linear",
"fillOpacity": 0.3,
"stack": "off",
"lineWidth": 2,
"gradientMode": "opacity"
},
"maxPerRow": 4,
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"version": "3.0.0",
"id": "6bd5d219-0a94-4f90-b2e0-93ed3eeca9f0",
"type": "timeseries",
"name": "错误数/每分钟",
"links": [],
"layout": {
"h": 8,
"w": 12,
"x": 0,
"y": 9,
"i": "6bd5d219-0a94-4f90-b2e0-93ed3eeca9f0"
},
"targets": [
{
"refId": "A",
"expr": "sum by (callType) (sum_over_time(arms_db_requests_error_count{endpoint=\"$instance\",destId=~\"$db\"}[1m]))",
"legend": "{{callType}}入口"
}
],
"options": {
"tooltip": {
"mode": "all",
"sort": "none"
},
"legend": {
"displayMode": "hidden"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"value": null,
"type": "base"
}
]
}
},
"custom": {
"version": "3.0.0",
"drawStyle": "lines",
"lineInterpolation": "linear",
"fillOpacity": 0.3,
"stack": "off",
"lineWidth": 2,
"gradientMode": "opacity"
},
"maxPerRow": 4,
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"version": "3.0.0",
"id": "d9093b86-5796-471a-a28c-fe1d8daf1721",
"type": "timeseries",
"name": "性能一览/每分钟",
"description": "针对所有SQL的聚和指标",
"links": [],
"layout": {
"h": 8,
"w": 12,
"x": 12,
"y": 9,
"i": "d9093b86-5796-471a-a28c-fe1d8daf1721"
},
"targets": [
{
"refId": "A",
"expr": "sum(sum_over_time(arms_db_requests_count{endpoint=\"$instance\",destId=~\"$db\"}[1m]))",
"legend": "请求次数"
},
{
"refId": "B",
"expr": "sum(sum_over_time(arms_db_requests_seconds{endpoint=\"$instance\",destId=~\"$db\"}[1m]))/sum(sum_over_time(arms_db_requests_count{endpoint=\"$instance\",destId=~\"$db\"}[1m]))",
"legend": "平均耗时"
}
],
"options": {
"tooltip": {
"mode": "all",
"sort": "none"
},
"legend": {
"displayMode": "hidden"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"value": null,
"type": "base"
}
]
}
},
"custom": {
"version": "3.0.0",
"drawStyle": "lines",
"lineInterpolation": "linear",
"fillOpacity": 0.3,
"stack": "off",
"lineWidth": 2,
"gradientMode": "opacity"
},
"maxPerRow": 4,
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
}
]
}
}

View File

@@ -1,13 +1,7 @@
{
"id": 0,
"group_id": 0,
"name": "阿里云 ARMS-JVM-SERVICE",
"ident": "",
"tags": "JVM ARMS",
"create_at": 0,
"create_by": "",
"update_at": 0,
"update_by": "",
"ident": "",
"configs": {
"panels": [
{
@@ -776,14 +770,14 @@
"type": "datasource"
},
{
"name": "service",
"label": "service",
"type": "query",
"datasource": {
"cate": "prometheus",
"value": "${prom}"
},
"definition": "label_values(arms_jvm_buffer_pool_count, service)",
"label": "service",
"name": "service",
"type": "query"
"definition": "label_values(arms_jvm_buffer_pool_count, service)"
},
{
"datasource": {
@@ -797,11 +791,5 @@
}
],
"version": "3.0.0"
},
"public": 0,
"public_cate": 0,
"bgids": null,
"built_in": 0,
"hide": 0,
"uuid": 1717556327094704000
}
}
}

View File

@@ -1,441 +1,429 @@
{
"id": 0,
"group_id": 0,
"name": "ARMS-Machine",
"ident": "",
"tags": "ARMS",
"create_at": 0,
"create_by": "",
"update_at": 0,
"update_by": "",
"ident": "",
"configs": {
"version": "3.0.0",
"links": [],
"panels": [
{
"collapsed": true,
"id": "8865eacb-f0f6-45fa-912a-8494907c48d6",
"layout": {
"h": 1,
"i": "8865eacb-f0f6-45fa-912a-8494907c48d6",
"w": 24,
"x": 0,
"y": 0
},
"name": "系统信息",
"panels": [],
"type": "row",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "linear",
"lineWidth": 2,
"stack": "off",
"version": "3.0.0"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "7fd3186b-6190-44c7-ad05-1c81993f27c9",
"layout": {
"h": 9,
"i": "7fd3186b-6190-44c7-ad05-1c81993f27c9",
"w": 24,
"x": 0,
"y": 1
},
"links": [],
"maxPerRow": 4,
"name": "CPU",
"options": {
"legend": {
"displayMode": "hidden"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "max(arms_system_cpu_system{host=~\"$host\"})",
"legend": "系统CPU使用率",
"refId": "A"
},
{
"expr": "max(arms_system_cpu_io_wait{host=~\"$host\"})",
"legend": "等待IO完成的CPU使用率",
"refId": "B"
},
{
"expr": "max(arms_system_cpu_user{host=~\"$host\"})",
"legend": "用户CPU使用率",
"refId": "C"
},
{
"expr": "max(arms_system_cpu_system{host=\"$host\"})+max(arms_system_cpu_io_wait{host=~\"$host\"})+max(arms_system_cpu_user{host=\"$host\"})",
"legend": "总和",
"refId": "D"
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "linear",
"lineWidth": 2,
"stack": "off",
"version": "3.0.0"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "60fc127b-b565-40de-9346-860062d5ea58",
"layout": {
"h": 9,
"i": "60fc127b-b565-40de-9346-860062d5ea58",
"w": 24,
"x": 0,
"y": 10
},
"links": [],
"maxPerRow": 4,
"name": "内存",
"options": {
"legend": {
"displayMode": "hidden"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "max(arms_system_mem_used_bytes{host=\"$host\"})",
"legend": "系统的已经使用的内存",
"refId": "A"
},
{
"expr": "max(arms_system_mem_total_bytes{host=\"$host\"})",
"legend": "总和",
"refId": "C"
},
{
"expr": "max(arms_system_mem_buffers_bytes{host=\"$host\"})",
"legend": "系统的BufferCache的内存数",
"refId": "D"
},
{
"expr": "max(arms_system_mem_cached_bytes{host=\"$host\"})",
"legend": "系统的PageCache里的内存数",
"refId": "E"
},
{
"expr": "max(arms_system_mem_free_bytes{host=\"$host\"})",
"legend": "系统的空闲内存",
"refId": "B"
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "linear",
"lineWidth": 2,
"stack": "off",
"version": "3.0.0"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "5229fd8c-3e26-44e6-a091-145c3caef46f",
"layout": {
"h": 9,
"i": "5229fd8c-3e26-44e6-a091-145c3caef46f",
"w": 24,
"x": 0,
"y": 19
},
"links": [],
"maxPerRow": 4,
"name": "负载",
"options": {
"legend": {
"displayMode": "hidden"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "max(arms_system_load{host=\"$host\"})",
"legend": "负载",
"refId": "A"
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "linear",
"lineWidth": 2,
"stack": "off",
"version": "3.0.0"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "60872e48-5445-4ee1-b0a2-19be72b6f737",
"layout": {
"h": 9,
"i": "60872e48-5445-4ee1-b0a2-19be72b6f737",
"w": 24,
"x": 0,
"y": 28
},
"links": [],
"maxPerRow": 4,
"name": "磁盘",
"options": {
"legend": {
"displayMode": "hidden"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "max(arms_system_disk_free_bytes{host=\"$host\"})",
"legend": "可用磁盘容量",
"refId": "A"
},
{
"expr": "max(arms_system_disk_total_bytes{host=\"$host\"})",
"legend": "总磁盘容量",
"refId": "B"
},
{
"expr": "max(arms_system_disk_total_bytes{host=~\"$host\"})-max(arms_system_disk_free_bytes{host=~\"$host\"})",
"legend": "已使用磁盘容量",
"refId": "C"
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "linear",
"lineWidth": 2,
"stack": "off",
"version": "3.0.0"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "517cc410-c4a0-4923-a902-3c102f06cd0c",
"layout": {
"h": 9,
"i": "517cc410-c4a0-4923-a902-3c102f06cd0c",
"w": 24,
"x": 0,
"y": 37
},
"links": [],
"maxPerRow": 4,
"name": "网络流量(Byte)/每分钟",
"options": {
"legend": {
"displayMode": "hidden"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "max(max_over_time(arms_system_net_in_bytes{host=~\"$host\"}[1m]))",
"legend": "网络接收的字节数",
"refId": "A"
},
{
"expr": "max(max_over_time(arms_system_net_out_bytes{host=~\"$host\"}[1m]))",
"legend": "网络发送的字节数",
"refId": "B"
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "linear",
"lineWidth": 2,
"stack": "off",
"version": "3.0.0"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "752d89ce-1136-4ddf-b4b9-1a232a8840db",
"layout": {
"h": 9,
"i": "752d89ce-1136-4ddf-b4b9-1a232a8840db",
"w": 24,
"x": 0,
"y": 46
},
"links": [],
"maxPerRow": 4,
"name": "网络数据包(个)/每分钟",
"options": {
"legend": {
"displayMode": "hidden"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "max(max_over_time(arms_system_net_in_packets{host=~\"$host\"}[1m]))",
"legend": "网络接收的报文数",
"refId": "A"
},
{
"expr": "max(max_over_time(arms_system_net_out_packets{host=~\"$host\"}[1m]))",
"legend": "网络发送的报文数",
"refId": "C"
},
{
"expr": "max(max_over_time(arms_system_net_in_errs{host=~\"$host\"}[1m]))",
"legend": "网络接收的错误数",
"refId": "D"
},
{
"expr": "max(max_over_time(arms_system_net_out_errs{host=~\"$host\"}[1m]))",
"legend": "网络丢弃报文数",
"refId": "E"
}
],
"type": "timeseries",
"version": "3.0.0"
}
],
"var": [
{
"definition": "prometheus",
"name": "datasource",
"type": "datasource"
"type": "datasource",
"definition": "prometheus"
},
{
"allOption": false,
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(arms_system_cpu_idle,service)",
"multi": false,
"type": "query",
"name": "service",
"reg": "",
"type": "query"
},
{
"definition": "label_values(arms_system_cpu_idle,service)",
"allOption": false,
"allValue": "*",
"multi": false,
"reg": "",
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(arms_system_cpu_idle{service=\"$service\"},host)",
"multi": false,
}
},
{
"type": "query",
"name": "host",
"definition": "label_values(arms_system_cpu_idle{service=\"$service\"},host)",
"allValue": "*",
"allOption": false,
"multi": false,
"reg": "",
"type": "query"
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
}
}
],
"version": "3.0.0"
},
"public": 0,
"public_cate": 0,
"bgids": null,
"built_in": 0,
"hide": 0,
"uuid": 1717556327098444000
}
"panels": [
{
"version": "3.0.0",
"id": "8865eacb-f0f6-45fa-912a-8494907c48d6",
"type": "row",
"name": "系统信息",
"collapsed": true,
"layout": {
"h": 1,
"w": 24,
"x": 0,
"y": 0,
"i": "8865eacb-f0f6-45fa-912a-8494907c48d6"
},
"panels": []
},
{
"version": "3.0.0",
"id": "7fd3186b-6190-44c7-ad05-1c81993f27c9",
"type": "timeseries",
"name": "CPU",
"links": [],
"layout": {
"h": 9,
"w": 24,
"x": 0,
"y": 1,
"i": "7fd3186b-6190-44c7-ad05-1c81993f27c9"
},
"targets": [
{
"refId": "A",
"expr": "max(arms_system_cpu_system{host=~\"$host\"})",
"legend": "系统CPU使用率"
},
{
"refId": "B",
"expr": "max(arms_system_cpu_io_wait{host=~\"$host\"})",
"legend": "等待IO完成的CPU使用率"
},
{
"refId": "C",
"expr": "max(arms_system_cpu_user{host=~\"$host\"})",
"legend": "用户CPU使用率"
},
{
"refId": "D",
"expr": "max(arms_system_cpu_system{host=\"$host\"})+max(arms_system_cpu_io_wait{host=~\"$host\"})+max(arms_system_cpu_user{host=\"$host\"})",
"legend": "总和"
}
],
"options": {
"tooltip": {
"mode": "all",
"sort": "none"
},
"legend": {
"displayMode": "hidden"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"value": null,
"type": "base"
}
]
}
},
"custom": {
"version": "3.0.0",
"drawStyle": "lines",
"lineInterpolation": "linear",
"fillOpacity": 0.3,
"stack": "off",
"lineWidth": 2,
"gradientMode": "opacity"
},
"maxPerRow": 4,
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"version": "3.0.0",
"id": "60fc127b-b565-40de-9346-860062d5ea58",
"type": "timeseries",
"name": "内存",
"links": [],
"layout": {
"h": 9,
"w": 24,
"x": 0,
"y": 10,
"i": "60fc127b-b565-40de-9346-860062d5ea58"
},
"targets": [
{
"refId": "A",
"expr": "max(arms_system_mem_used_bytes{host=\"$host\"})",
"legend": "系统的已经使用的内存"
},
{
"refId": "C",
"expr": "max(arms_system_mem_total_bytes{host=\"$host\"})",
"legend": "总和"
},
{
"refId": "D",
"expr": "max(arms_system_mem_buffers_bytes{host=\"$host\"})",
"legend": "系统的BufferCache的内存数"
},
{
"refId": "E",
"expr": "max(arms_system_mem_cached_bytes{host=\"$host\"})",
"legend": "系统的PageCache里的内存数"
},
{
"refId": "B",
"expr": "max(arms_system_mem_free_bytes{host=\"$host\"})",
"legend": "系统的空闲内存"
}
],
"options": {
"tooltip": {
"mode": "all",
"sort": "none"
},
"legend": {
"displayMode": "hidden"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"value": null,
"type": "base"
}
]
}
},
"custom": {
"version": "3.0.0",
"drawStyle": "lines",
"lineInterpolation": "linear",
"fillOpacity": 0.3,
"stack": "off",
"lineWidth": 2,
"gradientMode": "opacity"
},
"maxPerRow": 4,
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"version": "3.0.0",
"id": "5229fd8c-3e26-44e6-a091-145c3caef46f",
"type": "timeseries",
"name": "负载",
"links": [],
"layout": {
"h": 9,
"w": 24,
"x": 0,
"y": 19,
"i": "5229fd8c-3e26-44e6-a091-145c3caef46f"
},
"targets": [
{
"refId": "A",
"expr": "max(arms_system_load{host=\"$host\"})",
"legend": "负载"
}
],
"options": {
"tooltip": {
"mode": "all",
"sort": "none"
},
"legend": {
"displayMode": "hidden"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"value": null,
"type": "base"
}
]
}
},
"custom": {
"version": "3.0.0",
"drawStyle": "lines",
"lineInterpolation": "linear",
"fillOpacity": 0.3,
"stack": "off",
"lineWidth": 2,
"gradientMode": "opacity"
},
"maxPerRow": 4,
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"version": "3.0.0",
"id": "60872e48-5445-4ee1-b0a2-19be72b6f737",
"type": "timeseries",
"name": "磁盘",
"links": [],
"layout": {
"h": 9,
"w": 24,
"x": 0,
"y": 28,
"i": "60872e48-5445-4ee1-b0a2-19be72b6f737"
},
"targets": [
{
"refId": "A",
"expr": "max(arms_system_disk_free_bytes{host=\"$host\"})",
"legend": "可用磁盘容量"
},
{
"refId": "B",
"expr": "max(arms_system_disk_total_bytes{host=\"$host\"})",
"legend": "总磁盘容量"
},
{
"refId": "C",
"expr": "max(arms_system_disk_total_bytes{host=~\"$host\"})-max(arms_system_disk_free_bytes{host=~\"$host\"})",
"legend": "已使用磁盘容量"
}
],
"options": {
"tooltip": {
"mode": "all",
"sort": "none"
},
"legend": {
"displayMode": "hidden"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"value": null,
"type": "base"
}
]
}
},
"custom": {
"version": "3.0.0",
"drawStyle": "lines",
"lineInterpolation": "linear",
"fillOpacity": 0.3,
"stack": "off",
"lineWidth": 2,
"gradientMode": "opacity"
},
"maxPerRow": 4,
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"version": "3.0.0",
"id": "517cc410-c4a0-4923-a902-3c102f06cd0c",
"type": "timeseries",
"name": "网络流量(Byte)/每分钟",
"links": [],
"layout": {
"h": 9,
"w": 24,
"x": 0,
"y": 37,
"i": "517cc410-c4a0-4923-a902-3c102f06cd0c"
},
"targets": [
{
"refId": "A",
"expr": "max(max_over_time(arms_system_net_in_bytes{host=~\"$host\"}[1m]))",
"legend": "网络接收的字节数"
},
{
"refId": "B",
"expr": "max(max_over_time(arms_system_net_out_bytes{host=~\"$host\"}[1m]))",
"legend": "网络发送的字节数"
}
],
"options": {
"tooltip": {
"mode": "all",
"sort": "none"
},
"legend": {
"displayMode": "hidden"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"value": null,
"type": "base"
}
]
}
},
"custom": {
"version": "3.0.0",
"drawStyle": "lines",
"lineInterpolation": "linear",
"fillOpacity": 0.3,
"stack": "off",
"lineWidth": 2,
"gradientMode": "opacity"
},
"maxPerRow": 4,
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"version": "3.0.0",
"id": "752d89ce-1136-4ddf-b4b9-1a232a8840db",
"type": "timeseries",
"name": "网络数据包(个)/每分钟",
"links": [],
"layout": {
"h": 9,
"w": 24,
"x": 0,
"y": 46,
"i": "752d89ce-1136-4ddf-b4b9-1a232a8840db"
},
"targets": [
{
"refId": "A",
"expr": "max(max_over_time(arms_system_net_in_packets{host=~\"$host\"}[1m]))",
"legend": "网络接收的报文数"
},
{
"refId": "C",
"expr": "max(max_over_time(arms_system_net_out_packets{host=~\"$host\"}[1m]))",
"legend": "网络发送的报文数"
},
{
"refId": "D",
"expr": "max(max_over_time(arms_system_net_in_errs{host=~\"$host\"}[1m]))",
"legend": "网络接收的错误数"
},
{
"refId": "E",
"expr": "max(max_over_time(arms_system_net_out_errs{host=~\"$host\"}[1m]))",
"legend": "网络丢弃报文数"
}
],
"options": {
"tooltip": {
"mode": "all",
"sort": "none"
},
"legend": {
"displayMode": "hidden"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"value": null,
"type": "base"
}
]
}
},
"custom": {
"version": "3.0.0",
"drawStyle": "lines",
"lineInterpolation": "linear",
"fillOpacity": 0.3,
"stack": "off",
"lineWidth": 2,
"gradientMode": "opacity"
},
"maxPerRow": 4,
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
}
]
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,364 +1,352 @@
{
"id": 0,
"group_id": 0,
"name": "阿里云CDN",
"ident": "",
"tags": "CDN",
"create_at": 0,
"create_by": "",
"update_at": 0,
"update_by": "",
"configs": {
"panels": [
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": true,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "0430c7e9-7372-45e3-9bb2-c5939baf6bfa",
"layout": {
"h": 4,
"i": "0430c7e9-7372-45e3-9bb2-c5939baf6bfa",
"isResizable": true,
"w": 8,
"x": 0,
"y": 0
},
"maxPerRow": 4,
"name": "网络带宽(bits/s)",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "aliyun_acs_cdn_bps_isp_value{instance_id=\"$instance_id\"}",
"legend": "峰值 {{instance_id}",
"refId": "A"
},
{
"expr": "aliyun_acs_cdn_internet_out_average{instance_id=\"$instance_id\"}",
"legend": "均值 {{instance_id}}",
"refId": "B"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "b438ae81-3dfc-4ed8-b66f-262a4b507e4b",
"layout": {
"h": 4,
"i": "b438ae81-3dfc-4ed8-b66f-262a4b507e4b",
"isResizable": true,
"w": 8,
"x": 8,
"y": 0
},
"maxPerRow": 4,
"name": "下行流量(bytes)",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "aliyun_acs_cdn_internet_out_isp_value{instance_id=\"$instance_id\"}",
"legend": "{{instance_id}}",
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "af0874c7-3123-437a-93bc-448f6de8b43b",
"layout": {
"h": 4,
"i": "c6e41c04-d591-4117-bdf1-5dc6e1f4c084",
"isResizable": true,
"w": 8,
"x": 16,
"y": 0
},
"maxPerRow": 4,
"name": "每秒访问次数(个)",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "aliyun_acs_cdn_qps_isp_value{instance_id=\"$instance_id\"}",
"legend": "{{instance_id}}",
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": true,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "ec8fcf96-1691-4e45-9a5f-2f183021b434",
"layout": {
"h": 4,
"i": "ec8fcf96-1691-4e45-9a5f-2f183021b434",
"isResizable": true,
"w": 8,
"x": 0,
"y": 4
},
"maxPerRow": 4,
"name": "边缘状态码4XX占比(%)",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "aliyun_acs_cdn_code4xx_isp_value{instance_id=\"$instance_id\"}",
"legend": "峰值{{instance_id}}",
"refId": "A"
},
{
"expr": "aliyun_acs_cdn_bps_average{instance_id=\"$instance_id\"}",
"legend": "均值 {{instance_id}}",
"refId": "B"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": true,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "25b6e3fa-f6dd-4452-8025-3c7d9a9a592c",
"layout": {
"h": 4,
"i": "e884b781-1bd4-476c-a807-a68a6417764e",
"isResizable": true,
"w": 8,
"x": 8,
"y": 4
},
"maxPerRow": 4,
"name": "边缘状态码5XX占比(%)",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "aliyun_acs_cdn_code5xx_isp_value{instance_id=\"$instance_id\"}",
"legend": "峰值{{instance_id}}",
"refId": "A"
},
{
"expr": "aliyun_acs_cdn_bps_average{instance_id=\"$instance_id\"}",
"legend": "均值 {{instance_id}}",
"refId": "B"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
}
"name": "阿里云CDN",
"tags": "CDN",
"ident": "",
"configs": {
"var": [
{
"name": "datasource",
"label": "datasource",
"type": "datasource",
"definition": "prometheus"
},
{
"name": "instance_id",
"label": "instance_id",
"type": "query",
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(aliyun_acs_cdn_qps_isp_value, instance_id)"
}
],
"panels": [
{
"type": "timeseries",
"id": "0430c7e9-7372-45e3-9bb2-c5939baf6bfa",
"layout": {
"h": 4,
"w": 8,
"x": 0,
"y": 0,
"i": "0430c7e9-7372-45e3-9bb2-c5939baf6bfa",
"isResizable": true
},
"version": "3.0.0",
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"targets": [
{
"refId": "A",
"expr": "aliyun_acs_cdn_bps_isp_value{instance_id=\"$instance_id\"}",
"legend": "峰值 {{instance_id}"
},
{
"expr": "aliyun_acs_cdn_internet_out_average{instance_id=\"$instance_id\"}",
"refId": "B",
"legend": "均值 {{instance_id}}"
}
],
"var": [
{
"definition": "prometheus",
"label": "datasource",
"name": "datasource",
"type": "datasource"
},
{
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(aliyun_acs_cdn_qps_isp_value, instance_id)",
"label": "instance_id",
"name": "instance_id",
"type": "query"
}
"transformations": [
{
"id": "organize",
"options": {}
}
],
"version": "3.0.0"
},
"public": 0,
"public_cate": 0,
"bgids": null,
"built_in": 0,
"hide": 0,
"uuid": 1717556327104499000
}
"name": "网络带宽(bits/s)",
"maxPerRow": 4,
"options": {
"tooltip": {
"mode": "all",
"sort": "none"
},
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"value": null,
"type": "base"
}
]
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"spanNulls": true,
"lineWidth": 2,
"fillOpacity": 0.3,
"gradientMode": "opacity",
"stack": "off",
"scaleDistribution": {
"type": "linear"
}
}
},
{
"type": "timeseries",
"id": "b438ae81-3dfc-4ed8-b66f-262a4b507e4b",
"layout": {
"h": 4,
"w": 8,
"x": 8,
"y": 0,
"i": "b438ae81-3dfc-4ed8-b66f-262a4b507e4b",
"isResizable": true
},
"version": "3.0.0",
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"targets": [
{
"refId": "A",
"expr": "aliyun_acs_cdn_internet_out_isp_value{instance_id=\"$instance_id\"}",
"legend": "{{instance_id}}"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"name": "下行流量(bytes)",
"maxPerRow": 4,
"options": {
"tooltip": {
"mode": "all",
"sort": "none"
},
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"value": null,
"type": "base"
}
]
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"spanNulls": false,
"lineWidth": 2,
"fillOpacity": 0.3,
"gradientMode": "opacity",
"stack": "off",
"scaleDistribution": {
"type": "linear"
}
}
},
{
"type": "timeseries",
"id": "af0874c7-3123-437a-93bc-448f6de8b43b",
"layout": {
"h": 4,
"w": 8,
"x": 16,
"y": 0,
"i": "c6e41c04-d591-4117-bdf1-5dc6e1f4c084",
"isResizable": true
},
"version": "3.0.0",
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"targets": [
{
"refId": "A",
"expr": "aliyun_acs_cdn_qps_isp_value{instance_id=\"$instance_id\"}",
"legend": "{{instance_id}}"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"name": "每秒访问次数(个)",
"maxPerRow": 4,
"options": {
"tooltip": {
"mode": "all",
"sort": "none"
},
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"value": null,
"type": "base"
}
]
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"spanNulls": false,
"lineWidth": 2,
"fillOpacity": 0.3,
"gradientMode": "opacity",
"stack": "off",
"scaleDistribution": {
"type": "linear"
}
}
},
{
"type": "timeseries",
"id": "ec8fcf96-1691-4e45-9a5f-2f183021b434",
"layout": {
"h": 4,
"w": 8,
"x": 0,
"y": 4,
"i": "ec8fcf96-1691-4e45-9a5f-2f183021b434",
"isResizable": true
},
"version": "3.0.0",
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"targets": [
{
"refId": "A",
"expr": "aliyun_acs_cdn_code4xx_isp_value{instance_id=\"$instance_id\"}",
"legend": "峰值{{instance_id}}"
},
{
"expr": "aliyun_acs_cdn_bps_average{instance_id=\"$instance_id\"}",
"refId": "B",
"legend": "均值 {{instance_id}}"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"name": "边缘状态码4XX占比(%)",
"maxPerRow": 4,
"options": {
"tooltip": {
"mode": "all",
"sort": "none"
},
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"value": null,
"type": "base"
}
]
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"spanNulls": true,
"lineWidth": 2,
"fillOpacity": 0.3,
"gradientMode": "opacity",
"stack": "off",
"scaleDistribution": {
"type": "linear"
}
}
},
{
"type": "timeseries",
"id": "25b6e3fa-f6dd-4452-8025-3c7d9a9a592c",
"layout": {
"h": 4,
"w": 8,
"x": 8,
"y": 4,
"i": "e884b781-1bd4-476c-a807-a68a6417764e",
"isResizable": true
},
"version": "3.0.0",
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"targets": [
{
"refId": "A",
"expr": "aliyun_acs_cdn_code5xx_isp_value{instance_id=\"$instance_id\"}",
"legend": "峰值{{instance_id}}"
},
{
"expr": "aliyun_acs_cdn_bps_average{instance_id=\"$instance_id\"}",
"refId": "B",
"legend": "均值 {{instance_id}}"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"name": "边缘状态码5XX占比(%)",
"maxPerRow": 4,
"options": {
"tooltip": {
"mode": "all",
"sort": "none"
},
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"value": null,
"type": "base"
}
]
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"spanNulls": true,
"lineWidth": 2,
"fillOpacity": 0.3,
"gradientMode": "opacity",
"stack": "off",
"scaleDistribution": {
"type": "linear"
}
}
}
],
"version": "3.0.0"
}
}

View File

@@ -1,336 +1,324 @@
{
"id": 0,
"group_id": 0,
"name": "阿里云ECS",
"ident": "",
"tags": "",
"create_at": 0,
"create_by": "",
"update_at": 0,
"update_by": "",
"configs": {
"panels": [
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceName": "Default",
"datasourceValue": "${datasource}",
"id": "8606d5ad-c3c7-4b1d-86bf-474d3302ee17",
"layout": {
"h": 4,
"i": "8606d5ad-c3c7-4b1d-86bf-474d3302ee17",
"isResizable": true,
"w": 12,
"x": 0,
"y": 0
},
"maxPerRow": 4,
"name": "CPU平均使用率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_ecs_dashboard_cpu_utilization_average{ident=~\"$ident\"}) by (ident,instance_id)",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceName": "Default",
"datasourceValue": "${datasource}",
"id": "c7034fe3-5521-4867-a8bd-429767cc03a2",
"layout": {
"h": 4,
"i": "55404296-0bd9-409d-aeaf-e9c7cceea0dd",
"isResizable": true,
"w": 12,
"x": 12,
"y": 0
},
"maxPerRow": 4,
"name": "内存平均使用率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_ecs_dashboard_memory_usedutilization_average{ident=~\"$ident\"}) by (ident,instance_id)",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceName": "Default",
"datasourceValue": "${datasource}",
"id": "e4c11925-b359-4edb-9269-4bdd4d230224",
"layout": {
"h": 4,
"i": "0c7b3a5a-ef12-4349-be9b-7a245bf01418",
"isResizable": true,
"w": 12,
"x": 0,
"y": 4
},
"maxPerRow": 4,
"name": "系统负载[5m]",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_ecs_dashboard_load_5m_average{ident=~\"$ident\"}) by (ident,instance_id)",
"legend": "{{ident}} {{instance_id}} 5分钟负载",
"refId": "B"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceName": "Default",
"datasourceValue": "${datasource}",
"id": "388d4da6-eb1f-48f1-955d-37579809dfec",
"layout": {
"h": 4,
"i": "5abea3d2-ea82-4bdb-a4f0-4dd1316c0377",
"isResizable": true,
"w": 12,
"x": 12,
"y": 5
},
"maxPerRow": 4,
"name": "磁盘平均使用率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_ecs_dashboard_diskusage_utilization_average{ident=~\"$ident\"}) by (ident,instance_id)",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "f8d19cc9-0168-4c13-b9a9-c7980eced974",
"layout": {
"h": 4,
"i": "f8d19cc9-0168-4c13-b9a9-c7980eced974",
"w": 12,
"x": 0,
"y": 9
},
"maxPerRow": 4,
"name": "网络流量",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "bitsSI"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_ecs_dashboard_intranet_in_average{ident=~\"$ident\"}) by (ident,instance_id)",
"legend": "主机:{{ident}} 实例ID: {{instance_id}} 入流量",
"refId": "A",
"step": 300,
"time": {
"end": "now",
"start": "now-5m"
}
},
{
"expr": "sum(aliyun_acs_ecs_dashboard_intranet_out_average{ident=~\"$ident\"}) by (ident,instance_id)",
"legend": "主机:{{ident}} 实例ID: {{instance_id}} 出流量",
"refId": "B",
"step": 300,
"time": {
"end": "now",
"start": "now-5m"
}
}
],
"type": "timeseries",
"version": "2.0.0"
}
"name": "阿里云ECS",
"tags": "",
"ident": "",
"configs": {
"panels": [
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceName": "Default",
"id": "8606d5ad-c3c7-4b1d-86bf-474d3302ee17",
"layout": {
"h": 4,
"i": "8606d5ad-c3c7-4b1d-86bf-474d3302ee17",
"isResizable": true,
"w": 12,
"x": 0,
"y": 0
},
"maxPerRow": 4,
"name": "CPU平均使用率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_ecs_dashboard_cpu_utilization_average{ident=~\"$ident\"}) by (ident,instance_id)",
"refId": "A"
}
],
"var": [
{
"definition": "prometheus",
"name": "datasource",
"type": "datasource"
},
{
"allOption": true,
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(aliyun_acs_ecs_dashboard_cpu_utilization_average,ident)",
"multi": true,
"name": "ident",
"type": "query"
}
"type": "timeseries",
"version": "2.0.0",
"datasourceValue": "${datasource}"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceName": "Default",
"id": "c7034fe3-5521-4867-a8bd-429767cc03a2",
"layout": {
"h": 4,
"i": "55404296-0bd9-409d-aeaf-e9c7cceea0dd",
"isResizable": true,
"w": 12,
"x": 12,
"y": 0
},
"maxPerRow": 4,
"name": "内存平均使用率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_ecs_dashboard_memory_usedutilization_average{ident=~\"$ident\"}) by (ident,instance_id)",
"refId": "A"
}
],
"version": "3.0.0"
},
"public": 0,
"public_cate": 0,
"bgids": null,
"built_in": 0,
"hide": 0,
"uuid": 1717556327106006000
}
"type": "timeseries",
"version": "2.0.0",
"datasourceValue": "${datasource}"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceName": "Default",
"id": "e4c11925-b359-4edb-9269-4bdd4d230224",
"layout": {
"h": 4,
"i": "0c7b3a5a-ef12-4349-be9b-7a245bf01418",
"isResizable": true,
"w": 12,
"x": 0,
"y": 4
},
"maxPerRow": 4,
"name": "系统负载[5m]",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_ecs_dashboard_load_5m_average{ident=~\"$ident\"}) by (ident,instance_id)",
"legend": "{{ident}} {{instance_id}} 5分钟负载",
"refId": "B"
}
],
"type": "timeseries",
"version": "2.0.0",
"datasourceValue": "${datasource}"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceName": "Default",
"id": "388d4da6-eb1f-48f1-955d-37579809dfec",
"layout": {
"h": 4,
"i": "5abea3d2-ea82-4bdb-a4f0-4dd1316c0377",
"isResizable": true,
"w": 12,
"x": 12,
"y": 5
},
"maxPerRow": 4,
"name": "磁盘平均使用率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_ecs_dashboard_diskusage_utilization_average{ident=~\"$ident\"}) by (ident,instance_id)",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0",
"datasourceValue": "${datasource}"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"id": "f8d19cc9-0168-4c13-b9a9-c7980eced974",
"layout": {
"h": 4,
"i": "f8d19cc9-0168-4c13-b9a9-c7980eced974",
"w": 12,
"x": 0,
"y": 9
},
"maxPerRow": 4,
"name": "网络流量",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "bitsSI"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_ecs_dashboard_intranet_in_average{ident=~\"$ident\"}) by (ident,instance_id)",
"legend": "主机:{{ident}} 实例ID: {{instance_id}} 入流量",
"refId": "A",
"step": 300,
"time": {
"end": "now",
"start": "now-5m"
}
},
{
"expr": "sum(aliyun_acs_ecs_dashboard_intranet_out_average{ident=~\"$ident\"}) by (ident,instance_id)",
"legend": "主机:{{ident}} 实例ID: {{instance_id}} 出流量",
"refId": "B",
"step": 300,
"time": {
"end": "now",
"start": "now-5m"
}
}
],
"type": "timeseries",
"version": "2.0.0",
"datasourceValue": "${datasource}"
}
],
"var": [
{
"name": "datasource",
"type": "datasource",
"definition": "prometheus"
},
{
"allOption": true,
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(aliyun_acs_ecs_dashboard_cpu_utilization_average,ident)",
"multi": true,
"name": "ident",
"type": "query"
}
],
"version": "3.0.0"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,486 +1,474 @@
{
"id": 0,
"group_id": 0,
"name": "MSE监控大盘",
"ident": "MSE-Monitor",
"tags": "",
"create_at": 0,
"create_by": "",
"update_at": 0,
"update_by": "",
"configs": {
"panels": [
{
"custom": {
"calc": "lastNotNull",
"colSpan": 1,
"colorMode": "value",
"graphMode": "none",
"textMode": "valueAndName",
"textSize": {},
"valueField": "Value"
},
"datasourceCate": "prometheus",
"datasourceValue": 7,
"id": "aba69dc0-5a11-4bcd-add9-335b5a677bee",
"layout": {
"h": 5,
"i": "aba69dc0-5a11-4bcd-add9-335b5a677bee",
"isResizable": true,
"w": 6,
"x": 0,
"y": 0
},
"maxPerRow": 4,
"name": "PV一分钟",
"options": {
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
}
},
"targets": [
{
"expr": "sum(delta(envoy_http_rq_total{envoy_clusterid=\"$envoy_clusterid\"}[1m]))",
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "stat",
"version": "3.0.0"
},
{
"custom": {
"calc": "lastNotNull",
"detailName": "详情",
"legengPosition": "right"
},
"datasourceCate": "prometheus",
"datasourceValue": 7,
"id": "e34a272e-6125-4afa-a2c1-80d7d9078673",
"layout": {
"h": 5,
"i": "116a5607-5860-426e-a560-d3241da88b57",
"isResizable": true,
"w": 9,
"x": 6,
"y": 0
},
"maxPerRow": 4,
"name": "请求成功率",
"options": {
"standardOptions": {
"decimals": 0,
"util": "percentUnit"
}
},
"targets": [
{
"expr": "sum(delta(envoy_http_downstream_rq{envoy_clusterid=\"$envoy_clusterid\"}[3m])) by (response_code_class)",
"legend": "",
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "pie",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": 7,
"id": "a8917108-58a6-479a-8ec4-571f1b5a79c2",
"layout": {
"h": 5,
"i": "9be66a1f-c0bb-47dc-a3c0-ad43b588789b",
"isResizable": true,
"w": 9,
"x": 15,
"y": 0
},
"maxPerRow": 4,
"name": "请求量(一分钟)",
"options": {
"legend": {
"displayMode": "list"
},
"standardOptions": {
"util": "bytesSI"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(delta(envoy_http_downstream_cx_rx_bytes_total{envoy_clusterid=\"$envoy_clusterid\"}[1m]))",
"legend": "",
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": 7,
"id": "1b102bee-ccc9-49a0-a1d1-cc097bb6a987",
"layout": {
"h": 6,
"i": "1b102bee-ccc9-49a0-a1d1-cc097bb6a987",
"isResizable": true,
"w": 8,
"x": 0,
"y": 5
},
"maxPerRow": 4,
"name": "平均延迟",
"options": {
"legend": {
"displayMode": "list"
},
"standardOptions": {
"util": "milliseconds"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(rate(envoy_http_downstream_rq_time_sum{envoy_clusterid=\"$envoy_clusterid\"}[10m])) / sum(rate(envoy_http_downstream_rq_time_count{envoy_clusterid=\"$envoy_clusterid\"}[10m]))",
"legend": "",
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": 7,
"id": "b432fc11-2f9d-4b72-826b-6ca787401859",
"layout": {
"h": 6,
"i": "ea4c1073-07d3-4adc-a4d3-4812cc55ad7c",
"isResizable": true,
"w": 8,
"x": 8,
"y": 5
},
"maxPerRow": 4,
"name": "P95",
"options": {
"legend": {
"displayMode": "list"
},
"standardOptions": {
"util": "milliseconds"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "histogram_quantile(0.95, sum(rate(envoy_http_downstream_rq_time_bucket{envoy_clusterid=\"$envoy_clusterid\"}[10m])) by (le, service))",
"legend": "",
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": 7,
"id": "9062d707-d8a7-4a93-82e5-46f6059e8d70",
"layout": {
"h": 6,
"i": "d36246b9-4a9c-4ab0-9171-c5ac330be0ca",
"isResizable": true,
"w": 8,
"x": 16,
"y": 5
},
"maxPerRow": 4,
"name": "QPS",
"options": {
"legend": {
"displayMode": "list"
},
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(irate(envoy_http_downstream_rq{envoy_clusterid=\"$envoy_clusterid\"}[2m]))",
"legend": "",
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"baseColor": "#9470FF",
"calc": "lastNotNull",
"serieWidth": 40,
"sortOrder": "desc"
},
"datasourceCate": "prometheus",
"datasourceValue": 7,
"id": "c3f64cfd-adb2-4316-bb84-55f88ed513a3",
"layout": {
"h": 6,
"i": "807c34f9-bd61-4da3-ad88-41bb3e045605",
"isResizable": true,
"w": 24,
"x": 0,
"y": 11
},
"maxPerRow": 4,
"name": "Top Service Request",
"options": {
"standardOptions": {}
},
"targets": [
{
"expr": "label_replace(label_replace(topk(10, sum(delta(envoy_cluster_upstream_rq_total{envoy_clusterid=\"$envoy_clusterid\", cluster_name=~\"outbound_([0-9]+)_(.*)_(.*).svc.cluster.local$\", cluster_name!~\".*waf-proxy.static\", cluster_name!~\"outbound_([0-9]+)_(.*)_kubernetes.default.svc.cluster.local\", cluster_name!~\"outbound_([0-9]+)_(.*)_(.*).kube-system.svc.cluster.local\", cluster_name!~\"outbound_([0-9]+)_(.*)_(.*).arms-prom.svc.cluster.local\"}[1m])) by (cluster_name)), \"service_name\", \"$3\", \"cluster_name\", \"outbound_([0-9]+)_(.*)_(.*).svc.cluster.local$\"), \"port\", \"$1\", \"cluster_name\", \"outbound_([0-9]+)_(.*)_(.*).svc.cluster.local$\")",
"legend": "{{service_name}}:{{port}}",
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "barGauge",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": 7,
"id": "8df57678-ff19-4b63-b768-4dad3f12222b",
"layout": {
"h": 5,
"i": "44f413ba-3262-4ccf-a4b1-c1165bafaaff",
"isResizable": true,
"w": 24,
"x": 0,
"y": 17
},
"maxPerRow": 4,
"name": "Top Service RT",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "milliseconds"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "label_replace(label_replace(avg(delta(envoy_cluster_upstream_rq_time_sum{envoy_clusterid=\"$envoy_clusterid\", cluster_name=~\"outbound_([0-9]+)_(.*)_(.*)$\"}[3m])) by (cluster_name) / avg(delta(envoy_cluster_upstream_rq_time_count{envoy_clusterid=\"$envoy_clusterid\", cluster_name=~\"outbound_([0-9]+)_(.*)_(.*)$\"}[1m])) by (cluster_name), \"service_name\", \"$3\", \"cluster_name\", \"outbound_([0-9]+)_(.*)_(.*)$\"), \"port\", \"$1\", \"cluster_name\", \"outbound_([0-9]+)_(.*)_(.*)$\")",
"legend": "{{service_name}}:{{port}}",
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
}
"name": "MSE监控大盘",
"tags": "",
"ident": "MSE-Monitor",
"configs": {
"var": [
{
"name": "datasource",
"type": "datasource",
"definition": "prometheus"
},
{
"name": "envoy_clusterid",
"label": "envoy_clusterid",
"type": "query",
"hide": false,
"definition": "label_values(envoy_cluster_bind_errors, envoy_clusterid)",
"multi": false,
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
}
}
],
"panels": [
{
"type": "stat",
"id": "aba69dc0-5a11-4bcd-add9-335b5a677bee",
"layout": {
"h": 5,
"w": 6,
"x": 0,
"y": 0,
"i": "aba69dc0-5a11-4bcd-add9-335b5a677bee",
"isResizable": true
},
"version": "3.0.0",
"datasourceCate": "prometheus",
"datasourceValue": 7,
"targets": [
{
"refId": "A",
"expr": "sum(delta(envoy_http_rq_total{envoy_clusterid=\"$envoy_clusterid\"}[1m]))"
}
],
"var": [
{
"definition": "prometheus",
"name": "datasource",
"type": "datasource"
},
{
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(envoy_cluster_bind_errors, envoy_clusterid)",
"hide": false,
"label": "envoy_clusterid",
"multi": false,
"name": "envoy_clusterid",
"type": "query"
}
"transformations": [
{
"id": "organize",
"options": {}
}
],
"version": "3.0.0"
},
"public": 0,
"public_cate": 0,
"bgids": null,
"built_in": 0,
"hide": 0,
"uuid": 1717556327111860000
}
"name": "PV一分钟",
"maxPerRow": 4,
"custom": {
"textMode": "valueAndName",
"graphMode": "none",
"colorMode": "value",
"calc": "lastNotNull",
"valueField": "Value",
"colSpan": 1,
"textSize": {}
},
"options": {
"thresholds": {
"steps": [
{
"color": "#634CD9",
"value": null,
"type": "base"
}
]
},
"standardOptions": {}
}
},
{
"type": "pie",
"id": "e34a272e-6125-4afa-a2c1-80d7d9078673",
"layout": {
"h": 5,
"w": 9,
"x": 6,
"y": 0,
"i": "116a5607-5860-426e-a560-d3241da88b57",
"isResizable": true
},
"version": "3.0.0",
"datasourceCate": "prometheus",
"datasourceValue": 7,
"targets": [
{
"refId": "A",
"expr": "sum(delta(envoy_http_downstream_rq{envoy_clusterid=\"$envoy_clusterid\"}[3m])) by (response_code_class)",
"legend": ""
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"name": "请求成功率",
"maxPerRow": 4,
"custom": {
"calc": "lastNotNull",
"legengPosition": "right",
"detailName": "详情"
},
"options": {
"standardOptions": {
"util": "percentUnit",
"decimals": 0
}
}
},
{
"type": "timeseries",
"id": "a8917108-58a6-479a-8ec4-571f1b5a79c2",
"layout": {
"h": 5,
"w": 9,
"x": 15,
"y": 0,
"i": "9be66a1f-c0bb-47dc-a3c0-ad43b588789b",
"isResizable": true
},
"version": "3.0.0",
"datasourceCate": "prometheus",
"datasourceValue": 7,
"targets": [
{
"refId": "A",
"expr": "sum(delta(envoy_http_downstream_cx_rx_bytes_total{envoy_clusterid=\"$envoy_clusterid\"}[1m]))",
"legend": ""
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"name": "请求量(一分钟)",
"maxPerRow": 4,
"options": {
"tooltip": {
"mode": "all",
"sort": "none"
},
"legend": {
"displayMode": "list"
},
"standardOptions": {
"util": "bytesSI"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"value": null,
"type": "base"
}
]
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"spanNulls": false,
"lineWidth": 2,
"fillOpacity": 0.3,
"gradientMode": "opacity",
"stack": "off",
"scaleDistribution": {
"type": "linear"
}
}
},
{
"type": "timeseries",
"id": "1b102bee-ccc9-49a0-a1d1-cc097bb6a987",
"layout": {
"h": 6,
"w": 8,
"x": 0,
"y": 5,
"i": "1b102bee-ccc9-49a0-a1d1-cc097bb6a987",
"isResizable": true
},
"version": "3.0.0",
"datasourceCate": "prometheus",
"datasourceValue": 7,
"targets": [
{
"refId": "A",
"expr": "sum(rate(envoy_http_downstream_rq_time_sum{envoy_clusterid=\"$envoy_clusterid\"}[10m])) / sum(rate(envoy_http_downstream_rq_time_count{envoy_clusterid=\"$envoy_clusterid\"}[10m]))",
"legend": ""
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"name": "平均延迟",
"maxPerRow": 4,
"options": {
"tooltip": {
"mode": "all",
"sort": "none"
},
"legend": {
"displayMode": "list"
},
"standardOptions": {
"util": "milliseconds"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"value": null,
"type": "base"
}
]
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"spanNulls": false,
"lineWidth": 2,
"fillOpacity": 0.3,
"gradientMode": "opacity",
"stack": "off",
"scaleDistribution": {
"type": "linear"
}
}
},
{
"type": "timeseries",
"id": "b432fc11-2f9d-4b72-826b-6ca787401859",
"layout": {
"h": 6,
"w": 8,
"x": 8,
"y": 5,
"i": "ea4c1073-07d3-4adc-a4d3-4812cc55ad7c",
"isResizable": true
},
"version": "3.0.0",
"datasourceCate": "prometheus",
"datasourceValue": 7,
"targets": [
{
"refId": "A",
"expr": "histogram_quantile(0.95, sum(rate(envoy_http_downstream_rq_time_bucket{envoy_clusterid=\"$envoy_clusterid\"}[10m])) by (le, service))",
"legend": ""
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"name": "P95",
"maxPerRow": 4,
"options": {
"tooltip": {
"mode": "all",
"sort": "none"
},
"legend": {
"displayMode": "list"
},
"standardOptions": {
"util": "milliseconds"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"value": null,
"type": "base"
}
]
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"spanNulls": false,
"lineWidth": 2,
"fillOpacity": 0.3,
"gradientMode": "opacity",
"stack": "off",
"scaleDistribution": {
"type": "linear"
}
}
},
{
"type": "timeseries",
"id": "9062d707-d8a7-4a93-82e5-46f6059e8d70",
"layout": {
"h": 6,
"w": 8,
"x": 16,
"y": 5,
"i": "d36246b9-4a9c-4ab0-9171-c5ac330be0ca",
"isResizable": true
},
"version": "3.0.0",
"datasourceCate": "prometheus",
"datasourceValue": 7,
"targets": [
{
"refId": "A",
"expr": "sum(irate(envoy_http_downstream_rq{envoy_clusterid=\"$envoy_clusterid\"}[2m]))",
"legend": ""
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"name": "QPS",
"maxPerRow": 4,
"options": {
"tooltip": {
"mode": "all",
"sort": "none"
},
"legend": {
"displayMode": "list"
},
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"value": null,
"type": "base"
}
]
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"spanNulls": false,
"lineWidth": 2,
"fillOpacity": 0.3,
"gradientMode": "opacity",
"stack": "off",
"scaleDistribution": {
"type": "linear"
}
}
},
{
"type": "barGauge",
"id": "c3f64cfd-adb2-4316-bb84-55f88ed513a3",
"layout": {
"h": 6,
"w": 24,
"x": 0,
"y": 11,
"i": "807c34f9-bd61-4da3-ad88-41bb3e045605",
"isResizable": true
},
"version": "3.0.0",
"datasourceCate": "prometheus",
"datasourceValue": 7,
"targets": [
{
"refId": "A",
"expr": "label_replace(label_replace(topk(10, sum(delta(envoy_cluster_upstream_rq_total{envoy_clusterid=\"$envoy_clusterid\", cluster_name=~\"outbound_([0-9]+)_(.*)_(.*).svc.cluster.local$\", cluster_name!~\".*waf-proxy.static\", cluster_name!~\"outbound_([0-9]+)_(.*)_kubernetes.default.svc.cluster.local\", cluster_name!~\"outbound_([0-9]+)_(.*)_(.*).kube-system.svc.cluster.local\", cluster_name!~\"outbound_([0-9]+)_(.*)_(.*).arms-prom.svc.cluster.local\"}[1m])) by (cluster_name)), \"service_name\", \"$3\", \"cluster_name\", \"outbound_([0-9]+)_(.*)_(.*).svc.cluster.local$\"), \"port\", \"$1\", \"cluster_name\", \"outbound_([0-9]+)_(.*)_(.*).svc.cluster.local$\")",
"legend": "{{service_name}}:{{port}}"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"name": "Top Service Request",
"maxPerRow": 4,
"custom": {
"calc": "lastNotNull",
"baseColor": "#9470FF",
"serieWidth": 40,
"sortOrder": "desc"
},
"options": {
"standardOptions": {}
}
},
{
"type": "timeseries",
"id": "8df57678-ff19-4b63-b768-4dad3f12222b",
"layout": {
"h": 5,
"w": 24,
"x": 0,
"y": 17,
"i": "44f413ba-3262-4ccf-a4b1-c1165bafaaff",
"isResizable": true
},
"version": "3.0.0",
"datasourceCate": "prometheus",
"datasourceValue": 7,
"targets": [
{
"refId": "A",
"expr": "label_replace(label_replace(avg(delta(envoy_cluster_upstream_rq_time_sum{envoy_clusterid=\"$envoy_clusterid\", cluster_name=~\"outbound_([0-9]+)_(.*)_(.*)$\"}[3m])) by (cluster_name) / avg(delta(envoy_cluster_upstream_rq_time_count{envoy_clusterid=\"$envoy_clusterid\", cluster_name=~\"outbound_([0-9]+)_(.*)_(.*)$\"}[1m])) by (cluster_name), \"service_name\", \"$3\", \"cluster_name\", \"outbound_([0-9]+)_(.*)_(.*)$\"), \"port\", \"$1\", \"cluster_name\", \"outbound_([0-9]+)_(.*)_(.*)$\")",
"legend": "{{service_name}}:{{port}}"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"name": "Top Service RT",
"maxPerRow": 4,
"options": {
"tooltip": {
"mode": "all",
"sort": "none"
},
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "milliseconds"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"value": null,
"type": "base"
}
]
}
},
"custom": {
"drawStyle": "lines",
"lineInterpolation": "smooth",
"spanNulls": false,
"lineWidth": 2,
"fillOpacity": 0.3,
"gradientMode": "opacity",
"stack": "off",
"scaleDistribution": {
"type": "linear"
}
}
}
],
"version": "3.0.0"
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,346 +1,334 @@
{
"id": 0,
"group_id": 0,
"name": "阿里云RDS",
"ident": "",
"tags": "",
"create_at": 0,
"create_by": "",
"update_at": 0,
"update_by": "",
"configs": {
"panels": [
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "01f4d444-aa2d-466d-9615-c76baf60a40c",
"layout": {
"h": 4,
"i": "01f4d444-aa2d-466d-9615-c76baf60a40c",
"isResizable": true,
"w": 12,
"x": 0,
"y": 0
},
"maxPerRow": 4,
"name": "CPU平均使用率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_rds_dashboard_cpu_usage_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "c43eb882-915f-4c38-a0b5-8f33c21ab44a",
"layout": {
"h": 4,
"i": "09903231-6557-42be-9cf3-2873878e9bf2",
"isResizable": true,
"w": 12,
"x": 12,
"y": 0
},
"maxPerRow": 4,
"name": "内存平均使用率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_rds_dashboard_memory_usage_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "37447883-ad79-46bc-888a-1be2835c1c64",
"layout": {
"h": 4,
"i": "378a5a26-c28e-4612-af09-f82ec2e11d80",
"isResizable": true,
"w": 12,
"x": 0,
"y": 4
},
"maxPerRow": 4,
"name": "磁盘平均使用率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_rds_dashboard_disk_usage_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "c9735607-3f24-44a7-bbf1-3ad39441c5c9",
"layout": {
"h": 4,
"i": "93a4c8a6-ac23-4e26-8a38-781ec1668820",
"isResizable": true,
"w": 12,
"x": 12,
"y": 4
},
"maxPerRow": 4,
"name": "IOPS平均使用率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_rds_dashboard_iops_usage_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "b516e7dc-8022-409d-b907-18c4143df891",
"layout": {
"h": 5,
"i": "b516e7dc-8022-409d-b907-18c4143df891",
"isResizable": true,
"w": 24,
"x": 0,
"y": 8
},
"maxPerRow": 4,
"name": "SQL执行量",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_rds_dashboard_my_sql_com_delete_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "delete",
"refId": "A"
},
{
"expr": "sum(aliyun_acs_rds_dashboard_my_sql_com_insert_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "insert",
"refId": "B"
},
{
"expr": "sum(aliyun_acs_rds_dashboard_my_sql_com_insert_select_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "insert_select",
"refId": "C"
},
{
"expr": "sum(aliyun_acs_rds_dashboard_my_sql_com_update_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "update",
"refId": "D"
},
{
"expr": "sum(aliyun_acs_rds_dashboard_my_sql_com_select_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "select",
"refId": "E"
}
],
"type": "timeseries",
"version": "2.0.0"
}
"name": "阿里云RDS",
"tags": "",
"ident": "",
"configs": {
"panels": [
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "01f4d444-aa2d-466d-9615-c76baf60a40c",
"layout": {
"h": 4,
"i": "01f4d444-aa2d-466d-9615-c76baf60a40c",
"isResizable": true,
"w": 12,
"x": 0,
"y": 0
},
"maxPerRow": 4,
"name": "CPU平均使用率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_rds_dashboard_cpu_usage_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "",
"refId": "A"
}
],
"var": [
{
"definition": "prometheus",
"name": "datasource",
"type": "datasource"
},
{
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(aliyun_acs_rds_dashboard_cpu_usage_average,name)",
"multi": false,
"name": "name",
"type": "query"
},
{
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(aliyun_acs_rds_dashboard_cpu_usage_average{name=\"$name\"},instance_id)",
"multi": false,
"name": "instance_id",
"type": "query"
}
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "c43eb882-915f-4c38-a0b5-8f33c21ab44a",
"layout": {
"h": 4,
"i": "09903231-6557-42be-9cf3-2873878e9bf2",
"isResizable": true,
"w": 12,
"x": 12,
"y": 0
},
"maxPerRow": 4,
"name": "内存平均使用率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_rds_dashboard_memory_usage_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "",
"refId": "A"
}
],
"version": "3.0.0"
},
"public": 0,
"public_cate": 0,
"bgids": null,
"built_in": 0,
"hide": 0,
"uuid": 1717556327125143000
}
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "37447883-ad79-46bc-888a-1be2835c1c64",
"layout": {
"h": 4,
"i": "378a5a26-c28e-4612-af09-f82ec2e11d80",
"isResizable": true,
"w": 12,
"x": 0,
"y": 4
},
"maxPerRow": 4,
"name": "磁盘平均使用率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_rds_dashboard_disk_usage_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "c9735607-3f24-44a7-bbf1-3ad39441c5c9",
"layout": {
"h": 4,
"i": "93a4c8a6-ac23-4e26-8a38-781ec1668820",
"isResizable": true,
"w": 12,
"x": 12,
"y": 4
},
"maxPerRow": 4,
"name": "IOPS平均使用率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_rds_dashboard_iops_usage_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "b516e7dc-8022-409d-b907-18c4143df891",
"layout": {
"h": 5,
"i": "b516e7dc-8022-409d-b907-18c4143df891",
"isResizable": true,
"w": 24,
"x": 0,
"y": 8
},
"maxPerRow": 4,
"name": "SQL执行量",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_rds_dashboard_my_sql_com_delete_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "delete",
"refId": "A"
},
{
"expr": "sum(aliyun_acs_rds_dashboard_my_sql_com_insert_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "insert",
"refId": "B"
},
{
"expr": "sum(aliyun_acs_rds_dashboard_my_sql_com_insert_select_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "insert_select",
"refId": "C"
},
{
"expr": "sum(aliyun_acs_rds_dashboard_my_sql_com_update_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "update",
"refId": "D"
},
{
"expr": "sum(aliyun_acs_rds_dashboard_my_sql_com_select_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "select",
"refId": "E"
}
],
"type": "timeseries",
"version": "2.0.0"
}
],
"var": [
{
"name": "datasource",
"type": "datasource",
"definition": "prometheus"
},
{
"name": "name",
"type": "query",
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(aliyun_acs_rds_dashboard_cpu_usage_average,name)",
"multi": false
},
{
"name": "instance_id",
"type": "query",
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(aliyun_acs_rds_dashboard_cpu_usage_average{name=\"$name\"},instance_id)",
"multi": false
}
],
"version": "3.0.0"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,331 +1,319 @@
{
"id": 0,
"group_id": 0,
"name": "阿里云REDIS",
"ident": "",
"tags": "",
"create_at": 0,
"create_by": "",
"update_at": 0,
"update_by": "",
"configs": {
"panels": [
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "01f4d444-aa2d-466d-9615-c76baf60a40c",
"layout": {
"h": 4,
"i": "01f4d444-aa2d-466d-9615-c76baf60a40c",
"isResizable": true,
"w": 12,
"x": 0,
"y": 0
},
"maxPerRow": 4,
"name": "CPU平均使用率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_kvstore_cpu_usage_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "c43eb882-915f-4c38-a0b5-8f33c21ab44a",
"layout": {
"h": 4,
"i": "09903231-6557-42be-9cf3-2873878e9bf2",
"isResizable": true,
"w": 12,
"x": 12,
"y": 0
},
"maxPerRow": 4,
"name": "内存平均使用率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_kvstore_memory_usage_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "37447883-ad79-46bc-888a-1be2835c1c64",
"layout": {
"h": 4,
"i": "378a5a26-c28e-4612-af09-f82ec2e11d80",
"isResizable": true,
"w": 12,
"x": 0,
"y": 4
},
"maxPerRow": 4,
"name": "连接数平均使用率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_kvstore_connection_usage_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "c9735607-3f24-44a7-bbf1-3ad39441c5c9",
"layout": {
"h": 4,
"i": "93a4c8a6-ac23-4e26-8a38-781ec1668820",
"isResizable": true,
"w": 12,
"x": 12,
"y": 4
},
"maxPerRow": 4,
"name": "失败统计平均使用率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_kvstore_failed_count_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "b516e7dc-8022-409d-b907-18c4143df891",
"layout": {
"h": 5,
"i": "b516e7dc-8022-409d-b907-18c4143df891",
"isResizable": true,
"w": 24,
"x": 0,
"y": 8
},
"maxPerRow": 4,
"name": "网络流量",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "bitsSI"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_kvstore_intranet_in_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "in",
"refId": "A"
},
{
"expr": "sum(aliyun_acs_kvstore_intranet_out_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "out",
"refId": "B"
}
],
"type": "timeseries",
"version": "2.0.0"
}
"name": "阿里云REDIS",
"tags": "",
"ident": "",
"configs": {
"panels": [
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "01f4d444-aa2d-466d-9615-c76baf60a40c",
"layout": {
"h": 4,
"i": "01f4d444-aa2d-466d-9615-c76baf60a40c",
"isResizable": true,
"w": 12,
"x": 0,
"y": 0
},
"maxPerRow": 4,
"name": "CPU平均使用率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_kvstore_cpu_usage_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "",
"refId": "A"
}
],
"var": [
{
"definition": "prometheus",
"name": "datasource",
"type": "datasource"
},
{
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(aliyun_acs_kvstore_cpu_usage_average,name)",
"multi": false,
"name": "name",
"type": "query"
},
{
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(aliyun_acs_kvstore_cpu_usage_average{name=\"$name\"},instance_id)",
"multi": false,
"name": "instance_id",
"type": "query"
}
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "c43eb882-915f-4c38-a0b5-8f33c21ab44a",
"layout": {
"h": 4,
"i": "09903231-6557-42be-9cf3-2873878e9bf2",
"isResizable": true,
"w": 12,
"x": 12,
"y": 0
},
"maxPerRow": 4,
"name": "内存平均使用率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_kvstore_memory_usage_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "",
"refId": "A"
}
],
"version": "3.0.0"
},
"public": 0,
"public_cate": 0,
"bgids": null,
"built_in": 0,
"hide": 0,
"uuid": 1717556327128561000
}
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "37447883-ad79-46bc-888a-1be2835c1c64",
"layout": {
"h": 4,
"i": "378a5a26-c28e-4612-af09-f82ec2e11d80",
"isResizable": true,
"w": 12,
"x": 0,
"y": 4
},
"maxPerRow": 4,
"name": "连接数平均使用率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_kvstore_connection_usage_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "c9735607-3f24-44a7-bbf1-3ad39441c5c9",
"layout": {
"h": 4,
"i": "93a4c8a6-ac23-4e26-8a38-781ec1668820",
"isResizable": true,
"w": 12,
"x": 12,
"y": 4
},
"maxPerRow": 4,
"name": "失败统计平均使用率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_kvstore_failed_count_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "b516e7dc-8022-409d-b907-18c4143df891",
"layout": {
"h": 5,
"i": "b516e7dc-8022-409d-b907-18c4143df891",
"isResizable": true,
"w": 24,
"x": 0,
"y": 8
},
"maxPerRow": 4,
"name": "网络流量",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "bitsSI"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_kvstore_intranet_in_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "in",
"refId": "A"
},
{
"expr": "sum(aliyun_acs_kvstore_intranet_out_average{instance_id=\"$instance_id\"}) by (instance_id)",
"legend": "out",
"refId": "B"
}
],
"type": "timeseries",
"version": "2.0.0"
}
],
"var": [
{
"name": "datasource",
"type": "datasource",
"definition": "prometheus"
},
{
"name": "name",
"type": "query",
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(aliyun_acs_kvstore_cpu_usage_average,name)",
"multi": false
},
{
"name": "instance_id",
"type": "query",
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(aliyun_acs_kvstore_cpu_usage_average{name=\"$name\"},instance_id)",
"multi": false
}
],
"version": "3.0.0"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,449 +1,437 @@
{
"id": 0,
"group_id": 0,
"name": "阿里云REDIS_N",
"ident": "",
"tags": "",
"create_at": 0,
"create_by": "",
"update_at": 0,
"update_by": "",
"configs": {
"panels": [
{
"collapsed": false,
"id": "2c38fd30-4c4c-40a9-ad4a-5c945db32947",
"layout": {
"h": 1,
"i": "2c38fd30-4c4c-40a9-ad4a-5c945db32947",
"isResizable": false,
"w": 24,
"x": 0,
"y": 0
},
"name": "默认分组",
"type": "row"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "01f4d444-aa2d-466d-9615-c76baf60a40c",
"layout": {
"h": 4,
"i": "01f4d444-aa2d-466d-9615-c76baf60a40c",
"isResizable": true,
"w": 8,
"x": 0,
"y": 1
},
"maxPerRow": 4,
"name": "CPU 使用率(%)",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "aliyun_acs_kvstore_cpu_usage_average{instance_id=\"$instance_id\"}",
"instant": false,
"legend": "",
"refId": "A",
"step": 120
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "c43eb882-915f-4c38-a0b5-8f33c21ab44a",
"layout": {
"h": 4,
"i": "09903231-6557-42be-9cf3-2873878e9bf2",
"isResizable": true,
"w": 8,
"x": 8,
"y": 1
},
"maxPerRow": 4,
"name": "内存使用率(%)",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "aliyun_acs_kvstore_memory_usage_average{instance_id=\"$instance_id\"}",
"legend": "",
"refId": "A",
"step": 120
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "37447883-ad79-46bc-888a-1be2835c1c64",
"layout": {
"h": 4,
"i": "378a5a26-c28e-4612-af09-f82ec2e11d80",
"isResizable": true,
"w": 8,
"x": 16,
"y": 1
},
"maxPerRow": 4,
"name": "连接数使用率(%)",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "aliyun_acs_kvstore_connection_usage_average{instance_id=\"$instance_id\"}",
"legend": "",
"refId": "A",
"step": 120
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "2d1c8cdf-538e-48b5-8563-358f242825e5",
"layout": {
"h": 4,
"i": "764e188d-d728-44a0-a79d-133d957df9a9",
"isResizable": true,
"w": 8,
"x": 0,
"y": 5
},
"maxPerRow": 4,
"name": "流入带宽使用率(%)",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "aliyun_acs_kvstore_intranet_in_ratio_average{instance_id=\"$instance_id\"}",
"instant": false,
"legend": "",
"refId": "A",
"step": 120
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "0577dc0f-887a-4a54-9100-ef5e5e7443a0",
"layout": {
"h": 4,
"i": "93955b6b-620c-4407-908c-01ba4f544fef",
"isResizable": true,
"w": 8,
"x": 8,
"y": 5
},
"maxPerRow": 4,
"name": "流出带宽使用率(%)",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "aliyun_acs_kvstore_intranet_out_ratio_average{instance_id=\"$instance_id\"}",
"instant": false,
"legend": "",
"refId": "A",
"step": 120
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "a83bd550-3866-4225-9c09-08dd77e1b281",
"layout": {
"h": 4,
"i": "7b4d509b-1a8d-4f6a-9df4-f14116c4b9eb",
"isResizable": true,
"w": 8,
"x": 16,
"y": 5
},
"maxPerRow": 4,
"name": "连接数使用率(%)",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "aliyun_acs_kvstore_connection_usage_average{instance_id=\"$instance_id\"}",
"instant": false,
"legend": "",
"refId": "A",
"step": 120
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
}
"name": "阿里云REDIS_N",
"tags": "",
"ident": "",
"configs": {
"panels": [
{
"collapsed": false,
"id": "2c38fd30-4c4c-40a9-ad4a-5c945db32947",
"layout": {
"h": 1,
"i": "2c38fd30-4c4c-40a9-ad4a-5c945db32947",
"isResizable": false,
"w": 24,
"x": 0,
"y": 0
},
"name": "默认分组",
"type": "row"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "01f4d444-aa2d-466d-9615-c76baf60a40c",
"layout": {
"h": 4,
"i": "01f4d444-aa2d-466d-9615-c76baf60a40c",
"isResizable": true,
"w": 8,
"x": 0,
"y": 1
},
"maxPerRow": 4,
"name": "CPU 使用率(%)",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "aliyun_acs_kvstore_cpu_usage_average{instance_id=\"$instance_id\"}",
"instant": false,
"legend": "",
"refId": "A",
"step": 120
}
],
"var": [
{
"definition": "prometheus",
"name": "datasource",
"type": "datasource"
},
{
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(aliyun_acs_kvstore_cpu_usage_average,name)",
"multi": false,
"name": "name",
"type": "query"
},
{
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(aliyun_acs_kvstore_cpu_usage_average,instance_id)",
"multi": false,
"name": "instance_id",
"type": "query"
}
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
"public": 0,
"public_cate": 0,
"bgids": null,
"built_in": 0,
"hide": 0,
"uuid": 1717556327133348000
}
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "c43eb882-915f-4c38-a0b5-8f33c21ab44a",
"layout": {
"h": 4,
"i": "09903231-6557-42be-9cf3-2873878e9bf2",
"isResizable": true,
"w": 8,
"x": 8,
"y": 1
},
"maxPerRow": 4,
"name": "内存使用率(%)",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "aliyun_acs_kvstore_memory_usage_average{instance_id=\"$instance_id\"}",
"legend": "",
"refId": "A",
"step": 120
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "37447883-ad79-46bc-888a-1be2835c1c64",
"layout": {
"h": 4,
"i": "378a5a26-c28e-4612-af09-f82ec2e11d80",
"isResizable": true,
"w": 8,
"x": 16,
"y": 1
},
"maxPerRow": 4,
"name": "连接数使用率(%)",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "aliyun_acs_kvstore_connection_usage_average{instance_id=\"$instance_id\"}",
"legend": "",
"refId": "A",
"step": 120
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "2d1c8cdf-538e-48b5-8563-358f242825e5",
"layout": {
"h": 4,
"i": "764e188d-d728-44a0-a79d-133d957df9a9",
"isResizable": true,
"w": 8,
"x": 0,
"y": 5
},
"maxPerRow": 4,
"name": "流入带宽使用率(%)",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "aliyun_acs_kvstore_intranet_in_ratio_average{instance_id=\"$instance_id\"}",
"instant": false,
"legend": "",
"refId": "A",
"step": 120
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "0577dc0f-887a-4a54-9100-ef5e5e7443a0",
"layout": {
"h": 4,
"i": "93955b6b-620c-4407-908c-01ba4f544fef",
"isResizable": true,
"w": 8,
"x": 8,
"y": 5
},
"maxPerRow": 4,
"name": "流出带宽使用率(%)",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "percent"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "aliyun_acs_kvstore_intranet_out_ratio_average{instance_id=\"$instance_id\"}",
"instant": false,
"legend": "",
"refId": "A",
"step": 120
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "a83bd550-3866-4225-9c09-08dd77e1b281",
"layout": {
"h": 4,
"i": "7b4d509b-1a8d-4f6a-9df4-f14116c4b9eb",
"isResizable": true,
"w": 8,
"x": 16,
"y": 5
},
"maxPerRow": 4,
"name": "连接数使用率(%)",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "aliyun_acs_kvstore_connection_usage_average{instance_id=\"$instance_id\"}",
"instant": false,
"legend": "",
"refId": "A",
"step": 120
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
}
],
"var": [
{
"name": "datasource",
"type": "datasource",
"definition": "prometheus"
},
{
"name": "name",
"type": "query",
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(aliyun_acs_kvstore_cpu_usage_average,name)",
"multi": false
},
{
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(aliyun_acs_kvstore_cpu_usage_average,instance_id)",
"multi": false,
"name": "instance_id",
"type": "query"
}
],
"version": "3.0.0"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,400 +1,388 @@
{
"id": 0,
"group_id": 0,
"name": "阿里云SLB",
"ident": "",
"tags": "",
"create_at": 0,
"create_by": "",
"update_at": 0,
"update_by": "",
"configs": {
"panels": [
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceName": "Default",
"datasourceValue": "${datasource}",
"id": "aa8b2623-1e14-43cd-a3c4-33944a61fcc5",
"layout": {
"h": 4,
"i": "aa8b2623-1e14-43cd-a3c4-33944a61fcc5",
"isResizable": true,
"w": 12,
"x": 0,
"y": 0
},
"maxPerRow": 4,
"name": "七层实例QPS使用率(%)",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_slb_dashboard_instance_qps_utilization_average{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}} QPS使用率 ",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "b2002c63-8f0b-436c-b765-5bb65191f3c2",
"layout": {
"h": 4,
"i": "b2002c63-8f0b-436c-b765-5bb65191f3c2",
"isResizable": true,
"w": 12,
"x": 12,
"y": 0
},
"maxPerRow": 4,
"name": "7层协议实例Upstream状态码分布",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_slb_dashboard_upstream_code4xx_average{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}} 状态码 4xx ",
"refId": "A"
},
{
"expr": "sum(aliyun_acs_slb_dashboard_upstream_code5xx_average{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}} 状态码 5xx ",
"refId": "B"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "71028d82-4804-468f-92f4-3444953b22cc",
"layout": {
"h": 4,
"i": "71028d82-4804-468f-92f4-3444953b22cc",
"isResizable": true,
"w": 12,
"x": 0,
"y": 4
},
"maxPerRow": 4,
"name": "新建连接数",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_slb_dashboard_instance_new_connection_average{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}} 新建连接数",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "25f90635-ff68-4dc2-bfb0-c6634f0e6867",
"layout": {
"h": 4,
"i": "25f90635-ff68-4dc2-bfb0-c6634f0e6867",
"isResizable": true,
"w": 12,
"x": 12,
"y": 4
},
"maxPerRow": 4,
"name": "并发连接数",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_slb_dashboard_active_connection_average{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}} 活跃连接数",
"refId": "A"
},
{
"expr": "sum(aliyun_acs_slb_dashboard_inactive_connection_average{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}} 非活跃连接数",
"refId": "B"
},
{
"expr": "sum(aliyun_acs_slb_dashboard_max_connection_average{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}} 最大活跃连接数",
"refId": "C"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "fde27e57-bdd6-4fd6-b3c0-75222f736d3b",
"layout": {
"h": 4,
"i": "fde27e57-bdd6-4fd6-b3c0-75222f736d3b",
"isResizable": true,
"w": 12,
"x": 0,
"y": 8
},
"maxPerRow": 4,
"name": "数据包数",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_slb_dashboard_packet_rx_average{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}} 接受数据包数",
"refId": "A"
},
{
"expr": "sum(aliyun_acs_slb_dashboard_packet_tx_average{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}} 发送数据包数",
"refId": "B"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "a0fd47db-0b49-4b71-ae16-b4108324e35a",
"layout": {
"h": 4,
"i": "a0fd47db-0b49-4b71-ae16-b4108324e35a",
"isResizable": true,
"w": 12,
"x": 12,
"y": 8
},
"maxPerRow": 4,
"name": "流量",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "bitsSI"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_slb_dashboard_instance_traffic_rx_average{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}} 出流量",
"refId": "A"
},
{
"expr": "sum(aliyun_acs_slb_dashboard_instance_traffic_tx_average{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}} 入流量",
"refId": "B"
}
],
"type": "timeseries",
"version": "2.0.0"
}
"name": "阿里云SLB",
"tags": "",
"ident": "",
"configs": {
"panels": [
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceName": "Default",
"id": "aa8b2623-1e14-43cd-a3c4-33944a61fcc5",
"layout": {
"h": 4,
"i": "aa8b2623-1e14-43cd-a3c4-33944a61fcc5",
"isResizable": true,
"w": 12,
"x": 0,
"y": 0
},
"maxPerRow": 4,
"name": "七层实例QPS使用率(%)",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_slb_dashboard_instance_qps_utilization_average{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}} QPS使用率 ",
"refId": "A"
}
],
"var": [
{
"definition": "prometheus",
"name": "datasource",
"type": "datasource"
},
{
"allOption": true,
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(aliyun_acs_slb_dashboard_active_connection_average ,instance_id)",
"multi": true,
"name": "instance_id",
"type": "query"
}
"type": "timeseries",
"version": "2.0.0",
"datasourceValue": "${datasource}"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"id": "b2002c63-8f0b-436c-b765-5bb65191f3c2",
"layout": {
"h": 4,
"i": "b2002c63-8f0b-436c-b765-5bb65191f3c2",
"isResizable": true,
"w": 12,
"x": 12,
"y": 0
},
"maxPerRow": 4,
"name": "7层协议实例Upstream状态码分布",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_slb_dashboard_upstream_code4xx_average{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}} 状态码 4xx ",
"refId": "A"
},
{
"expr": "sum(aliyun_acs_slb_dashboard_upstream_code5xx_average{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}} 状态码 5xx ",
"refId": "B"
}
],
"version": "3.0.0"
},
"public": 0,
"public_cate": 0,
"bgids": null,
"built_in": 0,
"hide": 0,
"uuid": 1717556327138375000
}
"type": "timeseries",
"version": "2.0.0",
"datasourceValue": "${datasource}"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"id": "71028d82-4804-468f-92f4-3444953b22cc",
"layout": {
"h": 4,
"i": "71028d82-4804-468f-92f4-3444953b22cc",
"isResizable": true,
"w": 12,
"x": 0,
"y": 4
},
"maxPerRow": 4,
"name": "新建连接数",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_slb_dashboard_instance_new_connection_average{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}} 新建连接数",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0",
"datasourceValue": "${datasource}"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"id": "25f90635-ff68-4dc2-bfb0-c6634f0e6867",
"layout": {
"h": 4,
"i": "25f90635-ff68-4dc2-bfb0-c6634f0e6867",
"isResizable": true,
"w": 12,
"x": 12,
"y": 4
},
"maxPerRow": 4,
"name": "并发连接数",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_slb_dashboard_active_connection_average{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}} 活跃连接数",
"refId": "A"
},
{
"expr": "sum(aliyun_acs_slb_dashboard_inactive_connection_average{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}} 非活跃连接数",
"refId": "B"
},
{
"expr": "sum(aliyun_acs_slb_dashboard_max_connection_average{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}} 最大活跃连接数",
"refId": "C"
}
],
"type": "timeseries",
"version": "2.0.0",
"datasourceValue": "${datasource}"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"id": "fde27e57-bdd6-4fd6-b3c0-75222f736d3b",
"layout": {
"h": 4,
"i": "fde27e57-bdd6-4fd6-b3c0-75222f736d3b",
"isResizable": true,
"w": 12,
"x": 0,
"y": 8
},
"maxPerRow": 4,
"name": "数据包数",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_slb_dashboard_packet_rx_average{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}} 接受数据包数",
"refId": "A"
},
{
"expr": "sum(aliyun_acs_slb_dashboard_packet_tx_average{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}} 发送数据包数",
"refId": "B"
}
],
"type": "timeseries",
"version": "2.0.0",
"datasourceValue": "${datasource}"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"id": "a0fd47db-0b49-4b71-ae16-b4108324e35a",
"layout": {
"h": 4,
"i": "a0fd47db-0b49-4b71-ae16-b4108324e35a",
"isResizable": true,
"w": 12,
"x": 12,
"y": 8
},
"maxPerRow": 4,
"name": "流量",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {
"util": "bitsSI"
},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_acs_slb_dashboard_instance_traffic_rx_average{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}} 出流量",
"refId": "A"
},
{
"expr": "sum(aliyun_acs_slb_dashboard_instance_traffic_tx_average{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}} 入流量",
"refId": "B"
}
],
"type": "timeseries",
"version": "2.0.0",
"datasourceValue": "${datasource}"
}
],
"var": [
{
"name": "datasource",
"type": "datasource",
"definition": "prometheus"
},
{
"allOption": true,
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(aliyun_acs_slb_dashboard_active_connection_average ,instance_id)",
"multi": true,
"name": "instance_id",
"type": "query"
}
],
"version": "3.0.0"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,370 +1,358 @@
{
"id": 0,
"group_id": 0,
"name": "阿里云WAF",
"ident": "",
"tags": "",
"create_at": 0,
"create_by": "",
"update_at": 0,
"update_by": "",
"configs": {
"panels": [
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "ec46b990-faf5-4ed7-a791-bbac5df91636",
"layout": {
"h": 4,
"i": "ec46b990-faf5-4ed7-a791-bbac5df91636",
"isResizable": true,
"w": 12,
"x": 0,
"y": 0
},
"maxPerRow": 4,
"name": "4xx 环比率V3",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_waf_4xx_ratio_wafv3_maximum{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "4xx 环比率V3",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "efc75e62-5e75-470d-b12b-a98ca44b268a",
"layout": {
"h": 4,
"i": "584b5a3c-2b7a-4e11-bee5-c2ed8661933e",
"isResizable": true,
"w": 12,
"x": 12,
"y": 0
},
"maxPerRow": 4,
"name": "5xx 环比率V3",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_waf_5xx_ratio_wafv3_maximum{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "5xx 环比率V3",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "79aefa1b-5e50-4c0c-980d-e5523b859509",
"layout": {
"h": 4,
"i": "fc875397-c1a4-4713-b564-09abf852bcf3",
"isResizable": true,
"w": 12,
"x": 0,
"y": 4
},
"maxPerRow": 4,
"name": "4xx 环比率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_waf_4xx_ratio_maximum{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "4xx 环比率",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "60c211d4-d51a-4681-b23b-ec8cc5dce7fe",
"layout": {
"h": 4,
"i": "946be0db-32a3-48ea-9473-88fdfa77201d",
"isResizable": true,
"w": 12,
"x": 12,
"y": 4
},
"maxPerRow": 4,
"name": "5xx 环比率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_waf_5xx_ratio_maximum{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "5xx 环比率",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "0de9271c-7b19-4003-ae56-2e273b4b99c4",
"layout": {
"h": 4,
"i": "0de9271c-7b19-4003-ae56-2e273b4b99c4",
"isResizable": true,
"w": 12,
"x": 0,
"y": 8
},
"maxPerRow": 4,
"name": "QPS环比增长率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_waf_qps_ratio_maximum{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}}QPS 环比增长率",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"id": "ccf2ffc1-6f22-4a13-b795-68072c077e1f",
"layout": {
"h": 4,
"i": "d0320716-f704-4b6e-8671-b58fb77a5d7c",
"isResizable": true,
"w": 12,
"x": 12,
"y": 8
},
"maxPerRow": 4,
"name": "QPS环比下降率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_waf_qps_ratio_down_maximum{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}}QPS 环比下降率",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0"
}
"name": "阿里云WAF",
"tags": "",
"ident": "",
"configs": {
"panels": [
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"id": "ec46b990-faf5-4ed7-a791-bbac5df91636",
"layout": {
"h": 4,
"i": "ec46b990-faf5-4ed7-a791-bbac5df91636",
"isResizable": true,
"w": 12,
"x": 0,
"y": 0
},
"maxPerRow": 4,
"name": "4xx 环比率V3",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_waf_4xx_ratio_wafv3_maximum{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "4xx 环比率V3",
"refId": "A"
}
],
"var": [
{
"definition": "prometheus",
"name": "datasource",
"type": "datasource"
},
{
"allOption": true,
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(aliyun_waf_qps_ratio_maximum,instance_id)",
"multi": true,
"name": "instance_id",
"type": "query"
}
"type": "timeseries",
"version": "2.0.0",
"datasourceValue": "${datasource}"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"id": "efc75e62-5e75-470d-b12b-a98ca44b268a",
"layout": {
"h": 4,
"i": "584b5a3c-2b7a-4e11-bee5-c2ed8661933e",
"isResizable": true,
"w": 12,
"x": 12,
"y": 0
},
"maxPerRow": 4,
"name": "5xx 环比率V3",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_waf_5xx_ratio_wafv3_maximum{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "5xx 环比率V3",
"refId": "A"
}
],
"version": "3.0.0"
},
"public": 0,
"public_cate": 0,
"bgids": null,
"built_in": 0,
"hide": 0,
"uuid": 1717556327142143000
}
"type": "timeseries",
"version": "2.0.0",
"datasourceValue": "${datasource}"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"id": "79aefa1b-5e50-4c0c-980d-e5523b859509",
"layout": {
"h": 4,
"i": "fc875397-c1a4-4713-b564-09abf852bcf3",
"isResizable": true,
"w": 12,
"x": 0,
"y": 4
},
"maxPerRow": 4,
"name": "4xx 环比率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_waf_4xx_ratio_maximum{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "4xx 环比率",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0",
"datasourceValue": "${datasource}"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"id": "60c211d4-d51a-4681-b23b-ec8cc5dce7fe",
"layout": {
"h": 4,
"i": "946be0db-32a3-48ea-9473-88fdfa77201d",
"isResizable": true,
"w": 12,
"x": 12,
"y": 4
},
"maxPerRow": 4,
"name": "5xx 环比率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_waf_5xx_ratio_maximum{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "5xx 环比率",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0",
"datasourceValue": "${datasource}"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"id": "0de9271c-7b19-4003-ae56-2e273b4b99c4",
"layout": {
"h": 4,
"i": "0de9271c-7b19-4003-ae56-2e273b4b99c4",
"isResizable": true,
"w": 12,
"x": 0,
"y": 8
},
"maxPerRow": 4,
"name": "QPS环比增长率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_waf_qps_ratio_maximum{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}}QPS 环比增长率",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0",
"datasourceValue": "${datasource}"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "opacity",
"lineInterpolation": "smooth",
"lineWidth": 2,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"id": "ccf2ffc1-6f22-4a13-b795-68072c077e1f",
"layout": {
"h": 4,
"i": "d0320716-f704-4b6e-8671-b58fb77a5d7c",
"isResizable": true,
"w": 12,
"x": 12,
"y": 8
},
"maxPerRow": 4,
"name": "QPS环比下降率",
"options": {
"legend": {
"displayMode": "hidden"
},
"standardOptions": {},
"thresholds": {
"steps": [
{
"color": "#634CD9",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "none"
}
},
"targets": [
{
"expr": "sum(aliyun_waf_qps_ratio_down_maximum{instance_id=~\"$instance_id\"}) by (instance_id)",
"legend": "{{instance_id}}QPS 环比下降率",
"refId": "A"
}
],
"type": "timeseries",
"version": "2.0.0",
"datasourceValue": "${datasource}"
}
],
"var": [
{
"name": "datasource",
"type": "datasource",
"definition": "prometheus"
},
{
"allOption": true,
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(aliyun_waf_qps_ratio_maximum,instance_id)",
"multi": true,
"name": "instance_id",
"type": "query"
}
],
"version": "3.0.0"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -0,0 +1,30 @@
# 调整间隔时间
如有诉求对此插件本身的采集间隔时间调整的话就启用,单位为秒
interval = 15
# 获取被监控端设备的网卡名称
可用以下命令获取网卡名称列表
```
ip addr | grep '^[0-9]' |awk -F':' '{print $2}'
lo
eth0
br-153e7f4f0c83
br-2f302c2a8faa
br-5ae0cdb82efc
br-68cba8773a8c
br-c50ca3122079
docker0
br-fd769e4347bd
veth944ac75@if52
```
# 在数组instances中启用eth_device
将以上获取的网卡列表根据自己的诉求填入如eth0
```
eth_device="eth0"
```
# 测试是否能获取到值
```
./categraf --test --inputs arp_packet
```

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +0,0 @@
interval = 15
[[instances]]
urls = [
"http://<otel-collector-ip>:<otel-collector-port>/metrics"
]
url_label_key = "otel_collector"
url_label_value = "{{.Host}}"

File diff suppressed because it is too large Load Diff

View File

@@ -1,983 +0,0 @@
{
"id": 0,
"group_id": 0,
"name": "Cluster Overview",
"ident": "",
"tags": "",
"create_at": 0,
"create_by": "",
"update_at": 0,
"update_by": "",
"configs": {
"links": [],
"panels": [
{
"custom": {
"calc": "lastNotNull",
"colSpan": 1,
"colorMode": "background",
"graphMode": "none",
"textMode": "valueAndName",
"textSize": {},
"valueField": "Value"
},
"datasourceCate": "prometheus",
"datasourceValue": "${DS_PROMETHEUS}",
"id": "970f949f-cdc8-4ec0-b2c8-c49d3bd14d8d",
"layout": {
"h": 4,
"i": "970f949f-cdc8-4ec0-b2c8-c49d3bd14d8d",
"isResizable": true,
"w": 3,
"x": 0,
"y": 0
},
"links": [],
"maxPerRow": 4,
"options": {
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": [
{
"color": "#F2495C",
"type": "base",
"value": null
},
{
"color": "#73BF69",
"value": 0
}
]
},
"valueMappings": []
},
"targets": [
{
"expr": "sum by(job) (kafka_controller_active_count{job=\"$cluster_id\"})",
"legend": "Active Controller",
"maxDataPoints": 240,
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "stat",
"version": "3.0.0"
},
{
"custom": {
"calc": "lastNotNull",
"colSpan": 1,
"colorMode": "background",
"graphMode": "none",
"textMode": "valueAndName",
"textSize": {},
"valueField": "Value"
},
"datasourceCate": "prometheus",
"datasourceValue": "${DS_PROMETHEUS}",
"id": "bcf3c5d7-9dd1-4cb6-81a1-3198f4b049e2",
"layout": {
"h": 4,
"i": "bcf3c5d7-9dd1-4cb6-81a1-3198f4b049e2",
"isResizable": true,
"w": 3,
"x": 3,
"y": 0
},
"links": [],
"maxPerRow": 4,
"options": {
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": [
{
"color": "#73BF69",
"type": "base",
"value": null
},
{
"color": "#F2495C",
"value": 1
}
]
},
"valueMappings": []
},
"targets": [
{
"expr": "kafka_broker_fenced_count{job=\"$cluster_id\", instance=\"$active_controller\"}",
"legend": "Fenced Broker",
"maxDataPoints": 240,
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "stat",
"version": "3.0.0"
},
{
"custom": {
"calc": "lastNotNull",
"colSpan": 1,
"colorMode": "background",
"graphMode": "none",
"textMode": "valueAndName",
"textSize": {},
"valueField": "Value"
},
"datasourceCate": "prometheus",
"datasourceValue": "${DS_PROMETHEUS}",
"id": "333648e6-4bef-4e2d-bb84-f1d720d383cc",
"layout": {
"h": 4,
"i": "333648e6-4bef-4e2d-bb84-f1d720d383cc",
"isResizable": true,
"w": 4,
"x": 6,
"y": 0
},
"links": [],
"maxPerRow": 4,
"options": {
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": [
{
"color": "#3274D9",
"type": "base",
"value": null
}
]
},
"valueMappings": []
},
"targets": [
{
"expr": "kafka_topic_count{job=\"$cluster_id\", instance=\"$active_controller\"}",
"legend": "Topics",
"maxDataPoints": 240,
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "stat",
"version": "3.0.0"
},
{
"custom": {
"calc": "lastNotNull",
"colSpan": 1,
"colorMode": "background",
"graphMode": "none",
"textMode": "value",
"textSize": {},
"valueField": "Value"
},
"datasourceCate": "prometheus",
"datasourceValue": "${DS_PROMETHEUS}",
"id": "659a8d96-5276-49fb-a011-22d85dace435",
"layout": {
"h": 4,
"i": "659a8d96-5276-49fb-a011-22d85dace435",
"isResizable": true,
"w": 2,
"x": 10,
"y": 0
},
"links": [],
"maxPerRow": 4,
"name": "Error Rate",
"options": {
"standardOptions": {
"decimals": 1,
"util": "none"
},
"thresholds": {
"steps": [
{
"color": "#73BF69",
"type": "base",
"value": null
},
{
"color": "#F2495C",
"value": 1
}
]
},
"valueMappings": []
},
"targets": [
{
"expr": "sum(rate(kafka_request_error_count_total{job=\"$cluster_id\", error!=\"NONE\"}[$__rate_interval]))",
"legend": "__auto",
"maxDataPoints": 240,
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "stat",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.3,
"gradientMode": "none",
"lineInterpolation": "linear",
"lineWidth": 1,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${DS_PROMETHEUS}",
"id": "0650f241-385f-4386-8b76-7f23d53ef8fb",
"layout": {
"h": 8,
"i": "0650f241-385f-4386-8b76-7f23d53ef8fb",
"isResizable": true,
"w": 12,
"x": 12,
"y": 0
},
"links": [],
"maxPerRow": 4,
"name": "Bytes In (+) / Out (-)",
"options": {
"legend": {
"behaviour": "showItem",
"displayMode": "hidden",
"placement": "bottom"
},
"standardOptions": {
"decimals": 1,
"util": "bytesSecIEC"
},
"thresholds": {
"steps": [
{
"color": "#73BF69",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "desc"
},
"valueMappings": []
},
"overrides": [
{
"matcher": {
"id": "byFrameRefID"
},
"properties": {
"rightYAxisDisplay": "off"
}
}
],
"targets": [
{
"expr": "sum(rate(kafka_broker_network_io_bytes_total{job=\"$cluster_id\", direction=\"in\"}[$__rate_interval]))",
"legend": "In",
"maxDataPoints": 240,
"refId": "A"
},
{
"expr": "sum(rate(kafka_broker_network_io_bytes_total{job=\"$cluster_id\", direction=\"out\"}[$__rate_interval])) * -1",
"legend": "Out",
"maxDataPoints": 240,
"refId": "B"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"calc": "lastNotNull",
"colSpan": 1,
"colorMode": "background",
"graphMode": "none",
"textMode": "valueAndName",
"textSize": {},
"valueField": "Value"
},
"datasourceCate": "prometheus",
"datasourceValue": "${DS_PROMETHEUS}",
"id": "aac842e5-e997-4c0f-84e4-0b104dd303e3",
"layout": {
"h": 4,
"i": "aac842e5-e997-4c0f-84e4-0b104dd303e3",
"isResizable": true,
"w": 6,
"x": 0,
"y": 4
},
"links": [],
"maxPerRow": 4,
"options": {
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": [
{
"color": "#F2495C",
"type": "base",
"value": null
},
{
"color": "#73BF69",
"value": 0
}
]
},
"valueMappings": []
},
"targets": [
{
"expr": "kafka_broker_active_count{job=\"$cluster_id\", instance=\"$active_controller\"}",
"legend": "Active Broker",
"maxDataPoints": 240,
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "stat",
"version": "3.0.0"
},
{
"custom": {
"calc": "lastNotNull",
"colSpan": 1,
"colorMode": "background",
"graphMode": "none",
"textMode": "valueAndName",
"textSize": {},
"valueField": "Value"
},
"datasourceCate": "prometheus",
"datasourceValue": "${DS_PROMETHEUS}",
"id": "fb4e88e4-9e6e-44d0-8bb8-1fe717c0b824",
"layout": {
"h": 4,
"i": "fb4e88e4-9e6e-44d0-8bb8-1fe717c0b824",
"isResizable": true,
"w": 4,
"x": 6,
"y": 4
},
"links": [],
"maxPerRow": 4,
"options": {
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": [
{
"color": "#3274D9",
"type": "base",
"value": null
}
]
},
"valueMappings": []
},
"targets": [
{
"expr": "kafka_partition_total_count{job=\"$cluster_id\", instance=\"$active_controller\"}",
"legend": "Partitions",
"maxDataPoints": 240,
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "stat",
"version": "3.0.0"
},
{
"custom": {
"calc": "lastNotNull",
"colSpan": 1,
"colorMode": "background",
"graphMode": "none",
"textMode": "valueAndName",
"textSize": {},
"valueField": "Value"
},
"datasourceCate": "prometheus",
"datasourceValue": "${DS_PROMETHEUS}",
"id": "b752e09e-4bc4-4e12-935e-d24f1d422a9b",
"layout": {
"h": 4,
"i": "b752e09e-4bc4-4e12-935e-d24f1d422a9b",
"isResizable": true,
"w": 2,
"x": 10,
"y": 4
},
"links": [],
"maxPerRow": 4,
"options": {
"standardOptions": {
"decimals": 0,
"util": "bytesIEC"
},
"thresholds": {
"steps": [
{
"color": "#56A64B",
"type": "base",
"value": null
}
]
},
"valueMappings": []
},
"targets": [
{
"expr": "sum(kafka_log_size{job=\"$cluster_id\"})",
"legend": "Size",
"maxDataPoints": 240,
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "stat",
"version": "3.0.0"
},
{
"custom": {
"baseColor": "#9470FF",
"calc": "lastNotNull",
"serieWidth": 70,
"sortOrder": "desc"
},
"datasourceCate": "prometheus",
"datasourceValue": "${DS_PROMETHEUS}",
"id": "7b8a904f-179f-4140-9ed4-d109271ec7af",
"layout": {
"h": 5,
"i": "7b8a904f-179f-4140-9ed4-d109271ec7af",
"isResizable": true,
"w": 5,
"x": 0,
"y": 8
},
"links": [],
"maxPerRow": 4,
"name": "Group Count",
"options": {
"standardOptions": {
"util": "none"
},
"valueMappings": []
},
"targets": [
{
"expr": "sum(kafka_group_count{job=\"$cluster_id\"})",
"legend": "total",
"maxDataPoints": 240,
"refId": "A"
},
{
"expr": "sum(kafka_group_stable_count{job=\"$cluster_id\"})",
"legend": "stable",
"maxDataPoints": 240,
"refId": "D"
},
{
"expr": "sum(kafka_group_dead_count{job=\"$cluster_id\"})",
"legend": "dead",
"maxDataPoints": 240,
"refId": "B"
},
{
"expr": "sum(kafka_group_empty_count{job=\"$cluster_id\"})",
"legend": "empty",
"maxDataPoints": 240,
"refId": "C"
},
{
"expr": "sum(kafka_group_preparing_rebalance_count{job=\"$cluster_id\"})",
"legend": "prepare_rebalance",
"maxDataPoints": 240,
"refId": "E"
},
{
"expr": "sum(kafka_group_completing_rebalance_count{job=\"$cluster_id\"})",
"legend": "completing_rebalance",
"maxDataPoints": 240,
"refId": "F"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "barGauge",
"version": "3.0.0"
},
{
"custom": {
"calc": "lastNotNull",
"colorMode": "value",
"columns": [],
"displayMode": "labelsOfSeriesToRows",
"linkMode": "appendLinkColumn",
"links": [
{
"title": "下钻",
"url": "/dashboards/automq-group-metrics?TSDB=${DS_PROMETHEUS}\u0026cluster_id=${cluster_id}\u0026group_id=${__field.labels.consumer_group}\u0026partition=all\u0026topic=${__field.labels.topic}"
}
],
"showHeader": true
},
"datasourceCate": "prometheus",
"datasourceValue": "${DS_PROMETHEUS}",
"id": "b7cb494b-413f-4b12-ae1e-7da55b65d5ee",
"layout": {
"h": 5,
"i": "b7cb494b-413f-4b12-ae1e-7da55b65d5ee",
"isResizable": true,
"w": 19,
"x": 5,
"y": 8
},
"links": [],
"maxPerRow": 4,
"name": "Consumer Lag",
"options": {
"standardOptions": {},
"valueMappings": [
{
"match": {
"special": 0
},
"result": {
"color": "rgba(44, 157, 61, 1)"
},
"type": "special"
},
{
"match": {
"from": 0
},
"result": {
"color": "rgba(228, 22, 22, 1)"
},
"type": "range"
}
]
},
"overrides": [
{
"matcher": {
"id": "byFrameRefID"
},
"properties": {
"valueMappings": []
}
}
],
"targets": [
{
"expr": "sum by(topic) (max by(topic, partition) (kafka_log_end_offset{job=\"$cluster_id\"}))\n- on(topic) group_left(consumer_group)\nsum by(consumer_group, topic) (max by(consumer_group, topic, partition) (kafka_group_commit_offset{job=\"$cluster_id\"}))",
"legend": "",
"maxDataPoints": 240,
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {
"renameByName": {
"value": "lag"
}
}
}
],
"type": "table",
"version": "3.0.0"
},
{
"custom": {
"aggrDimension": [
"topic"
],
"calc": "lastNotNull",
"colorMode": "value",
"displayMode": "labelValuesToRows",
"linkMode": "appendLinkColumn",
"links": [
{
"title": "下钻",
"url": "/dashboards/automq-topic-metrics?TSDB=${DS_PROMETHEUS}\u0026cluster_id=${cluster_id}\u0026topic=${__field.labels.topic}"
}
],
"showHeader": true
},
"datasourceCate": "prometheus",
"datasourceValue": "${DS_PROMETHEUS}",
"id": "90716481-5dd6-4c4e-8219-cbcb724a22d9",
"layout": {
"h": 4,
"i": "90716481-5dd6-4c4e-8219-cbcb724a22d9",
"isResizable": true,
"w": 24,
"x": 0,
"y": 13
},
"links": [],
"maxPerRow": 4,
"name": "Topic Statistics",
"options": {
"standardOptions": {
"decimals": 2
}
},
"overrides": [
{
"matcher": {
"id": "byFrameRefID",
"value": "D"
},
"properties": {
"standardOptions": {
"decimals": 2,
"util": "bytesIEC"
},
"valueMappings": []
}
},
{
"matcher": {
"id": "byFrameRefID",
"value": "A"
},
"properties": {
"standardOptions": {
"decimals": 1,
"util": "bytesSecIEC"
}
},
"type": "special"
},
{
"matcher": {
"id": "byFrameRefID",
"value": "B"
},
"properties": {
"standardOptions": {
"decimals": 1,
"util": "bytesSecIEC"
}
},
"type": "special"
}
],
"targets": [
{
"expr": "sum by(topic) (rate(kafka_network_io_bytes_total{job=\"$cluster_id\", direction=\"in\"}[$__rate_interval]))",
"legend": "Bytes in",
"maxDataPoints": 240,
"refId": "A"
},
{
"expr": "sum by(topic) (rate(kafka_network_io_bytes_total{job=\"$cluster_id\", direction=\"out\"}[$__rate_interval]))",
"legend": "Bytes out",
"maxDataPoints": 240,
"refId": "B"
},
{
"expr": "sum by(topic) (rate(kafka_message_count_total{job=\"$cluster_id\", direction=\"in\"}[$__rate_interval]))",
"legend": "Msgs in",
"maxDataPoints": 240,
"refId": "C"
},
{
"expr": "sum by(topic) (kafka_log_size{job=\"$cluster_id\"})",
"legend": "Size",
"maxDataPoints": 240,
"refId": "D"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "table",
"version": "3.0.0"
},
{
"custom": {
"aggrDimension": [
"instance"
],
"calc": "lastNotNull",
"colorMode": "value",
"displayMode": "labelValuesToRows",
"linkMode": "appendLinkColumn",
"links": [
{
"title": "下钻",
"url": "/dashboards/automq-broker-metrics?DS_PROMETHEUS=${DS_PROMETHEUS}\u0026cluster_id=${cluster_id}\u0026node_id=${__field.labels.instance}"
}
],
"showHeader": true
},
"datasourceCate": "prometheus",
"datasourceValue": "${DS_PROMETHEUS}",
"id": "a427c6d3-0fab-45c2-92e5-585e5435fcfe",
"layout": {
"h": 6,
"i": "a427c6d3-0fab-45c2-92e5-585e5435fcfe",
"isResizable": true,
"w": 24,
"x": 0,
"y": 17
},
"links": [],
"maxPerRow": 4,
"name": "Broker Statistics",
"options": {
"standardOptions": {}
},
"overrides": [
{
"matcher": {
"id": "byFrameRefID",
"value": "C"
},
"properties": {
"standardOptions": {
"util": "bytesSecIEC"
}
}
},
{
"matcher": {
"id": "byFrameRefID",
"value": "D"
},
"properties": {
"standardOptions": {
"util": "bytesSecIEC"
}
},
"type": "special"
},
{
"matcher": {
"id": "byFrameRefID",
"value": "H"
},
"properties": {
"standardOptions": {
"util": "milliseconds"
}
},
"type": "special"
},
{
"matcher": {
"id": "byFrameRefID",
"value": "I"
},
"properties": {
"standardOptions": {
"util": "milliseconds"
}
},
"type": "special"
}
],
"targets": [
{
"expr": "sum by(instance) (kafka_partition_count{job=\"$cluster_id\"})",
"legend": "Partitions",
"maxDataPoints": 240,
"refId": "A"
},
{
"expr": "sum by(instance) (kafka_server_connection_count{job=\"$cluster_id\"})",
"legend": "Connections",
"maxDataPoints": 240,
"refId": "B"
},
{
"expr": "sum by(instance) (rate(kafka_network_io_bytes_total{job=\"$cluster_id\", direction=\"in\"}[$__rate_interval]))",
"legend": "Bytes In",
"maxDataPoints": 240,
"refId": "C"
},
{
"expr": "sum by(instance) (rate(kafka_network_io_bytes_total{job=\"$cluster_id\", direction=\"out\"}[$__rate_interval]))",
"legend": "Bytes Out",
"maxDataPoints": 240,
"refId": "D"
},
{
"expr": "sum by(instance) (rate(kafka_message_count_total{job=\"$cluster_id\", direction=\"in\"}[$__rate_interval]))",
"legend": "Msgs In",
"maxDataPoints": 240,
"refId": "E"
},
{
"expr": "sum by(instance) (rate(kafka_request_count_total{job=\"$cluster_id\", type=\"Produce\"}[$__rate_interval]))",
"legend": "Produce",
"maxDataPoints": 240,
"refId": "F"
},
{
"expr": "sum by(instance) (rate(kafka_request_count_total{job=\"$cluster_id\", type=\"Fetch\"}[$__rate_interval]))",
"legend": "Fetch",
"maxDataPoints": 240,
"refId": "G"
},
{
"expr": "sum by(instance) (kafka_request_time_99p_milliseconds{job=\"$cluster_id\", type=\"Produce\"})",
"legend": "Produce P99",
"maxDataPoints": 240,
"refId": "H"
},
{
"expr": "sum by(instance) (kafka_request_time_99p_milliseconds{job=\"$cluster_id\", type=\"Fetch\"})",
"legend": "Fetch P99",
"maxDataPoints": 240,
"refId": "I"
},
{
"expr": "sum by(instance) (rate(kafka_topic_request_failed_total{job=\"$cluster_id\", type=\"produce\"}[$__rate_interval]))",
"legend": "Failed Produce",
"maxDataPoints": 240,
"refId": "J"
},
{
"expr": "sum by(instance) (rate(kafka_topic_request_failed_total{job=\"$cluster_id\", type=\"fetch\"}[$__rate_interval]))",
"legend": "Failed Fetch",
"maxDataPoints": 240,
"refId": "K"
},
{
"expr": "sum by(instance) (rate(kafka_request_error_count_total{job=\"$cluster_id\", error!=\"NONE\"}[$__rate_interval]))",
"legend": "Error Request",
"maxDataPoints": 240,
"refId": "L"
}
],
"transformations": [
{
"id": "organize",
"options": {
"renameByName": {
"instance": "Node ID"
}
}
}
],
"type": "table",
"version": "3.0.0"
}
],
"var": [
{
"definition": "prometheus",
"name": "DS_PROMETHEUS",
"type": "datasource"
},
{
"allOption": false,
"datasource": {
"cate": "prometheus",
"value": "${DS_PROMETHEUS}"
},
"definition": "label_values(process_runtime_jvm_cpu_utilization_ratio,job)",
"hide": false,
"multi": false,
"name": "cluster_id",
"reg": "",
"type": "query"
},
{
"datasource": {
"cate": "prometheus",
"value": "${DS_PROMETHEUS}"
},
"definition": "label_values(kafka_controller_active_count{job=\"$cluster_id\"} \u003e 0, instance)",
"hide": false,
"multi": false,
"name": "active_controller",
"reg": "",
"type": "query"
}
],
"version": "3.0.0"
},
"public": 0,
"public_cate": 0,
"bgids": null,
"built_in": 0,
"hide": 0,
"uuid": 1717556327162929000
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,238 +0,0 @@
{
"id": 0,
"group_id": 0,
"name": "Group Metrics",
"ident": "automq-group-metrics",
"tags": "",
"create_at": 0,
"create_by": "",
"update_at": 0,
"update_by": "",
"configs": {
"links": [],
"panels": [
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0,
"gradientMode": "none",
"lineInterpolation": "linear",
"lineWidth": 1,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${TSDB}",
"id": "cac8a249-bb61-4c2d-bc90-91a7dac58f3b",
"layout": {
"h": 5,
"i": "cac8a249-bb61-4c2d-bc90-91a7dac58f3b",
"isResizable": true,
"w": 12,
"x": 0,
"y": 0
},
"links": [],
"maxPerRow": 4,
"name": "Consumer Throughput",
"options": {
"legend": {
"behaviour": "showItem",
"displayMode": "hidden",
"placement": "bottom"
},
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": [
{
"color": "#73BF69",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "desc"
},
"valueMappings": []
},
"overrides": [
{
"matcher": {
"id": "byFrameRefID"
},
"properties": {
"rightYAxisDisplay": "off"
}
}
],
"targets": [
{
"expr": "sum by(consumer_group, topic, partition) (rate(kafka_group_commit_offset{job=\"$cluster_id\", consumer_group=~\"$group_id\", topic=~\"$topic\", partition=~\"$partition\"}[$__rate_interval]))",
"legend": "{{consumer_group}}#{{topic}}-{{partition}}",
"maxDataPoints": 240,
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0,
"gradientMode": "none",
"lineInterpolation": "linear",
"lineWidth": 1,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${TSDB}",
"id": "fc0afd7c-0161-4ee4-88de-81c74f432769",
"layout": {
"h": 5,
"i": "12e7bb88-2851-44ea-a311-44ebcdb0e7b7",
"isResizable": true,
"w": 12,
"x": 12,
"y": 0
},
"links": [],
"maxPerRow": 4,
"name": "Consumer Lag",
"options": {
"legend": {
"behaviour": "showItem",
"displayMode": "hidden",
"placement": "bottom"
},
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": [
{
"color": "#73BF69",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "desc"
},
"valueMappings": []
},
"overrides": [
{
"matcher": {
"id": "byFrameRefID"
},
"properties": {
"rightYAxisDisplay": "off"
}
}
],
"targets": [
{
"expr": "sum by(topic) (max by(topic, partition) (kafka_log_end_offset{job=\"$cluster_id\", topic=~\"$topic\", partition=~\"$partition\"}))\n- on(topic) group_left(consumer_group)\nsum by(consumer_group, topic) (max by(consumer_group, topic, partition) (kafka_group_commit_offset{job=\"$cluster_id\", consumer_group=~\"$group_id\", topic=~\"$topic\", partition=~\"$partition\"}))",
"legend": "{{consumer_group}}#{{topic}}-{{partition}}",
"maxDataPoints": 240,
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
}
],
"var": [
{
"definition": "prometheus",
"hide": false,
"name": "TSDB",
"type": "datasource"
},
{
"datasource": {
"cate": "prometheus",
"value": "${TSDB}"
},
"definition": "label_values(process_runtime_jvm_cpu_utilization_ratio,job)",
"hide": false,
"multi": false,
"name": "cluster_id",
"reg": "",
"type": "query"
},
{
"allOption": true,
"datasource": {
"cate": "prometheus",
"value": "${TSDB}"
},
"definition": "label_values(kafka_group_commit_offset,consumer_group)",
"hide": false,
"multi": true,
"name": "group_id",
"reg": "",
"type": "query"
},
{
"allOption": true,
"datasource": {
"cate": "prometheus",
"value": "${TSDB}"
},
"definition": "label_values(kafka_group_commit_offset,topic)",
"hide": false,
"multi": true,
"name": "topic",
"reg": "",
"type": "query"
},
{
"allOption": true,
"datasource": {
"cate": "prometheus",
"value": "${TSDB}"
},
"definition": "label_values(kafka_group_commit_offset,partition)",
"hide": false,
"multi": true,
"name": "partition",
"reg": "",
"type": "query"
}
],
"version": "3.0.0"
},
"public": 0,
"public_cate": 0,
"bgids": null,
"built_in": 0,
"hide": 0,
"uuid": 1717556327172992000
}

View File

@@ -1,729 +0,0 @@
{
"id": 0,
"group_id": 0,
"name": "Topic Metrics",
"ident": "automq-topic-metrics",
"tags": "",
"create_at": 0,
"create_by": "",
"update_at": 0,
"update_by": "",
"configs": {
"links": [],
"panels": [
{
"custom": {
"calc": "lastNotNull",
"colSpan": 1,
"colorMode": "background",
"graphMode": "none",
"textMode": "valueAndName",
"textSize": {},
"valueField": "Value"
},
"datasourceCate": "prometheus",
"datasourceValue": "${TSDB}",
"id": "d4df5a68-ae8b-40e9-8f88-cd2e3f88e783",
"layout": {
"h": 3,
"i": "d4df5a68-ae8b-40e9-8f88-cd2e3f88e783",
"isResizable": true,
"w": 5,
"x": 0,
"y": 0
},
"links": [],
"maxPerRow": 4,
"options": {
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": [
{
"color": "rgba(44, 157, 61, 1)",
"type": "base",
"value": null
}
]
},
"valueMappings": []
},
"targets": [
{
"expr": "sum by(job) (rate(kafka_network_io_bytes_total{job=\"$cluster_id\", topic=~\"$topic\", partition=~\"$partition\", direction=\"in\"}[$__rate_interval]))",
"legend": "Bytes In Total",
"maxDataPoints": 240,
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "stat",
"version": "3.0.0"
},
{
"custom": {
"calc": "lastNotNull",
"colSpan": 1,
"colorMode": "background",
"graphMode": "none",
"textMode": "valueAndName",
"textSize": {},
"valueField": "Value"
},
"datasourceCate": "prometheus",
"datasourceValue": "${TSDB}",
"id": "52e25ff6-5ef8-4237-a49d-85473f9f90af",
"layout": {
"h": 3,
"i": "52e25ff6-5ef8-4237-a49d-85473f9f90af",
"isResizable": true,
"w": 3,
"x": 5,
"y": 0
},
"links": [],
"maxPerRow": 4,
"options": {
"standardOptions": {
"decimals": 2,
"util": "bytesIEC"
},
"thresholds": {
"steps": [
{
"color": "rgba(148, 112, 255, 1)",
"type": "base",
"value": null
}
]
},
"valueMappings": []
},
"targets": [
{
"expr": "sum by(topic) (kafka_log_size{job=\"$cluster_id\", topic=~\"$topic\"})",
"legend": "Size",
"maxDataPoints": 240,
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "stat",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.15,
"gradientMode": "none",
"lineInterpolation": "linear",
"lineWidth": 1,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${TSDB}",
"id": "75a6d933-f8d8-46f8-8cf0-9ef9dcc4e86b",
"layout": {
"h": 6,
"i": "75a6d933-f8d8-46f8-8cf0-9ef9dcc4e86b",
"isResizable": true,
"w": 8,
"x": 8,
"y": 0
},
"links": [],
"maxPerRow": 4,
"name": "Messages In",
"options": {
"legend": {
"behaviour": "showItem",
"displayMode": "hidden",
"placement": "bottom"
},
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": [
{
"color": "#73BF69",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "single"
},
"valueMappings": []
},
"overrides": [
{
"matcher": {
"id": "byFrameRefID"
},
"properties": {
"rightYAxisDisplay": "off"
}
}
],
"targets": [
{
"expr": "sum by(topic) (rate(kafka_message_count_total{job=\"$cluster_id\", topic=~\"$topic\", direction=\"in\"}[$__rate_interval]))",
"legend": "{{topic}}",
"maxDataPoints": 240,
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.15,
"gradientMode": "none",
"lineInterpolation": "linear",
"lineWidth": 1,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${TSDB}",
"id": "f1bbfda3-0fd8-4b85-b725-222f992fbbc9",
"layout": {
"h": 6,
"i": "f1bbfda3-0fd8-4b85-b725-222f992fbbc9",
"isResizable": true,
"w": 8,
"x": 16,
"y": 0
},
"links": [],
"maxPerRow": 4,
"name": "Request Throughput",
"options": {
"legend": {
"behaviour": "showItem",
"displayMode": "hidden",
"placement": "bottom"
},
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": [
{
"color": "#73BF69",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "single"
},
"valueMappings": []
},
"overrides": [
{
"matcher": {
"id": "byFrameRefID"
},
"properties": {
"rightYAxisDisplay": "off"
}
}
],
"targets": [
{
"expr": "sum by(topic, type) (rate(kafka_topic_request_count_total{job=\"$cluster_id\", topic=~\"$topic\"}[$__rate_interval]))",
"legend": "{{type}}",
"maxDataPoints": 240,
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"calc": "lastNotNull",
"colSpan": 1,
"colorMode": "background",
"graphMode": "none",
"textMode": "valueAndName",
"textSize": {},
"valueField": "Value"
},
"datasourceCate": "prometheus",
"datasourceValue": "${TSDB}",
"id": "56a85016-ca99-4495-be6a-53de1366a396",
"layout": {
"h": 3,
"i": "56a85016-ca99-4495-be6a-53de1366a396",
"isResizable": true,
"w": 5,
"x": 0,
"y": 3
},
"links": [],
"maxPerRow": 4,
"options": {
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": [
{
"color": "rgba(44, 157, 61, 1)",
"type": "base",
"value": null
}
]
},
"valueMappings": []
},
"targets": [
{
"expr": "sum by(job) (rate(kafka_network_io_bytes_total{job=\"$cluster_id\", topic=~\"$topic\", partition=~\"$partition\", direction=\"out\"}[$__rate_interval]))",
"legend": "Bytes Out Total",
"maxDataPoints": 240,
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "stat",
"version": "3.0.0"
},
{
"custom": {
"calc": "lastNotNull",
"colSpan": 1,
"colorMode": "background",
"graphMode": "none",
"textMode": "valueAndName",
"textSize": {},
"valueField": "Value"
},
"datasourceCate": "prometheus",
"datasourceValue": "${TSDB}",
"id": "6efe4439-00ab-41d8-a4f0-b2117ad13648",
"layout": {
"h": 3,
"i": "6efe4439-00ab-41d8-a4f0-b2117ad13648",
"isResizable": true,
"w": 3,
"x": 5,
"y": 3
},
"links": [],
"maxPerRow": 4,
"options": {
"standardOptions": {
"util": "none"
},
"thresholds": {
"steps": [
{
"color": "rgba(148, 112, 255, 1)",
"type": "base",
"value": null
}
]
},
"valueMappings": []
},
"targets": [
{
"expr": "count by(topic) (kafka_log_size{job=\"$cluster_id\", topic=~\"$topic\"})",
"legend": "Partition Count",
"maxDataPoints": 240,
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "stat",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0,
"gradientMode": "none",
"lineInterpolation": "linear",
"lineWidth": 1,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${TSDB}",
"id": "f3da44a7-bcb6-4b92-a5f9-b7e6856ced1a",
"layout": {
"h": 6,
"i": "f3da44a7-bcb6-4b92-a5f9-b7e6856ced1a",
"isResizable": true,
"w": 8,
"x": 0,
"y": 6
},
"links": [],
"maxPerRow": 4,
"name": "Size",
"options": {
"legend": {
"behaviour": "showItem",
"displayMode": "list",
"placement": "bottom"
},
"standardOptions": {
"decimals": 1,
"util": "bytesIEC"
},
"thresholds": {
"steps": [
{
"color": "#73BF69",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "single"
},
"valueMappings": []
},
"overrides": [
{
"matcher": {
"id": "byFrameRefID"
},
"properties": {
"rightYAxisDisplay": "off"
}
}
],
"targets": [
{
"expr": "sum by(topic) (kafka_log_size{job=\"$cluster_id\", topic=~\"$topic\"})",
"legend": "{{topic}}",
"maxDataPoints": 240,
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.15,
"gradientMode": "none",
"lineInterpolation": "linear",
"lineWidth": 1,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${TSDB}",
"id": "1354e591-5030-42f0-a3c3-eeb1e7c0a537",
"layout": {
"h": 6,
"i": "1354e591-5030-42f0-a3c3-eeb1e7c0a537",
"isResizable": true,
"w": 8,
"x": 8,
"y": 6
},
"links": [],
"maxPerRow": 4,
"name": "Bytes In",
"options": {
"legend": {
"behaviour": "showItem",
"displayMode": "list",
"placement": "bottom"
},
"standardOptions": {
"decimals": 1,
"util": "bytesSecIEC"
},
"thresholds": {
"steps": [
{
"color": "#73BF69",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "desc"
},
"valueMappings": []
},
"overrides": [
{
"matcher": {
"id": "byFrameRefID"
},
"properties": {
"rightYAxisDisplay": "off"
}
}
],
"targets": [
{
"expr": "sum by(topic, partition) (rate(kafka_network_io_bytes_total{job=\"$cluster_id\", topic=~\"$topic\", direction=\"in\", partition=~\"$partition\"}[$__rate_interval]))",
"legend": "{{topic}}-{{partition}}",
"maxDataPoints": 240,
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"drawStyle": "lines",
"fillOpacity": 0.15,
"gradientMode": "none",
"lineInterpolation": "linear",
"lineWidth": 1,
"scaleDistribution": {
"type": "linear"
},
"spanNulls": false,
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${TSDB}",
"id": "a91a656b-e5b1-4265-ba88-f1881b324137",
"layout": {
"h": 6,
"i": "a91a656b-e5b1-4265-ba88-f1881b324137",
"isResizable": true,
"w": 8,
"x": 16,
"y": 6
},
"links": [],
"maxPerRow": 4,
"name": "Bytes Out",
"options": {
"legend": {
"behaviour": "showItem",
"displayMode": "list",
"placement": "bottom"
},
"standardOptions": {
"decimals": 1,
"util": "bytesSecIEC"
},
"thresholds": {
"steps": [
{
"color": "#73BF69",
"type": "base",
"value": null
}
]
},
"tooltip": {
"mode": "all",
"sort": "desc"
},
"valueMappings": []
},
"overrides": [
{
"matcher": {
"id": "byFrameRefID"
},
"properties": {
"rightYAxisDisplay": "off"
}
}
],
"targets": [
{
"expr": "sum by(topic, partition) (rate(kafka_network_io_bytes_total{job=\"$cluster_id\", topic=~\"$topic\", direction=\"out\", partition=~\"$partition\"}[$__rate_interval]))",
"legend": "{{topic}}-{{partition}}",
"maxDataPoints": 240,
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "timeseries",
"version": "3.0.0"
},
{
"custom": {
"calc": "lastNotNull",
"colorMode": "value",
"columns": [],
"displayMode": "labelsOfSeriesToRows",
"linkMode": "appendLinkColumn",
"showHeader": true
},
"datasourceCate": "prometheus",
"datasourceValue": "${TSDB}",
"id": "5c3e188e-3d7c-4bc9-b8c7-c19c39a8d396",
"layout": {
"h": 4,
"i": "5c3e188e-3d7c-4bc9-b8c7-c19c39a8d396",
"isResizable": true,
"w": 24,
"x": 0,
"y": 12
},
"maxPerRow": 4,
"name": "Consume group lag",
"options": {
"standardOptions": {}
},
"overrides": [
{
"matcher": {
"id": "byFrameRefID"
}
}
],
"targets": [
{
"expr": "sum by(topic) (max by(topic, partition) (kafka_log_end_offset{job=\"$cluster_id\", topic=~\"$topic\", partition=~\"$partition\"}))\n- on(topic) group_left(consumer_group)\nsum by(consumer_group, topic) (max by(consumer_group, topic, partition) (kafka_group_commit_offset{job=\"$cluster_id\", topic=~\"$topic\", partition=~\"$partition\"}))",
"maxDataPoints": 240,
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {}
}
],
"type": "table",
"version": "3.0.0"
}
],
"var": [
{
"definition": "prometheus",
"hide": false,
"name": "TSDB",
"type": "datasource"
},
{
"datasource": {
"cate": "prometheus",
"value": "${TSDB}"
},
"definition": "label_values(process_runtime_jvm_cpu_utilization_ratio,job)",
"hide": false,
"multi": false,
"name": "cluster_id",
"reg": "",
"type": "query"
},
{
"allOption": true,
"datasource": {
"cate": "prometheus",
"value": "${TSDB}"
},
"definition": "label_values(kafka_log_size,topic)",
"hide": false,
"multi": true,
"name": "topic",
"reg": "",
"type": "query"
},
{
"allOption": true,
"allValue": ".*",
"datasource": {
"cate": "prometheus",
"value": "${TSDB}"
},
"definition": "label_values(kafka_log_size{topic=\"$topic\"},partition)",
"hide": false,
"multi": true,
"name": "partition",
"reg": "",
"type": "query"
}
],
"version": "3.0.0"
},
"public": 0,
"public_cate": 0,
"bgids": null,
"built_in": 0,
"hide": 0,
"uuid": 1717556327174664000
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

View File

@@ -1,20 +0,0 @@
## 前言
AuthMQ 官方文档提供了指标吐出方式以及和监控系统的整合方式,具体可以参考[AutoMQ](https://docs.automq.com/zh/docs/automq-opensource/LkwkwdQlwizjqckhj0dcc2IdnDh)。
## 推荐方式
建议采用 AutoMQ 文档中的方案二:使用 Prometheus OTLP Receiver 的方式,把所有的指标都收集到 OTel Collector 中,然后使用 Prometheus 或者 Categraf 直接去拉取数据即可。假如使用 Categraf就是使用 prometheus 插件去拉取数据,比如我们为 prometheus 插件提供一个单独的 automq.toml 的配置文件:`conf/input.prometheus/automq.toml` ,内容如下:
```toml
[[instances]]
urls = [
"http://<otel-collector-ip>:<otel-collector-port>/metrics"
]
url_label_key = "otel_collector"
url_label_value = "{{.Host}}"
```
注意url_label_key 一般都是指定为 instance但是这里故意指定为其他字符串是因为 AutoMQ 原始的指标中包含了 instance 标签,为了避免冲突,所以指定为其他字符串。

View File

@@ -1,887 +0,0 @@
[
{
"id": 0,
"uuid": 1717556327176351000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "Broker节点入站网络IO速率",
"unit": "bytesSecSI",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, instance) (rate(kafka_network_io_bytes_total{direction=\"in\"}[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327179998000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "Broker节点出站网络IO速率",
"unit": "bytesSecSI",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, instance) (rate(kafka_network_io_bytes_total{direction=\"out\"}[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327182502000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "Broker节点当前分配的分区数量",
"unit": "sishort",
"note": "",
"lang": "zh_CN",
"expression": "kafka_partition_count",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327184905000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "Broker节点每秒消息吞吐量",
"unit": "sishort",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, instance) (rate(kafka_message_count_total[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327187098000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "Consumer Group提交偏移量总和",
"unit": "none",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, consumer_group, topic) (max by(job, consumer_group, topic, partition) (kafka_group_commit_offset))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327189255000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "Consumer Group提交偏移量速率每个实例",
"unit": "none",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, consumer_group, topic, partition) (rate(kafka_group_commit_offset[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327191388000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "Consumer Group数量总和",
"unit": "sishort",
"note": "",
"lang": "zh_CN",
"expression": "sum by (job) (kafka_group_count)",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327193321000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "Consumer Group最大提交偏移量",
"unit": "none",
"note": "",
"lang": "zh_CN",
"expression": "max by(job, consumer_group, topic, partition) (kafka_group_commit_offset)",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327195219000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "Fetch请求处理时间的50分位数",
"unit": "milliseconds",
"note": "",
"lang": "zh_CN",
"expression": "kafka_request_time_50p_milliseconds",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327197092000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "Fetch请求处理时间的99分位数",
"unit": "milliseconds",
"note": "",
"lang": "zh_CN",
"expression": "kafka_request_time_99p_milliseconds",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327198909000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "Fetch请求处理时间的99分位数每个实例",
"unit": "milliseconds",
"note": "",
"lang": "zh_CN",
"expression": "avg by(job, instance) (kafka_request_time_99p_milliseconds)",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327201071000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "Fetch请求处理时间的平均值",
"unit": "milliseconds",
"note": "",
"lang": "zh_CN",
"expression": "kafka_request_time_mean_milliseconds",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327202824000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "Fetch请求处理时间的最大值",
"unit": "milliseconds",
"note": "",
"lang": "zh_CN",
"expression": "kafka_request_time_max_milliseconds",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327204459000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "Fetch请求失败速率每个实例",
"unit": "reqps",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, instance) (rate(kafka_topic_request_failed_total[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327206530000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "Kafka Controller活跃状态计数",
"unit": "sishort",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job) (kafka_controller_active_count)",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327208370000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "Produce请求处理时间的50分位数",
"unit": "milliseconds",
"note": "",
"lang": "zh_CN",
"expression": "kafka_request_time_50p_milliseconds",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327210667000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "Produce请求处理时间的99分位数",
"unit": "milliseconds",
"note": "",
"lang": "zh_CN",
"expression": "kafka_request_time_99p_milliseconds",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327212669000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "Produce请求处理时间的99分位数每个实例",
"unit": "milliseconds",
"note": "",
"lang": "zh_CN",
"expression": "avg by(job, instance) (kafka_request_time_99p_milliseconds)",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327214580000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "Produce请求处理时间的平均值",
"unit": "milliseconds",
"note": "",
"lang": "zh_CN",
"expression": "kafka_request_time_mean_milliseconds",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327217055000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "Produce请求处理时间的最大值",
"unit": "milliseconds",
"note": "",
"lang": "zh_CN",
"expression": "kafka_request_time_max_milliseconds",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327219060000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "Produce请求失败速率每个实例",
"unit": "reqps",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, instance) (rate(kafka_topic_request_failed_total[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327221295000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "各个Consumer Group和Topic的最大提交偏移量",
"unit": "none",
"note": "",
"lang": "zh_CN",
"expression": "max by(job, consumer_group, topic, partition) (kafka_group_commit_offset)",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327223767000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "各个Topic分区的最大日志结束偏移量",
"unit": "none",
"note": "",
"lang": "zh_CN",
"expression": "max by(job, topic, partition) (kafka_log_end_offset)",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327225577000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "实例的Fetch请求速率",
"unit": "reqps",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, instance, topic) (rate(kafka_request_count_total[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327227527000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "实例的Produce请求速率",
"unit": "reqps",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, instance, topic) (rate(kafka_request_count_total[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327229750000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "已死亡的Consumer Group数量总和",
"unit": "sishort",
"note": "",
"lang": "zh_CN",
"expression": "sum by (job) (kafka_group_dead_count)",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327231514000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "日志大小总和",
"unit": "bytesSI",
"note": "",
"lang": "zh_CN",
"expression": "sum by (job) (max by(job, topic, partition) (kafka_log_size))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327233243000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "日志消费延迟 lag",
"unit": "none",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, topic) (max by(job, topic, partition) (kafka_log_end_offset{}))\n- on(job, topic) group_left(consumer_group)\nsum by(job, consumer_group, topic) (max by(job, consumer_group, topic, partition) (kafka_group_commit_offset{}))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327236120000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "日志结束偏移量总和",
"unit": "none",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, topic) (max by(job, topic, partition) (kafka_log_end_offset))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327237878000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "日志结束最大偏移量",
"unit": "none",
"note": "",
"lang": "zh_CN",
"expression": "max by(job, topic, partition) (kafka_log_end_offset)",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327240138000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "正在准备进行rebalance的Consumer Group数量总和",
"unit": "sishort",
"note": "",
"lang": "zh_CN",
"expression": "sum by (job) (kafka_group_preparing_rebalance_count)",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327241777000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "正在等待Leader进行状态分配的Consumer Group数量总和",
"unit": "sishort",
"note": "",
"lang": "zh_CN",
"expression": "sum by (job) (kafka_group_completing_rebalance_count)",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327243616000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "每个Topic的Broker节点入站网络IO速率sum by(topic)",
"unit": "bytesSecSI",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, topic) (rate(kafka_network_io_bytes_total{direction=\"in\"}[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327245855000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "每个Topic的Broker节点入站网络IO速率sum by(topic, instance)",
"unit": "bytesSecSI",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, topic, instance) (rate(kafka_network_io_bytes_total{direction=\"in\"}[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327247589000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "每个Topic的Broker节点出站网络IO速率sum by(topic)",
"unit": "bytesSecSI",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, topic) (rate(kafka_network_io_bytes_total{direction=\"out\"}[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327249421000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "每个Topic的Broker节点出站网络IO速率sum by(topic, instance)",
"unit": "bytesSecSI",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, topic, instance) (rate(kafka_network_io_bytes_total{direction=\"out\"}[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327251637000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "每个Topic的Broker节点出站网络IO速率sum by(topic, partition)",
"unit": "bytesSecSI",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, topic, partition) (rate(kafka_network_io_bytes_total{direction=\"out\"}[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327253444000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "每个Topic的Broker节点消息吞吐量入站sum by(topic)",
"unit": "mps",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, topic) (rate(kafka_message_count_total{direction=\"in\"}[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327255550000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "每个Topic的Broker节点消息吞吐量入站sum by(topic, instance)",
"unit": "mps",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, topic, instance) (rate(kafka_message_count_total{direction=\"in\"}[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327257265000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "每个Topic的Broker节点网络IO速率集群级别",
"unit": "bytesSecSI",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job) (rate(kafka_network_io_bytes_total[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327259010000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "每个Topic的日志大小",
"unit": "bytesSI",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, topic) (kafka_log_size)",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327260869000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "每个Topic的消息吞吐量sum by(topic, type)",
"unit": "mps",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, topic, type) (rate(kafka_message_count_total[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327262606000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "每个Topic的请求计数sum by(topic, type)",
"unit": "reqps",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, topic, type) (rate(kafka_topic_request_count_total[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327264897000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "每个实例的Broker节点出站网络IO速率(实例级别)",
"unit": "bytesSecSI",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, instance) (rate(kafka_network_io_bytes_total{direction=\"out\"}[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327267156000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "每个实例的Broker节点分区数量",
"unit": "sishort",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, instance) (kafka_partition_count)",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327269529000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "每个实例的Broker节点消息吞吐量入站",
"unit": "mps",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, instance) (rate(kafka_message_count_total{direction=\"in\"}[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327271703000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "每个实例的Fetch请求速率",
"unit": "reqps",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, instance) (rate(kafka_request_count_total{type=\"Fetch\"}[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327273861000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "每个实例的Produce请求速率",
"unit": "reqps",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, instance) (rate(kafka_request_count_total{type=\"Produce\"}[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327276362000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "每个实例的节点当前建立的连接数",
"unit": "sishort",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, instance) (kafka_server_connection_count)",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327278608000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "活跃Broker数量",
"unit": "sishort",
"note": "",
"lang": "zh_CN",
"expression": "kafka_broker_active_count",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327280516000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "稳定状态的Consumer Group数量总和",
"unit": "sishort",
"note": "",
"lang": "zh_CN",
"expression": "sum by (job) (kafka_group_stable_count)",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327282783000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "空的Consumer Group数量总和",
"unit": "sishort",
"note": "",
"lang": "zh_CN",
"expression": "sum by (job) (kafka_group_empty_count)",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327284934000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "节点当前建立的连接数",
"unit": "sishort",
"note": "",
"lang": "zh_CN",
"expression": "kafka_server_connection_count",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327287401000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "被fence的Broker数量",
"unit": "sishort",
"note": "",
"lang": "zh_CN",
"expression": "kafka_broker_fenced_count",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327291657000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "请求错误计数总和",
"unit": "sishort",
"note": "",
"lang": "zh_CN",
"expression": "sum by (job) (rate(kafka_request_error_count_total[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327295172000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "请求错误计数率",
"unit": "sishort",
"note": "",
"lang": "zh_CN",
"expression": "rate(kafka_request_error_count_total[1m])",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327297787000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "请求错误计数率(每个实例)",
"unit": "reqps",
"note": "",
"lang": "zh_CN",
"expression": "sum by(job, instance) (rate(kafka_request_error_count_total[1m]))",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327300342000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "集群Topic总数",
"unit": "sishort",
"note": "",
"lang": "zh_CN",
"expression": "kafka_topic_count",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
},
{
"id": 0,
"uuid": 1717556327302857000,
"collector": "Exporter",
"typ": "AutoMQ",
"name": "集群分区总数",
"unit": "sishort",
"note": "",
"lang": "zh_CN",
"expression": "kafka_partition_total_count",
"created_at": 0,
"created_by": "",
"updated_at": 0,
"updated_by": ""
}
]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +1,7 @@
{
"id": 0,
"group_id": 0,
"name": "AWS RDS Telegraf",
"ident": "",
"tags": "AWS Cloudwatch Telegraf",
"create_at": 0,
"create_by": "",
"update_at": 0,
"update_by": "",
"ident": "",
"configs": {
"panels": [
{
@@ -32,8 +26,6 @@
"lineInterpolation": "smooth",
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"description": "* Telegraf Gather AWS Cloudwatch RDS\n* cloudwatch aws rds cpu 利用率平均值",
"id": "2002c9f5-6177-4239-a0c6-2981edacae5a",
"layout": {
@@ -71,7 +63,9 @@
}
],
"type": "timeseries",
"version": "2.0.0"
"version": "2.0.0",
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"custom": {
@@ -80,8 +74,6 @@
"lineInterpolation": "smooth",
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"description": "* Telegraf Gather AWS Cloudwatch RDS\n* cloudwatch aws rds 数据库连接平均值",
"id": "c54b9dca-88ce-425a-bf75-6d8b363f6ebb",
"layout": {
@@ -119,7 +111,9 @@
}
],
"type": "timeseries",
"version": "2.0.0"
"version": "2.0.0",
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"custom": {
@@ -128,8 +122,6 @@
"lineInterpolation": "smooth",
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"description": "* Telegraf Gather AWS Cloudwatch RDS\n* cloudwatch aws rds 可用存储空间平均值",
"id": "997a6214-2ac0-46c6-a0b9-046810b2b8cf",
"layout": {
@@ -167,7 +159,9 @@
}
],
"type": "timeseries",
"version": "2.0.0"
"version": "2.0.0",
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"custom": {
@@ -176,8 +170,6 @@
"lineInterpolation": "smooth",
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"description": "* Telegraf Gather AWS Cloudwatch RDS\n* cloudwatch aws rds 可用内存平均值",
"id": "6c00311c-e931-487f-b088-3a3bfafc84ef",
"layout": {
@@ -215,7 +207,9 @@
}
],
"type": "timeseries",
"version": "2.0.0"
"version": "2.0.0",
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"custom": {
@@ -224,8 +218,6 @@
"lineInterpolation": "smooth",
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"description": "* Telegraf Gather AWS Cloudwatch RDS\n* cloudwatch aws rds lvm 写入 iops 平均值",
"id": "990ab5a1-4aa5-47c3-b7b7-a65f63459119",
"layout": {
@@ -258,7 +250,9 @@
}
],
"type": "timeseries",
"version": "2.0.0"
"version": "2.0.0",
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"custom": {
@@ -267,8 +261,6 @@
"lineInterpolation": "smooth",
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"description": "* Telegraf Gather AWS Cloudwatch RDS\n* cloudwatch aws rds 读取 iops 平均值",
"id": "a61a80da-7d0a-45a5-a868-bd442b3aa4cf",
"layout": {
@@ -301,7 +293,9 @@
}
],
"type": "timeseries",
"version": "2.0.0"
"version": "2.0.0",
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"custom": {
@@ -310,8 +304,6 @@
"lineInterpolation": "smooth",
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"description": "* Telegraf Gather AWS Cloudwatch RDS\n* cloudwatch aws rds 写入吞吐量平均值",
"id": "2e605342-3413-4004-9fcf-3dbbfa7e7be3",
"layout": {
@@ -344,7 +336,9 @@
}
],
"type": "timeseries",
"version": "2.0.0"
"version": "2.0.0",
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"custom": {
@@ -353,8 +347,6 @@
"lineInterpolation": "smooth",
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"description": "* Telegraf Gather AWS Cloudwatch RDS\n* cloudwatch aws rds 读取吞吐量平均值",
"id": "1ef3f98d-1b54-408a-8cc2-4570c327d705",
"layout": {
@@ -387,7 +379,9 @@
}
],
"type": "timeseries",
"version": "2.0.0"
"version": "2.0.0",
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"collapsed": true,
@@ -411,8 +405,6 @@
"lineInterpolation": "smooth",
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"description": "* Telegraf Gather AWS Cloudwatch RDS\n* cloudwatch aws rds 网络接收吞吐量平均",
"id": "4ba500c9-e87e-41e4-bbc1-82fec507da9d",
"layout": {
@@ -445,7 +437,9 @@
}
],
"type": "timeseries",
"version": "2.0.0"
"version": "2.0.0",
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"custom": {
@@ -454,8 +448,6 @@
"lineInterpolation": "smooth",
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"description": "* Telegraf Gather AWS Cloudwatch RDS\n* cloudwatch aws rds 网络传输吞吐量平均值",
"id": "edee8285-1274-4ddc-b166-fb773c764c2b",
"layout": {
@@ -488,7 +480,9 @@
}
],
"type": "timeseries",
"version": "2.0.0"
"version": "2.0.0",
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"custom": {
@@ -497,8 +491,6 @@
"lineInterpolation": "smooth",
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"description": "* Telegraf Gather AWS Cloudwatch RDS\n* cloudwatch aws rds 写入延迟平均值",
"id": "ecb9b8a5-b168-4a65-b7f6-7912ab6c6b22",
"layout": {
@@ -531,7 +523,9 @@
}
],
"type": "timeseries",
"version": "2.0.0"
"version": "2.0.0",
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"custom": {
@@ -540,8 +534,6 @@
"lineInterpolation": "smooth",
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"description": "* Telegraf Gather AWS Cloudwatch RDS\n* cloudwatch aws rds 读取延迟平均值",
"id": "60d009fa-e547-45be-a862-9b156c15b675",
"layout": {
@@ -574,7 +566,9 @@
}
],
"type": "timeseries",
"version": "2.0.0"
"version": "2.0.0",
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"collapsed": true,
@@ -598,8 +592,6 @@
"lineInterpolation": "smooth",
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"description": "* Telegraf Gather AWS Cloudwatch RDS\n* cloudwatch aws rds 磁盘队列深度平均值",
"id": "7edcf2a8-16f3-49ef-9026-e53dc5e72c69",
"layout": {
@@ -632,7 +624,9 @@
}
],
"type": "timeseries",
"version": "2.0.0"
"version": "2.0.0",
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"custom": {
@@ -641,8 +635,6 @@
"lineInterpolation": "smooth",
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"description": "* Telegraf Gather AWS Cloudwatch RDS\n* cloudwatch aws rds 二进制日志磁盘使用情况 (MB)",
"id": "42143731-22a9-45b4-bb1e-ddb8f2c11a70",
"layout": {
@@ -675,7 +667,9 @@
}
],
"type": "timeseries",
"version": "2.0.0"
"version": "2.0.0",
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"custom": {
@@ -684,8 +678,6 @@
"lineInterpolation": "smooth",
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"description": "* Telegraf Gather AWS Cloudwatch RDS\n* cloudwatch aws rds 交换分区使用平均值",
"id": "51c6f9d9-30db-4514-a54d-712e1a570b23",
"layout": {
@@ -718,7 +710,9 @@
}
],
"type": "timeseries",
"version": "2.0.0"
"version": "2.0.0",
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
},
{
"custom": {
@@ -727,8 +721,6 @@
"lineInterpolation": "smooth",
"stack": "off"
},
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}",
"description": "* Telegraf Gather AWS Cloudwatch RDS\n* cloudwatch aws rds 突发余额平均值",
"id": "767bcc71-3f71-443a-9713-03f587ccc350",
"layout": {
@@ -763,41 +755,37 @@
}
],
"type": "timeseries",
"version": "2.0.0"
"version": "2.0.0",
"datasourceCate": "prometheus",
"datasourceValue": "${datasource}"
}
],
"var": [
{
"definition": "prometheus",
"name": "datasource",
"type": "datasource"
"type": "datasource",
"definition": "prometheus"
},
{
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
"definition": "label_values(cloudwatch_aws_rds_cpu_utilization_average, region)",
"multi": false,
"name": "region",
"type": "query"
},
{
"type": "query",
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
},
}
},
{
"definition": "label_values(cloudwatch_aws_rds_cpu_utilization_average{region=\"$region\"}, db_instance_identifier)",
"name": "instance",
"type": "query"
"type": "query",
"datasource": {
"cate": "prometheus",
"value": "${datasource}"
}
}
],
"version": "3.0.0"
},
"public": 0,
"public_cate": 0,
"bgids": null,
"built_in": 0,
"hide": 0,
"uuid": 1717556327336057000
}
}

Some files were not shown because too many files have changed in this diff Show More