介绍:
已亲测,适配MongoDB 4.0 7.0 8.0版本
版本说明:
prometheus:2.55.0 mongodb_exporter:0.11.2 grafana:11.2.0
目录
二、安装 MongoDB Exporter(MongoDB 实例节点)
Grafana监控效果:
一、部署Prometheus
1、下载、验证
# 下载
wget https://github.com/prometheus/prometheus/releases/download/v2.55.0/prometheus-2.55.0.linux-amd64.tar.gz
# 使用 sha256sum 命令来生成并验证下载文件的哈希值
sha256sum prometheus-2.55.0.linux-amd64.tar.gz
2、解压安装
tar xvf prometheus-2.55.0.linux-amd64.tar.gz
sudo mv prometheus-2.55.0.linux-amd64 /opt/prometheus
3、创建用户
# 添加用户(所有节点)
chattr -i /etc/passwd /etc/shadow /etc/group /etc/gshadow
sudo useradd -rs /bin/false prometheus
chattr +i /etc/passwd /etc/shadow /etc/group /etc/gshadow
4、授权
# 授权
mkdir -p /opt/prometheus/data
sudo chown -R prometheus:prometheus /opt/prometheus
sudo chmod -R 755 /opt/prometheus
5、编写prometheus配置文件
vim /opt/prometheus/prometheus.yml
# my global config
global:
scrape_interval: 15s # 全局抓取间隔,默认为15秒,适用于所有job,除非在job级别覆盖
scrape_configs:
- job_name: "mongodb_exporter" # 定义job名称
scrape_timeout: 15s # 抓取超时时间,可选,默认使用全局配置
#basic_auth: # 基本认证信息,目前被注释掉了
# username: admin
# password: admin
file_sd_configs: # 文件服务发现配置
- files:
- "/usr/local/prometheus/db_nodes/mongodb_exporter.yml" # 指定的文件路径,Prometheus将从这里读取targets
6、编写prometheus的服务单元文件
注:
user、group 为上面步骤3创建的用户组
ExecStart 为prometheus的二进制可执行文件和配置文件
vim /etc/systemd/system/prometheus.service
[Unit]
Description=Prometheus Monitoring
After=network.target
[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/opt/prometheus/prometheus --config.file=/opt/prometheus/prometheus.yml
Restart=always
[Install]
WantedBy=multi-user.target
7、 启动 Prometheus
sudo systemctl daemon-reload
sudo systemctl restart prometheus
sudo systemctl enable prometheus
二、安装 MongoDB Exporter(MongoDB 实例节点)
推荐使用0.11.2版本,其他版本grafana无法适配
1、下载验证
#官网
https://github.com/percona/mongodb_exporter/tree/0.11.2
wget
https://github.com/percona/mongodb_exporter/releases/download/v0.11.2/mongodb_exporter-0.11.2.linux-amd64.tar.gz
sha256sum mongodb_exporter-0.11.2.linux-amd64.tar.gz
06c586a86468c6f14dcd31f2cffbb90a1fbdf7d8861b69ba64d7fa2e38eb403b mongodb_exporter-0.11.2.linux-amd64.tar.gz
2、添加grafana用户(所有节点)
chattr -i /etc/passwd /etc/shadow /etc/group /etc/gshadow
sudo useradd -rs /bin/false mongodb_exporter
chattr +i /etc/passwd /etc/shadow /etc/group /etc/gshadow
3、解压安装
mkdir -p /opt/mongodb_exporter
tar xvf mongodb_exporter-0.11.2.linux-amd64.tar.gz -C /opt/mongodb_exporter
mv /opt/mongodb_exporter/mongodb_exporter /usr/local/bin/
4、编写mongodb_exporter 启动单元
参数讲解:
mongodb.uri=mongodb://admin:admin@localhost:27001
# 这是监控27001端口的,admin为user和passwd,需要确认好,mongo能正常登录,单独创建账户最好
user、group
# 为上面步骤2创建的用户组
web.listen-address=:9216
# 指定 Web 服务监听地址和端口
单实例
vim /etc/systemd/system/mongodb_exporter.service
[Unit]
Description=Prometheus MongoDB Exporter
Documentation=https://github.com/percona/mongodb_exporter
After=network.target
[Service]
Type=simple
User=mongodb_exporter
Group=mongodb_exporter
#EnvironmentFile=/etc/default/mongodb_exporter
ExecStart=/usr/local/bin/mongodb_exporter --mongodb.uri=mongodb://admin:admin:27001/admin?authSource=admin
--web.listen-address=:9216
SyslogIdentifier=mongodb_exporter
Restart=always
[Install]
WantedBy=multi-user.target
多实例:
注:单台机器分片集群(多实例)
有route:20000、configs:21000、shard1:27001、shard2:27002、shard3:27003多个实例
那就需要些多个启动单元,route这个我这边是没有添加监控,你们需要可以单独配置添加
如:
# config
vim /etc/systemd/system/mongodb_exporter_config.service
[Unit]
Description=Prometheus MongoDB Exporter
Documentation=https://github.com/percona/mongodb_exporter
After=network.target
[Service]
Type=simple
User=mongodb_exporter
Group=mongodb_exporter
#EnvironmentFile=/etc/default/mongodb_exporter
ExecStart=/usr/local/bin/mongodb_exporter --mongodb.uri=mongodb://admin:admin@localhost:21000/admin?authSource=admin
--web.listen-address=:9215
SyslogIdentifier=mongodb_exporter_config
Restart=always
[Install]
WantedBy=multi-user.target
# shard1
vim /etc/systemd/system/mongodb_exporter_shard1.service
[Unit]
Description=Prometheus MongoDB Exporter
Documentation=https://github.com/percona/mongodb_exporter
After=network.target
[Service]
Type=simple
User=mongodb_exporter
Group=mongodb_exporter
#EnvironmentFile=/etc/default/mongodb_exporter
ExecStart=/usr/local/bin/mongodb_exporter --mongodb.uri=mongodb://admin:admin@localhost:27001/admin?authSource=admin
--web.listen-address=:9216
SyslogIdentifier=mongodb_exporter_shard2
Restart=always
[Install]
WantedBy=multi-user.target
# shard2
vim /etc/systemd/system/mongodb_exporter_shard2.service
[Unit]
Description=Prometheus MongoDB Exporter
Documentation=https://github.com/percona/mongodb_exporter
After=network.target
[Service]
Type=simple
User=mongodb_exporter
Group=mongodb_exporter
#EnvironmentFile=/etc/default/mongodb_exporter
ExecStart=/usr/local/bin/mongodb_exporter --mongodb.uri=mongodb://admin:admin@localhost:27002/admin?authSource=admin
--web.listen-address=:9217
SyslogIdentifier=mongodb_exporter_shard2
Restart=always
[Install]
WantedBy=multi-user.target
# shard3
vim /etc/systemd/system/mongodb_exporter_shard2.service
[Unit]
Description=Prometheus MongoDB Exporter
Documentation=https://github.com/percona/mongodb_exporter
After=network.target
[Service]
Type=simple
User=mongodb_exporter
Group=mongodb_exporter
#EnvironmentFile=/etc/default/mongodb_exporter
ExecStart=/usr/local/bin/mongodb_exporter --mongodb.uri=mongodb://admin:admin@localhost:27003/admin?authSource=admin
--web.listen-address=:9218
SyslogIdentifier=mongodb_exporter_shard3
Restart=always
[Install]
WantedBy=multi-user.target
5、对(.service
文件)添加了可执行权限
chmod +x /etc/systemd/system/mongodb_exporter.service
chmod +x /etc/systemd/system/mongodb_exporter_configs.service
chmod +x /etc/systemd/system/mongodb_exporter_shard1.service
chmod +x /etc/systemd/system/mongodb_exporter_shard2.service
chmod +x /etc/systemd/system/mongodb_exporter_shard3.service
6、启动
注:根据自己的启动单元文件启动
sudo systemctl daemon-reload
sudo systemctl restart mongodb_exporter.service
sudo systemctl enable mongodb_exporter.service
sudo systemctl status mongodb_exporter.service
sudo systemctl daemon-reload
sudo systemctl restart mongodb_exporter_configs.service
sudo systemctl enable mongodb_exporter_configs.service
sudo systemctl status mongodb_exporter_configs.service
sudo systemctl daemon-reload
sudo systemctl restart mongodb_exporter_shard1.service
sudo systemctl enable mongodb_exporter_shard1.service
sudo systemctl status mongodb_exporter_shard1.service
sudo systemctl daemon-reload
sudo systemctl restart mongodb_exporter_shard2.service
sudo systemctl enable mongodb_exporter_shard2.service
sudo systemctl status mongodb_exporter_shard2.service
sudo systemctl daemon-reload
sudo systemctl restart mongodb_exporter_shard3.service
sudo systemctl enable mongodb_exporter_shard3.service
sudo systemctl status mongodb_exporter_shard3.service
7、常见报错
1)、防火墙没开,对应的端口需要放开,对prometheus机器
如:9216 需对prometheus部署的机器放开
2)、用户没有创建
User=mongodb_exporter
Group=mongodb_exporter
3)、mongodb无法连接
检查账户密码,端口,测试连接成功后
4)、端口被占用
检查9216这些端口有没有被占用
netstat -luntp
三、编写文件服务发现配置
注:
- app: test:表示项目名称为 test,用于标识目标所属的项目,方便在 Prometheus 或 Grafana 中按项目过滤数据。
- host: 192.168.30.30:标识目标所在的主机 IP。
- instance: shard1_27001:标识具体的 MongoDB 实例,是一个分片(shard1),端口 27001。
vim /usr/local/prometheus/db_nodes/mongodb_exporter.yml
- targets:
- 192.168.30.30:9216
labels:
app: test
host: 192.168.30.30
instance: shard1_27001
- targets:
- 192.168.30.30:9217
labels:
app: test
host: 192.168.30.30
instance: shard2_27002
- targets:
- 192.168.30.30:9218
labels:
app: test
host: 192.168.30.30
instance: shard3_27003
- targets:
- 192.168.30.30:9215
labels:
app: test
host: 192.168.30.30
instance: configs_21000
四、配置grafana
1、导入数据源
注:url为prometheus.yml 的ip+port 我用的localhost:9090,可以去这个网址检查是否都正常
URL: http://192.168.30.30:9090/
然后划到最下面,保存即可
2、配置grafana模版
1)、下载模版
第一种是:我附近上传的模版(或者在文章底部),我是引用官方的(2583),然后结合自己的需求添加了些参数监控
第二种:直接输入官方的id即可,见图二,load前面
2)、上传模版
图一:
图二:
3、grafana的使用
用app来区分不同的项目
用host来区分不同的主机
用instance来区分不同的实例
json模版:
{
"__inputs": [
{
"name": "DS_DB",
"label": "DB",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
},
{
"name": "DS_ALL",
"label": "All",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"__elements": {},
"__requires": [
{
"type": "panel",
"id": "barchart",
"name": "Bar chart",
"version": ""
},
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "10.4.1"
},
{
"type": "datasource",
"id": "prometheus",
"name": "Prometheus",
"version": "1.0.0"
},
{
"type": "panel",
"id": "stat",
"name": "Stat",
"version": ""
},
{
"type": "panel",
"id": "timeseries",
"name": "Time series",
"version": ""
}
],
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "datasource",
"uid": "grafana"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"description": "MongoDB Prometheus Exporter Dashboard. A fork inspired from https://grafana.com/grafana/dashboards/2583 which is made to work well with https://github.com/percona/mongodb_exporter.",
"editable": true,
"fiscalYearStartMonth": 0,
"gnetId": 12079,
"graphTooltip": 1,
"id": null,
"links": [],
"panels": [
{
"collapsed": false,
"datasource": {
"type": "prometheus",
"uid": "celj61hpy49ogb"
},
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 0
},
"id": 20,
"panels": [],
"repeat": "env",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "celj61hpy49ogb"
},
"refId": "A"
}
],
"title": "Query Metrics for $env",
"type": "row"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "ops"
},
"overrides": []
},
"gridPos": {
"h": 6,
"w": 12,
"x": 0,
"y": 1
},
"id": 7,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"editorMode": "code",
"exemplar": false,
"expr": "rate(mongodb_op_counters_total{app=~\"$app\", host=~\"$host\", instance=~\"$instance\"}[$interval])",
"format": "time_series",
"instant": false,
"interval": "",
"intervalFactor": 2,
"legendFormat": "{{type}}",
"range": true,
"refId": "A",
"step": 240
}
],
"title": "Query Operations",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 6,
"w": 12,
"x": 12,
"y": 1
},
"id": 9,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"editorMode": "code",
"expr": "rate(mongodb_mongod_metrics_document_total{app=~\"$app\", host=~\"$host\", instance=~\"$instance\"}[$interval])",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "{{state}}",
"range": true,
"refId": "A",
"step": 240
}
],
"title": "Document Operations",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 7
},
"id": 8,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"editorMode": "code",
"expr": "rate(mongodb_mongod_metrics_query_executor_total{app=~\"$app\", host=~\"$host\", instance=~\"$instance\"}[$interval])",
"format": "time_series",
"hide": false,
"interval": "",
"intervalFactor": 2,
"legendFormat": "{{state}}",
"range": true,
"refId": "A",
"step": 600
}
],
"title": "Document Query Executor",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 7
},
"id": 68,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"editorMode": "code",
"expr": "mongodb_mongod_metrics_cursor_open{state=\"total\",app=~\"$app\", host=~\"$host\", instance=~\"$instance\"}",
"instant": false,
"legendFormat": "{{state}}",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"editorMode": "code",
"expr": "mongodb_mongod_metrics_cursor_open{state=\"noTimeout\",instance=~\"$env\"}",
"hide": false,
"instant": false,
"legendFormat": "{{state}}",
"range": true,
"refId": "B"
}
],
"title": "Cursors",
"type": "timeseries"
},
{
"collapsed": false,
"datasource": {
"type": "prometheus",
"uid": "celj61hpy49ogb"
},
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 15
},
"id": 21,
"panels": [],
"repeat": "env",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "celj61hpy49ogb"
},
"refId": "A"
}
],
"title": "Replica Set Metrics for $env",
"type": "row"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_ALL}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"fillOpacity": 80,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineWidth": 1,
"scaleDistribution": {
"type": "linear"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 6,
"w": 12,
"x": 0,
"y": 16
},
"id": 15,
"options": {
"barRadius": 0,
"barWidth": 0.97,
"fullHighlight": false,
"groupWidth": 0.7,
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"orientation": "auto",
"showValue": "auto",
"stacking": "none",
"tooltip": {
"mode": "single",
"sort": "none"
},
"xTickLabelRotation": 0,
"xTickLabelSpacing": 0
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_ALL}"
},
"editorMode": "code",
"exemplar": false,
"expr": "mongodb_mongod_replset_number_of_members{app=~\"$app\", host=~\"$host\", instance=~\"$instance\"}",
"format": "time_series",
"instant": true,
"interval": "",
"intervalFactor": 2,
"legendFormat": "members",
"range": false,
"refId": "A",
"step": 600
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_ALL}"
},
"editorMode": "code",
"expr": "sum(mongodb_mongod_replset_number_of_members{app=~\"$app\", host=~\"$host\", instance=~\"$instance\"})",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "healthy members",
"range": true,
"refId": "B",
"step": 600
}
],
"title": "Member Health",
"transformations": [
{
"id": "reduce",
"options": {
"reducers": [
"current"
]
}
}
],
"type": "barchart"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"description": "See which node is currently acting as the primary, secondary, ...",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "series",
"axisLabel": "",
"axisPlacement": "auto",
"fillOpacity": 80,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineWidth": 1,
"scaleDistribution": {
"type": "linear"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 6,
"w": 12,
"x": 12,
"y": 16
},
"id": 14,
"options": {
"barRadius": 0,
"barWidth": 0.97,
"colorByField": "Last *",
"fullHighlight": false,
"groupWidth": 0.7,
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"orientation": "auto",
"showValue": "auto",
"stacking": "none",
"text": {},
"tooltip": {
"maxWidth": -6,
"mode": "single",
"sort": "none"
},
"xTickLabelRotation": 0,
"xTickLabelSpacing": 0
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"editorMode": "code",
"exemplar": false,
"expr": "mongodb_mongod_replset_member_state{app=~\"$app\", host=~\"$host\", instance=~\"$instance\"}",
"format": "time_series",
"instant": true,
"interval": "",
"intervalFactor": 2,
"legendFormat": "{{state}}",
"range": false,
"refId": "A",
"step": 240
}
],
"title": "Member State",
"transformations": [
{
"id": "reduce",
"options": {
"reducers": [
"current"
]
}
}
],
"type": "barchart"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "ops"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 22
},
"id": 11,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"editorMode": "code",
"expr": "rate(mongodb_op_counters_repl_total{app=~\"$app\", host=~\"$host\", instance=~\"$instance\"}[$interval])",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "{{type}}",
"range": true,
"refId": "A",
"step": 600
}
],
"title": "Replica Query Operations",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 22
},
"id": 69,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"editorMode": "code",
"expr": "mongodb_mongod_replset_member_replication_lag{app=~\"$app\", host=~\"$host\", instance=~\"$instance\"}",
"instant": false,
"legendFormat": "{{instance}}",
"range": true,
"refId": "A"
}
],
"title": "Replication Lag",
"type": "timeseries"
},
{
"collapsed": false,
"datasource": {
"type": "prometheus",
"uid": "celj61hpy49ogb"
},
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 30
},
"id": 22,
"panels": [],
"repeat": "env",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "celj61hpy49ogb"
},
"refId": "A"
}
],
"title": "Health metrics for $env",
"type": "row"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "light-green",
"mode": "fixed"
},
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "rgba(245, 54, 54, 0.9)",
"value": null
},
{
"color": "rgba(237, 129, 40, 0.89)",
"value": 0
},
{
"color": "rgba(50, 172, 45, 0.97)",
"value": 360
}
]
},
"unit": "s"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 5,
"x": 0,
"y": 31
},
"id": 10,
"maxDataPoints": 100,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"text": {
"titleSize": 4
},
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "10.4.1",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"editorMode": "code",
"exemplar": false,
"expr": "mongodb_instance_uptime_seconds{app=~\"$app\", host=~\"$host\", instance=~\"$instance\"}",
"format": "time_series",
"instant": true,
"intervalFactor": 2,
"legendFormat": "",
"range": false,
"refId": "A",
"step": 1800
}
],
"title": "Uptime",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "#19cef7",
"mode": "fixed"
},
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 6,
"x": 5,
"y": 31
},
"id": 2,
"maxDataPoints": 100,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "horizontal",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"text": {
"titleSize": 3
},
"textMode": "value",
"wideLayout": true
},
"pluginVersion": "10.4.1",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"editorMode": "code",
"exemplar": false,
"expr": "mongodb_connections{app=~\"$app\", host=~\"$host\", instance=~\"$instance\",state=\"available\"}",
"format": "time_series",
"instant": true,
"intervalFactor": 2,
"legendFormat": "",
"metric": "mongodb_connections",
"range": false,
"refId": "A",
"step": 1800
}
],
"title": "Available Connections",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "super-light-red",
"mode": "fixed"
},
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 6,
"x": 11,
"y": 31
},
"id": 70,
"maxDataPoints": 100,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "horizontal",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"first"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "10.4.1",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"editorMode": "code",
"exemplar": false,
"expr": "mongodb_connections{app=~\"$app\", host=~\"$host\", instance=~\"$instance\",state=\"active\"}",
"format": "time_series",
"instant": true,
"intervalFactor": 2,
"legendFormat": "",
"metric": "mongodb_connections",
"range": false,
"refId": "A",
"step": 1800
}
],
"title": "Active Connections",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "super-light-orange",
"mode": "fixed"
},
"mappings": [
{
"options": {
"match": "null",
"result": {
"text": "N/A"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "none"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 6,
"x": 17,
"y": 31
},
"hideTimeOverride": false,
"id": 1,
"maxDataPoints": 100,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "horizontal",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"first"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "10.4.1",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"editorMode": "code",
"exemplar": false,
"expr": "mongodb_connections{app=~\"$app\", host=~\"$host\", instance=~\"$instance\",state=\"current\"}",
"format": "time_series",
"instant": true,
"intervalFactor": 2,
"legendFormat": "",
"metric": "mongodb_connections",
"range": false,
"refId": "A",
"step": 1800
}
],
"title": "Open Connections",
"type": "stat"
},
{
"collapsed": false,
"datasource": {
"type": "prometheus",
"uid": "celj61hpy49ogb"
},
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 35
},
"id": 23,
"panels": [],
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "celj61hpy49ogb"
},
"refId": "A"
}
],
"title": "Resource Metrics",
"type": "row"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "decbytes"
},
"overrides": []
},
"gridPos": {
"h": 6,
"w": 8,
"x": 0,
"y": 36
},
"id": 6,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"editorMode": "code",
"expr": "mongodb_mongod_replset_oplog_size_bytes{app=~\"$app\", host=~\"$host\", instance=~\"$instance\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "{{type}}",
"metric": "mongodb_locks_time_acquiring_global_microseconds_total",
"range": true,
"refId": "A",
"step": 240
}
],
"title": "Oplog Size",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "MB",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "decmbytes"
},
"overrides": []
},
"gridPos": {
"h": 6,
"w": 8,
"x": 8,
"y": 36
},
"id": 4,
"options": {
"legend": {
"calcs": [
"lastNotNull"
],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"editorMode": "code",
"expr": "mongodb_memory{app=~\"$app\", host=~\"$host\", instance=~\"$instance\",type=~\"resident|virtual\"}",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "{{type}}",
"range": true,
"refId": "A",
"step": 240
}
],
"title": "Memory",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "decbytes"
},
"overrides": []
},
"gridPos": {
"h": 6,
"w": 8,
"x": 16,
"y": 36
},
"id": 5,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"editorMode": "code",
"expr": "rate(mongodb_network_bytes_total{app=~\"$app\", host=~\"$host\", instance=~\"$instance\"}[$interval])",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "{{state}}",
"metric": "mongodb_metrics_operation_total",
"range": true,
"refId": "A",
"step": 240
}
],
"title": "Network I/O",
"type": "timeseries"
},
{
"collapsed": false,
"datasource": {
"type": "prometheus",
"uid": "celj61hpy49ogb"
},
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 42
},
"id": 24,
"panels": [],
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "celj61hpy49ogb"
},
"refId": "A"
}
],
"title": "Alerts",
"type": "row"
},
{
"alert": {
"conditions": [
{
"evaluator": {
"params": [
300
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"params": [
"A",
"15m",
"now"
]
},
"reducer": {
"params": [],
"type": "avg"
},
"type": "query"
}
],
"executionErrorState": "keep_state",
"frequency": "60s",
"handler": 1,
"message": "A MongoDB oplog replication has been 5 minutes behind in its replication for more than 15 minutes.\nBeing able to fail over to a replica of your data is only useful if the data is up to date, so you need to know when that’s no longer the case!",
"name": "MongoDB Oplog lag alert",
"noDataState": "no_data",
"notifications": [
{
"id": 2
}
]
},
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "line+area"
}
},
"decimals": 1,
"fieldMinMax": true,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "transparent",
"value": null
},
{
"color": "red",
"value": 300
}
]
},
"unit": "dtdurations"
},
"overrides": []
},
"gridPos": {
"h": 6,
"w": 23,
"x": 0,
"y": 43
},
"id": 16,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": false
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"editorMode": "code",
"exemplar": false,
"expr": "rate(mongodb_mongod_replset_oplog_head_timestamp{app=~\"$app\", host=~\"$host\", instance=~\"$instance\"}[5m])",
"format": "time_series",
"hide": false,
"instant": false,
"interval": "",
"intervalFactor": 2,
"legendFormat": "__auto",
"range": true,
"refId": "A",
"step": 240
}
],
"title": "Oplog Lag",
"type": "timeseries"
},
{
"collapsed": false,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 49
},
"id": 51,
"panels": [],
"title": "Concurrent Queue(并发队列信息)",
"type": "row"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [
{
"options": {
"reader": {
"index": 0,
"text": "reader"
}
},
"type": "value"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"__systemRef": "hideSeriesFrom",
"matcher": {
"id": "byNames",
"options": {
"mode": "exclude",
"names": [
"{__name__=\"mongodb_mongod_global_lock_current_queue\", instance=\"192.168.30.30:9216\", job=\"mongodb\", type=\"reader\"}"
],
"prefix": "All except:",
"readOnly": true
}
},
"properties": [
{
"id": "custom.hideFrom",
"value": {
"legend": false,
"tooltip": false,
"viz": true
}
}
]
}
]
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 50
},
"id": 38,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"editorMode": "code",
"expr": "mongodb_mongod_global_lock_current_queue{type=\"reader\",app=~\"$app\", host=~\"$host\", instance=~\"$instance\"}",
"instant": false,
"legendFormat": "{{instance}}_{{type}}",
"range": true,
"refId": "A"
}
],
"title": "Active Read Clients",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [
{
"options": {
"reader": {
"index": 0,
"text": "reader"
}
},
"type": "value"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"__systemRef": "hideSeriesFrom",
"matcher": {
"id": "byNames",
"options": {
"mode": "exclude",
"names": [
"{__name__=\"mongodb_mongod_global_lock_current_queue\", instance=\"192.168.30.30:9216\", job=\"mongodb\", type=\"reader\"}"
],
"prefix": "All except:",
"readOnly": true
}
},
"properties": [
{
"id": "custom.hideFrom",
"value": {
"legend": false,
"tooltip": false,
"viz": true
}
}
]
}
]
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 50
},
"id": 64,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"editorMode": "code",
"expr": "mongodb_mongod_global_lock_current_queue{type=\"writer\",app=~\"$app\", host=~\"$host\", instance=~\"$instance\"}",
"hide": false,
"instant": false,
"legendFormat": "{{instance}}_{{type}}",
"range": true,
"refId": "B"
}
],
"title": "Active Write Clients",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 58
},
"id": 65,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"editorMode": "code",
"expr": "mongodb_mongod_global_lock_current_queue{type=\"reader\",app=~\"$app\", host=~\"$host\", instance=~\"$instance\"}",
"instant": false,
"legendFormat": "{{instance}}_{{type}}",
"range": true,
"refId": "A"
}
],
"title": "Blocked Read Clients",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 58
},
"id": 66,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"editorMode": "code",
"expr": "mongodb_mongod_global_lock_current_queue{type=\"writer\",app=~\"$app\", host=~\"$host\", instance=~\"$instance\"}",
"instant": false,
"legendFormat": "{{instance}}_{{type}}",
"range": true,
"refId": "A"
}
],
"title": "Blocked Writer Clients",
"type": "timeseries"
}
],
"refresh": "5s",
"schemaVersion": 39,
"tags": [
"prometheus"
],
"templating": {
"list": [
{
"current": {},
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"definition": "label_values(mongodb_up,app)",
"hide": 0,
"includeAll": true,
"label": "app",
"multi": true,
"name": "app",
"options": [],
"query": {
"qryType": 1,
"query": "label_values(mongodb_up,app)",
"refId": "PrometheusVariableQueryEditor-VariableQuery"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 1,
"type": "query"
},
{
"current": {},
"datasource": {
"type": "prometheus",
"uid": "${DS_DB}"
},
"definition": "label_values(mongodb_up{app=~\"$app\"},host)",
"hide": 0,
"includeAll": true,
"label": "host",
"multi": false,
"name": "host",
"options": [],
"query": {
"qryType": 1,
"query": "label_values(mongodb_up{app=~\"$app\"},host)",
"refId": "PrometheusVariableQueryEditor-VariableQuery"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 1,
"type": "query",
"useTags": false
},
{
"current": {},
"datasource": {
"type": "prometheus",
"uid": "${DS_ALL}"
},
"definition": "label_values(mongodb_up{app=\"$app\", host=~\"$host\"},instance)",
"hide": 0,
"includeAll": false,
"label": "instance",
"multi": true,
"name": "instance",
"options": [],
"query": {
"qryType": 1,
"query": "label_values(mongodb_up{app=\"$app\", host=~\"$host\"},instance)",
"refId": "PrometheusVariableQueryEditor-VariableQuery"
},
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 1,
"type": "query"
},
{
"auto": true,
"auto_count": 30,
"auto_min": "10s",
"current": {
"selected": false,
"text": "auto",
"value": "$__auto_interval_interval"
},
"hide": 0,
"name": "interval",
"options": [
{
"selected": true,
"text": "auto",
"value": "$__auto_interval_interval"
},
{
"selected": false,
"text": "1m",
"value": "1m"
},
{
"selected": false,
"text": "10m",
"value": "10m"
},
{
"selected": false,
"text": "30m",
"value": "30m"
},
{
"selected": false,
"text": "1h",
"value": "1h"
},
{
"selected": false,
"text": "6h",
"value": "6h"
},
{
"selected": false,
"text": "12h",
"value": "12h"
},
{
"selected": false,
"text": "1d",
"value": "1d"
},
{
"selected": false,
"text": "7d",
"value": "7d"
},
{
"selected": false,
"text": "14d",
"value": "14d"
},
{
"selected": false,
"text": "30d",
"value": "30d"
}
],
"query": "1m,10m,30m,1h,6h,12h,1d,7d,14d,30d",
"queryValue": "",
"refresh": 2,
"skipUrlSync": false,
"type": "interval"
}
]
},
"time": {
"from": "now-1h",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
]
},
"timezone": "browser",
"title": "MongoDB_Shard",
"uid": "AyWQt9jWks120",
"version": 17,
"weekStart": ""
}