prometheus+grafana监控mysql、canal服务器

 

一、prometheus配置

1.prometheus安装

1.1官网下载安装包:https://prometheus.io/download/

1.2解压安装包:tar -zxvf prometheus-2.6.1.linux-amd64.tar.gz 

1.3快速启动:进入解压目录并启动:./prometheus 默认使用解压目录下的prometheus.yml配置文件】

2.优化prometheus启动、停止

2.1创建日志记录文件:touch /var/log/prometheus.log

2.2添加服务prometheus服务:

 
  1. $ cd /usr/lib/systemd/system

  2. $ vim prometheus.service

 prometheus.service内容

 
  1. [Unit]

  2. Description=Prometheus

  3. Documentation=https://prometheus.io/docs/introduction/overview/

  4. Wants=network-online.target

  5. After=network-online.target

  6.  
  7. [Service]

  8. #User=prometheus # 必须用该用户和相应的执行权限否则不能启动

  9. #Group=prometheus

  10. User=root

  11. Group=root

  12. Type=simple

  13. ExecStart=/opt/prometheus/prometheus.sh # 启动脚本

  14.  
  15. [Install]

  16. WantedBy=multi-user.target

2.3启动脚本:vim /opt/prometheus/prometheus.sh

 
  1. #!/bin/bash

  2. /root/prometheus/prometheus-2.6.1.linux-amd64/prometheus --config.file=/root/prometheus/prometheus-2.6.1.linux-amd64/prometheus.yml &>> /var/log/prometheus.log

2.4启动、停止脚本:systemctl start prometheus.service / systemctl stop prometheus.service

2.5进入登录页面:ip:9090

二、安装grafana(centos)

1.1不同的操作系统具体参考官网:http://docs.grafana.org/

1.2(centos),配置文件为:/opt/grafana/grafana.ini

yum install https://dl.grafana.com/oss/release/grafana-5.4.2-1.x86_64.rpm

1.3启动:systemctl start grafana-server

1.4登录页面:ip:3000,账号密码默认:admin/admin

 三、prometheus配置mysql

1.安装node_export、mysqld_export

 
  1. #安装node_export

  2. wget https://github.com/prometheus/node_exporter/releases/download/v0.14.0/node_exporter-0.14.0.linux-amd64.tar.gz -O node_exporter-0.14.0.linux-amd64.tar.gz

  3.  
  4. #安装mysqld_exporter

  5. wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.10.0/mysqld_exporter-0.10.0.linux-amd64.tar.gz -O mysqld_exporter-0.10.0.linux-amd64.tar.gz

  6.  
  7. #创建目录

  8. mkdir /usr/local/services

  9. mkdir /usr/local/services/prometheus_exporters

  10.  
  11. #解压node_export

  12. tar zxf node_exporter-0.14.0.linux-amd64.tar.gz -C /usr/local/services/prometheus_exporters --strip-components=1

  13.  
  14. #解压mysqld_exporter

  15. tar zxf mysqld_exporter-0.10.0.linux-amd64.tar.gz -C /usr/local/services/prometheus_exporters --strip-components=1

1.2优化启动过程,类似prometheus

node_export进入解压目录直接启动: ./node_exporter 

mysqld_export 进入解压目录直接启动:./mysqld_exporter  -config.my-cnf=my.cnf

需要配置数据连接信息:需要注意权限问题

 
  1. #解压文件夹目录创建文件

  2. vim my.cnf

  3.  
  4. #内容,数据库账号密码

  5. [client]

  6. user=root

  7. password=123456

  8. port=3306

1.3启动node_export与mysqld_export

2.prometheus配置mysql

2.1修改prometheus.yml配置文件:

 
  1. #修改

  2. vim prometheus.yml

  3.  
  4. #添加:

  5. - job_name: 'mysql'

  6. static_configs:

  7. - targets: ['192.168.1.158:9104']

  8. labels:

  9. instance: 192.168.1.158

  10. - job_name: 'linux'

  11. static_configs:

  12. - targets: ['192.168.1.158:9100']

  13. labels:

  14. instance: db1

2.2重启服务,页面会看到

3.grafana配置

3.1Add prometheus datasource

2.添加mysql仪表盘:import 仪表盘

官网查询:Mysql overView  https://grafana.com/dashboards?search=MySql%20Ov

 选择datasource 为 Prometheus

四、增加canal监听 

1.1修改prometheus配置文件

 
  1. vim prometheus.yml

  2.  
  3. #增加内容

  4. - job_name: 'canal'

  5. static_configs:

  6. - targets: ['localhost:11112']#canal服务ip

1.2grafana配置,增加canal仪表盘信息,如上,不过这次不是从官网下载,而是import外部文件

见下面:canal_instance.json

1.3重启服务可看到

canal_instance.json

 
  1. {

  2. "__inputs": [

  3. {

  4. "name": "DS_PROMETHEUS",

  5. "label": "prometheus",

  6. "description": "",

  7. "type": "datasource",

  8. "pluginId": "prometheus",

  9. "pluginName": "Prometheus"

  10. }

  11. ],

  12. "__requires": [

  13. {

  14. "type": "grafana",

  15. "id": "grafana",

  16. "name": "Grafana",

  17. "version": "5.2.2"

  18. },

  19. {

  20. "type": "panel",

  21. "id": "graph",

  22. "name": "Graph",

  23. "version": "5.0.0"

  24. },

  25. {

  26. "type": "datasource",

  27. "id": "prometheus",

  28. "name": "Prometheus",

  29. "version": "5.0.0"

  30. }

  31. ],

  32. "annotations": {

  33. "list": [

  34. {

  35. "builtIn": 1,

  36. "datasource": "-- Grafana --",

  37. "enable": true,

  38. "hide": true,

  39. "iconColor": "rgba(0, 211, 255, 1)",

  40. "name": "Annotations & Alerts",

  41. "type": "dashboard"

  42. }

  43. ]

  44. },

  45. "editable": true,

  46. "gnetId": null,

  47. "graphTooltip": 0,

  48. "id": null,

  49. "iteration": 1536989235272,

  50. "links": [],

  51. "panels": [

  52. {

  53. "collapsed": false,

  54. "gridPos": {

  55. "h": 1,

  56. "w": 24,

  57. "x": 0,

  58. "y": 0

  59. },

  60. "id": 30,

  61. "panels": [],

  62. "title": "Instance status",

  63. "type": "row"

  64. },

  65. {

  66. "aliasColors": {},

  67. "bars": false,

  68. "dashLength": 10,

  69. "dashes": false,

  70. "datasource": "$datasource",

  71. "description": "Canal instance 基本信息。",

  72. "fill": 1,

  73. "gridPos": {

  74. "h": 5,

  75. "w": 6,

  76. "x": 0,

  77. "y": 1

  78. },

  79. "id": 24,

  80. "legend": {

  81. "alignAsTable": true,

  82. "avg": false,

  83. "current": false,

  84. "hideEmpty": false,

  85. "hideZero": false,

  86. "max": false,

  87. "min": false,

  88. "rightSide": true,

  89. "show": true,

  90. "sideWidth": 500,

  91. "total": false,

  92. "values": false

  93. },

  94. "lines": true,

  95. "linewidth": 1,

  96. "links": [],

  97. "nullPointMode": "null",

  98. "percentage": false,

  99. "pointradius": 5,

  100. "points": false,

  101. "renderer": "flot",

  102. "repeat": null,

  103. "seriesOverrides": [],

  104. "spaceLength": 10,

  105. "stack": false,

  106. "steppedLine": false,

  107. "targets": [

  108. {

  109. "expr": "canal_instance{destination=~\"$destination\"}",

  110. "format": "time_series",

  111. "instant": true,

  112. "intervalFactor": 1,

  113. "legendFormat": "Destination: { {destination}}",

  114. "refId": "A"

  115. },

  116. {

  117. "expr": "canal_instance_parser_mode{destination=~\"$destination\"}",

  118. "format": "time_series",

  119. "instant": true,

  120. "intervalFactor": 1,

  121. "legendFormat": "Parallel parser: { {parallel}}",

  122. "refId": "B"

  123. },

  124. {

  125. "expr": "canal_instance_store{destination=~\"$destination\"}",

  126. "format": "time_series",

  127. "instant": true,

  128. "intervalFactor": 1,

  129. "legendFormat": "Batch mode: { {batchMode}}",

  130. "refId": "C"

  131. },

  132. {

  133. "expr": "canal_instance_store{destination=~\"$destination\"}",

  134. "format": "time_series",

  135. "instant": true,

  136. "intervalFactor": 1,

  137. "legendFormat": "Buffer size: { {size}}",

  138. "refId": "D"

  139. }

  140. ],

  141. "thresholds": [],

  142. "timeFrom": null,

  143. "timeShift": null,

  144. "title": "Basic",

  145. "tooltip": {

  146. "shared": true,

  147. "sort": 0,

  148. "value_type": "individual"

  149. },

  150. "transparent": true,

  151. "type": "graph",

  152. "xaxis": {

  153. "buckets": null,

  154. "mode": "time",

  155. "name": null,

  156. "show": false,

  157. "values": []

  158. },

  159. "yaxes": [

  160. {

  161. "format": "short",

  162. "label": null,

  163. "logBase": 1,

  164. "max": null,

  165. "min": null,

  166. "show": false

  167. },

  168. {

  169. "format": "short",

  170. "label": null,

  171. "logBase": 1,

  172. "max": null,

  173. "min": null,

  174. "show": false

  175. }

  176. ],

  177. "yaxis": {

  178. "align": false,

  179. "alignLevel": null

  180. }

  181. },

  182. {

  183. "aliasColors": {

  184. "inbound": "#bf1b00"

  185. },

  186. "bars": false,

  187. "dashLength": 10,

  188. "dashes": false,

  189. "datasource": "$datasource",

  190. "description": "Canal instance 网络带宽占用。\ninbound: 读取MySQL binlog.\noutbound: 对Client端传输格式化binlog.",

  191. "fill": 1,

  192. "gridPos": {

  193. "h": 5,

  194. "w": 6,

  195. "x": 6,

  196. "y": 1

  197. },

  198. "id": 6,

  199. "legend": {

  200. "avg": false,

  201. "current": false,

  202. "max": false,

  203. "min": false,

  204. "show": true,

  205. "total": false,

  206. "values": false

  207. },

  208. "lines": true,

  209. "linewidth": 1,

  210. "links": [],

  211. "nullPointMode": "null",

  212. "percentage": false,

  213. "pointradius": 5,

  214. "points": false,

  215. "renderer": "flot",

  216. "seriesOverrides": [],

  217. "spaceLength": 10,

  218. "stack": false,

  219. "steppedLine": false,

  220. "targets": [

  221. {

  222. "expr": "rate(canal_instance_received_binlog_bytes{destination=~\"$destination\", parser=\"0\"}[2m]) / 1024",

  223. "format": "time_series",

  224. "interval": "15s",

  225. "intervalFactor": 2,

  226. "legendFormat": "inbound",

  227. "refId": "A"

  228. },

  229. {

  230. "expr": "rate(canal_instance_client_bytes{destination=~\"$destination\"}[2m]) / 1024",

  231. "format": "time_series",

  232. "interval": "15s",

  233. "intervalFactor": 2,

  234. "legendFormat": "outbound",

  235. "refId": "B"

  236. },

  237. {

  238. "expr": "rate(canal_instance_received_binlog_bytes{destination=~\"$destination\", parser=\"1\"}[2m]) / 1024",

  239. "format": "time_series",

  240. "interval": "15s",

  241. "intervalFactor": 2,

  242. "legendFormat": "inbound-1",

  243. "refId": "C"

  244. },

  245. {

  246. "expr": "rate(canal_instance_received_binlog_bytes{destination=~\"$destination\", parser=\"2\"}[2m]) / 1024",

  247. "format": "time_series",

  248. "interval": "15s",

  249. "intervalFactor": 2,

  250. "legendFormat": "inbound-2",

  251. "refId": "D"

  252. }

  253. ],

  254. "thresholds": [],

  255. "timeFrom": null,

  256. "timeShift": null,

  257. "title": "Network bandwith",

  258. "tooltip": {

  259. "shared": true,

  260. "sort": 0,

  261. "value_type": "individual"

  262. },

  263. "type": "graph",

  264. "xaxis": {

  265. "buckets": null,

  266. "mode": "time",

  267. "name": null,

  268. "show": true,

  269. "values": []

  270. },

  271. "yaxes": [

  272. {

  273. "format": "KBs",

  274. "label": null,

  275. "logBase": 1,

  276. "max": null,

  277. "min": null,

  278. "show": true

  279. },

  280. {

  281. "format": "short",

  282. "label": null,

  283. "logBase": 1,

  284. "max": null,

  285. "min": null,

  286. "show": true

  287. }

  288. ],

  289. "yaxis": {

  290. "align": false,

  291. "alignLevel": null

  292. }

  293. },

  294. {

  295. "aliasColors": {

  296. "ack": "#f29191",

  297. "get": "#cca300",

  298. "put": "#1f78c1"

  299. },

  300. "bars": false,

  301. "dashLength": 10,

  302. "dashes": false,

  303. "datasource": "$datasource",

  304. "description": "master: Canal server相对于MySQL master的延时。通过master heartbeat机制能刷新idle状态下的延时。\nput: store put操作的时间点为基准。\nget: client get操作的时间点为基准。\nack: client ack操作的时间点为基准。",

  305. "fill": 1,

  306. "gridPos": {

  307. "h": 5,

  308. "w": 6,

  309. "x": 12,

  310. "y": 1

  311. },

  312. "id": 4,

  313. "legend": {

  314. "avg": false,

  315. "current": false,

  316. "max": false,

  317. "min": false,

  318. "show": true,

  319. "total": false,

  320. "values": false

  321. },

  322. "lines": true,

  323. "linewidth": 1,

  324. "links": [],

  325. "nullPointMode": "null",

  326. "percentage": false,

  327. "pointradius": 5,

  328. "points": false,

  329. "renderer": "flot",

  330. "seriesOverrides": [],

  331. "spaceLength": 10,

  332. "stack": false,

  333. "steppedLine": false,

  334. "targets": [

  335. {

  336. "expr": "canal_instance_traffic_delay{destination=~\"$destination\"} / 1000",

  337. "format": "time_series",

  338. "hide": false,

  339. "interval": "15s",

  340. "intervalFactor": 2,

  341. "legendFormat": "master",

  342. "refId": "D"

  343. },

  344. {

  345. "expr": "canal_instance_put_delay{destination=~\"$destination\"} / 1000",

  346. "format": "time_series",

  347. "interval": "15s",

  348. "intervalFactor": 2,

  349. "legendFormat": "put",

  350. "refId": "A"

  351. },

  352. {

  353. "expr": "canal_instance_get_delay{destination=~\"$destination\"} / 1000",

  354. "format": "time_series",

  355. "interval": "15s",

  356. "intervalFactor": 2,

  357. "legendFormat": "get",

  358. "refId": "B"

  359. },

  360. {

  361. "expr": "canal_instance_ack_delay{destination=~\"$destination\"} / 1000",

  362. "format": "time_series",

  363. "interval": "15s",

  364. "intervalFactor": 2,

  365. "legendFormat": "ack",

  366. "refId": "C"

  367. }

  368. ],

  369. "thresholds": [],

  370. "timeFrom": null,

  371. "timeShift": null,

  372. "title": "Delay",

  373. "tooltip": {

  374. "shared": true,

  375. "sort": 0,

  376. "value_type": "individual"

  377. },

  378. "type": "graph",

  379. "xaxis": {

  380. "buckets": null,

  381. "mode": "time",

  382. "name": null,

  383. "show": true,

  384. "values": []

  385. },

  386. "yaxes": [

  387. {

  388. "format": "s",

  389. "label": null,

  390. "logBase": 1,

  391. "max": null,

  392. "min": null,

  393. "show": true

  394. },

  395. {

  396. "format": "short",

  397. "label": null,

  398. "logBase": 1,

  399. "max": null,

  400. "min": null,

  401. "show": true

  402. }

  403. ],

  404. "yaxis": {

  405. "align": false,

  406. "alignLevel": null

  407. }

  408. },

  409. {

  410. "aliasColors": {},

  411. "bars": false,

  412. "dashLength": 10,

  413. "dashes": false,

  414. "datasource": "$datasource",

  415. "description": "sink线程blocking占比;dump线程blocking占比(仅parallel mode)。",

  416. "fill": 1,

  417. "gridPos": {

  418. "h": 5,

  419. "w": 6,

  420. "x": 18,

  421. "y": 1

  422. },

  423. "hideTimeOverride": false,

  424. "id": 2,

  425. "legend": {

  426. "avg": false,

  427. "current": false,

  428. "max": false,

  429. "min": false,

  430. "show": true,

  431. "total": false,

  432. "values": false

  433. },

  434. "lines": true,

  435. "linewidth": 1,

  436. "links": [],

  437. "nullPointMode": "null",

  438. "percentage": false,

  439. "pointradius": 5,

  440. "points": false,

  441. "renderer": "flot",

  442. "seriesOverrides": [],

  443. "spaceLength": 10,

  444. "stack": false,

  445. "steppedLine": false,

  446. "targets": [

  447. {

  448. "expr": "clamp_max(rate(canal_instance_publish_blocking_time{destination=~\"$destination\", parser=\"0\"}[2m]), 1000) / 10",

  449. "format": "time_series",

  450. "interval": "15s",

  451. "intervalFactor": 2,

  452. "legendFormat": "dump",

  453. "refId": "B"

  454. },

  455. {

  456. "expr": "clamp_max(rate(canal_instance_sink_blocking_time{destination=~\"$destination\"}[2m]), 1000) / 10",

  457. "format": "time_series",

  458. "interval": "15s",

  459. "intervalFactor": 2,

  460. "legendFormat": "sink",

  461. "refId": "A"

  462. },

  463. {

  464. "expr": "clamp_max(rate(canal_instance_publish_blocking_time{destination=~\"$destination\", parser=\"1\"}[2m]), 1000) / 10",

  465. "format": "time_series",

  466. "interval": "15s",

  467. "intervalFactor": 2,

  468. "legendFormat": "dump-1",

  469. "refId": "C"

  470. },

  471. {

  472. "expr": "clamp_max(rate(canal_instance_publish_blocking_time{destination=~\"$destination\", parser=\"2\"}[2m]), 1000) / 10",

  473. "format": "time_series",

  474. "interval": "15s",

  475. "intervalFactor": 2,

  476. "legendFormat": "dump-2",

  477. "refId": "D"

  478. }

  479. ],

  480. "thresholds": [],

  481. "timeFrom": null,

  482. "timeShift": null,

  483. "title": "Blocking",

  484. "tooltip": {

  485. "shared": true,

  486. "sort": 0,

  487. "value_type": "individual"

  488. },

  489. "type": "graph",

  490. "xaxis": {

  491. "buckets": null,

  492. "mode": "time",

  493. "name": null,

  494. "show": true,

  495. "values": []

  496. },

  497. "yaxes": [

  498. {

  499. "format": "percent",

  500. "label": null,

  501. "logBase": 1,

  502. "max": null,

  503. "min": null,

  504. "show": true

  505. },

  506. {

  507. "format": "short",

  508. "label": null,

  509. "logBase": 1,

  510. "max": null,

  511. "min": null,

  512. "show": true

  513. }

  514. ],

  515. "yaxis": {

  516. "align": false,

  517. "alignLevel": null

  518. }

  519. },

  520. {

  521. "collapsed": false,

  522. "gridPos": {

  523. "h": 1,

  524. "w": 24,

  525. "x": 0,

  526. "y": 6

  527. },

  528. "id": 32,

  529. "panels": [],

  530. "title": "Throughput",

  531. "type": "row"

  532. },

  533. {

  534. "aliasColors": {

  535. "rowDatas": "#7eb26d",

  536. "tableRows": "#c15c17"

  537. },

  538. "bars": false,

  539. "dashLength": 10,

  540. "dashes": false,

  541. "datasource": "$datasource",

  542. "description": "Instance处理binlog的TPS(以master变更行数table rows为基准计算)。\nput: put操作TPS。\nget: get操作TPS。\nack: ack操作TPS。",

  543. "fill": 1,

  544. "gridPos": {

  545. "h": 5,

  546. "w": 6,

  547. "x": 0,

  548. "y": 7

  549. },

  550. "id": 14,

  551. "legend": {

  552. "avg": false,

  553. "current": false,

  554. "max": false,

  555. "min": false,

  556. "show": true,

  557. "total": false,

  558. "values": false

  559. },

  560. "lines": true,

  561. "linewidth": 1,

  562. "links": [],

  563. "nullPointMode": "null",

  564. "percentage": false,

  565. "pointradius": 5,

  566. "points": false,

  567. "renderer": "flot",

  568. "seriesOverrides": [],

  569. "spaceLength": 10,

  570. "stack": false,

  571. "steppedLine": false,

  572. "targets": [

  573. {

  574. "expr": "rate(canal_instance_put_rows{destination=~\"$destination\"}[2m])",

  575. "format": "time_series",

  576. "interval": "15s",

  577. "intervalFactor": 2,

  578. "legendFormat": "put",

  579. "refId": "A"

  580. },

  581. {

  582. "expr": "rate(canal_instance_get_rows{destination=~\"$destination\"}[2m])",

  583. "format": "time_series",

  584. "interval": "15s",

  585. "intervalFactor": 2,

  586. "legendFormat": "get",

  587. "refId": "B"

  588. },

  589. {

  590. "expr": "rate(canal_instance_ack_rows{destination=~\"$destination\"}[2m])",

  591. "format": "time_series",

  592. "intervalFactor": 1,

  593. "legendFormat": "ack",

  594. "refId": "C"

  595. }

  596. ],

  597. "thresholds": [],

  598. "timeFrom": null,

  599. "timeShift": null,

  600. "title": "TPS(table rows)",

  601. "tooltip": {

  602. "shared": true,

  603. "sort": 0,

  604. "value_type": "individual"

  605. },

  606. "type": "graph",

  607. "xaxis": {

  608. "buckets": null,

  609. "mode": "time",

  610. "name": null,

  611. "show": true,

  612. "values": []

  613. },

  614. "yaxes": [

  615. {

  616. "format": "iops",

  617. "label": null,

  618. "logBase": 1,

  619. "max": null,

  620. "min": null,

  621. "show": true

  622. },

  623. {

  624. "format": "short",

  625. "label": null,

  626. "logBase": 1,

  627. "max": null,

  628. "min": null,

  629. "show": true

  630. }

  631. ],

  632. "yaxis": {

  633. "align": false,

  634. "alignLevel": null

  635. }

  636. },

  637. {

  638. "aliasColors": {

  639. "transactions": "#f9ba8f"

  640. },

  641. "bars": false,

  642. "dashLength": 10,

  643. "dashes": false,

  644. "datasource": "$datasource",

  645. "description": "Canal instance 处理binlog的TPS,以MySQL transaction为单位计算。",

  646. "fill": 1,

  647. "gridPos": {

  648. "h": 5,

  649. "w": 6,

  650. "x": 6,

  651. "y": 7

  652. },

  653. "id": 12,

  654. "legend": {

  655. "avg": false,

  656. "current": false,

  657. "max": false,

  658. "min": false,

  659. "show": true,

  660. "total": false,

  661. "values": false

  662. },

  663. "lines": true,

  664. "linewidth": 1,

  665. "links": [],

  666. "nullPointMode": "null",

  667. "percentage": false,

  668. "pointradius": 5,

  669. "points": false,

  670. "renderer": "flot",

  671. "seriesOverrides": [],

  672. "spaceLength": 10,

  673. "stack": false,

  674. "steppedLine": false,

  675. "targets": [

  676. {

  677. "expr": "rate(canal_instance_transactions{destination=~\"$destination\"}[2m])",

  678. "format": "time_series",

  679. "interval": "15s",

  680. "intervalFactor": 2,

  681. "legendFormat": "transactions",

  682. "refId": "A"

  683. }

  684. ],

  685. "thresholds": [],

  686. "timeFrom": null,

  687. "timeShift": null,

  688. "title": "TPS(MySQL transaction)",

  689. "tooltip": {

  690. "shared": true,

  691. "sort": 0,

  692. "value_type": "individual"

  693. },

  694. "type": "graph",

  695. "xaxis": {

  696. "buckets": null,

  697. "mode": "time",

  698. "name": null,

  699. "show": true,

  700. "values": []

  701. },

  702. "yaxes": [

  703. {

  704. "format": "iops",

  705. "label": null,

  706. "logBase": 1,

  707. "max": null,

  708. "min": null,

  709. "show": true

  710. },

  711. {

  712. "format": "short",

  713. "label": null,

  714. "logBase": 1,

  715. "max": null,

  716. "min": null,

  717. "show": true

  718. }

  719. ],

  720. "yaxis": {

  721. "align": false,

  722. "alignLevel": null

  723. }

  724. },

  725. {

  726. "collapsed": false,

  727. "gridPos": {

  728. "h": 1,

  729. "w": 24,

  730. "x": 0,

  731. "y": 12

  732. },

  733. "id": 34,

  734. "panels": [],

  735. "title": "Client",

  736. "type": "row"

  737. },

  738. {

  739. "aliasColors": {},

  740. "bars": false,

  741. "dashLength": 10,

  742. "dashes": false,

  743. "datasource": "$datasource",

  744. "description": "Canal instance接收到的请求统计,结果按packet type分类。",

  745. "fill": 1,

  746. "gridPos": {

  747. "h": 5,

  748. "w": 6,

  749. "x": 0,

  750. "y": 13

  751. },

  752. "id": 16,

  753. "legend": {

  754. "avg": false,

  755. "current": false,

  756. "max": false,

  757. "min": false,

  758. "show": true,

  759. "total": false,

  760. "values": false

  761. },

  762. "lines": true,

  763. "linewidth": 1,

  764. "links": [],

  765. "nullPointMode": "null",

  766. "percentage": false,

  767. "pointradius": 5,

  768. "points": false,

  769. "renderer": "flot",

  770. "seriesOverrides": [],

  771. "spaceLength": 10,

  772. "stack": false,

  773. "steppedLine": false,

  774. "targets": [

  775. {

  776. "expr": "canal_instance_client_packets{destination=~\"$destination\"}",

  777. "format": "time_series",

  778. "interval": "15s",

  779. "intervalFactor": 2,

  780. "legendFormat": "{ {packetType}}",

  781. "refId": "A"

  782. }

  783. ],

  784. "thresholds": [],

  785. "timeFrom": null,

  786. "timeShift": null,

  787. "title": "Client requests",

  788. "tooltip": {

  789. "shared": true,

  790. "sort": 0,

  791. "value_type": "individual"

  792. },

  793. "type": "graph",

  794. "xaxis": {

  795. "buckets": null,

  796. "mode": "time",

  797. "name": null,

  798. "show": true,

  799. "values": []

  800. },

  801. "yaxes": [

  802. {

  803. "format": "none",

  804. "label": null,

  805. "logBase": 1,

  806. "max": null,

  807. "min": null,

  808. "show": true

  809. },

  810. {

  811. "format": "short",

  812. "label": null,

  813. "logBase": 1,

  814. "max": null,

  815. "min": null,

  816. "show": true

  817. }

  818. ],

  819. "yaxis": {

  820. "align": false,

  821. "alignLevel": null

  822. }

  823. },

  824. {

  825. "aliasColors": {},

  826. "bars": false,

  827. "dashLength": 10,

  828. "dashes": false,

  829. "datasource": "$datasource",

  830. "description": "client 请求的GET与ACK包的QPS。",

  831. "fill": 1,

  832. "gridPos": {

  833. "h": 5,

  834. "w": 6,

  835. "x": 6,

  836. "y": 13

  837. },

  838. "id": 38,

  839. "legend": {

  840. "avg": false,

  841. "current": false,

  842. "max": false,

  843. "min": false,

  844. "show": true,

  845. "total": false,

  846. "values": false

  847. },

  848. "lines": true,

  849. "linewidth": 1,

  850. "links": [],

  851. "nullPointMode": "null",

  852. "percentage": false,

  853. "pointradius": 5,

  854. "points": false,

  855. "renderer": "flot",

  856. "seriesOverrides": [],

  857. "spaceLength": 10,

  858. "stack": false,

  859. "steppedLine": false,

  860. "targets": [

  861. {

  862. "expr": "rate(canal_instance_client_packets{destination=~\"$destination\",packetType=\"GET\"}[2m])",

  863. "format": "time_series",

  864. "interval": "15s",

  865. "intervalFactor": 2,

  866. "legendFormat": "GET",

  867. "refId": "A"

  868. },

  869. {

  870. "expr": "rate(canal_instance_client_packets{destination=~\"$destination\",packetType=\"CLIENTACK\"}[2m])",

  871. "format": "time_series",

  872. "interval": "15s",

  873. "intervalFactor": 2,

  874. "legendFormat": "ACK",

  875. "refId": "B"

  876. }

  877. ],

  878. "thresholds": [],

  879. "timeFrom": null,

  880. "timeShift": null,

  881. "title": "Client QPS",

  882. "tooltip": {

  883. "shared": true,

  884. "sort": 0,

  885. "value_type": "individual"

  886. },

  887. "type": "graph",

  888. "xaxis": {

  889. "buckets": null,

  890. "mode": "time",

  891. "name": null,

  892. "show": true,

  893. "values": []

  894. },

  895. "yaxes": [

  896. {

  897. "format": "short",

  898. "label": null,

  899. "logBase": 1,

  900. "max": null,

  901. "min": null,

  902. "show": true

  903. },

  904. {

  905. "format": "short",

  906. "label": null,

  907. "logBase": 1,

  908. "max": null,

  909. "min": null,

  910. "show": true

  911. }

  912. ],

  913. "yaxis": {

  914. "align": false,

  915. "alignLevel": null

  916. }

  917. },

  918. {

  919. "aliasColors": {},

  920. "bars": false,

  921. "dashLength": 10,

  922. "dashes": false,

  923. "datasource": "$datasource",

  924. "description": "server响应GET请求,但返回空包的占比。",

  925. "fill": 1,

  926. "gridPos": {

  927. "h": 5,

  928. "w": 6,

  929. "x": 12,

  930. "y": 13

  931. },

  932. "id": 26,

  933. "legend": {

  934. "avg": false,

  935. "current": false,

  936. "max": false,

  937. "min": false,

  938. "show": true,

  939. "total": false,

  940. "values": false

  941. },

  942. "lines": true,

  943. "linewidth": 1,

  944. "links": [],

  945. "nullPointMode": "null",

  946. "percentage": false,

  947. "pointradius": 5,

  948. "points": false,

  949. "renderer": "flot",

  950. "seriesOverrides": [],

  951. "spaceLength": 10,

  952. "stack": false,

  953. "steppedLine": false,

  954. "targets": [

  955. {

  956. "expr": "rate(canal_instance_client_empty_batches{destination=~\"$destination\"}[2m])",

  957. "format": "time_series",

  958. "interval": "15s",

  959. "intervalFactor": 2,

  960. "legendFormat": "empty",

  961. "refId": "A"

  962. },

  963. {

  964. "expr": "rate(canal_instance_client_packets{destination=~\"$destination\", packetType=\"GET\"}[2m])",

  965. "format": "time_series",

  966. "intervalFactor": 1,

  967. "legendFormat": "nonempty",

  968. "refId": "B"

  969. }

  970. ],

  971. "thresholds": [],

  972. "timeFrom": null,

  973. "timeShift": null,

  974. "title": "Empty packets",

  975. "tooltip": {

  976. "shared": true,

  977. "sort": 0,

  978. "value_type": "individual"

  979. },

  980. "type": "graph",

  981. "xaxis": {

  982. "buckets": null,

  983. "mode": "time",

  984. "name": null,

  985. "show": true,

  986. "values": []

  987. },

  988. "yaxes": [

  989. {

  990. "format": "wps",

  991. "label": null,

  992. "logBase": 1,

  993. "max": null,

  994. "min": null,

  995. "show": true

  996. },

  997. {

  998. "format": "short",

  999. "label": null,

  1000. "logBase": 1,

  1001. "max": null,

  1002. "min": null,

  1003. "show": true

  1004. }

  1005. ],

  1006. "yaxis": {

  1007. "align": false,

  1008. "alignLevel": null

  1009. }

  1010. },

  1011. {

  1012. "aliasColors": {},

  1013. "bars": false,

  1014. "dashLength": 10,

  1015. "dashes": false,

  1016. "datasource": "$datasource",

  1017. "description": "Canal client 请求响应时间的概况。",

  1018. "fill": 1,

  1019. "gridPos": {

  1020. "h": 5,

  1021. "w": 6,

  1022. "x": 18,

  1023. "y": 13

  1024. },

  1025. "id": 18,

  1026. "legend": {

  1027. "alignAsTable": false,

  1028. "avg": false,

  1029. "current": false,

  1030. "max": false,

  1031. "min": false,

  1032. "rightSide": false,

  1033. "show": true,

  1034. "total": false,

  1035. "values": false

  1036. },

  1037. "lines": true,

  1038. "linewidth": 1,

  1039. "links": [],

  1040. "nullPointMode": "null",

  1041. "percentage": false,

  1042. "pointradius": 5,

  1043. "points": false,

  1044. "renderer": "flot",

  1045. "seriesOverrides": [

  1046. {

  1047. "alias": "25.0",

  1048. "yaxis": 1

  1049. },

  1050. {

  1051. "alias": "100.0",

  1052. "yaxis": 1

  1053. }

  1054. ],

  1055. "spaceLength": 10,

  1056. "stack": false,

  1057. "steppedLine": false,

  1058. "targets": [

  1059. {

  1060. "expr": "rate(canal_instance_client_request_latency_bucket{destination=~\"$destination\"}[2m])",

  1061. "format": "time_series",

  1062. "hide": false,

  1063. "interval": "15s",

  1064. "intervalFactor": 2,

  1065. "legendFormat": "{ {le}}ms",

  1066. "refId": "A"

  1067. }

  1068. ],

  1069. "thresholds": [],

  1070. "timeFrom": null,

  1071. "timeShift": null,

  1072. "title": "Response time",

  1073. "tooltip": {

  1074. "shared": true,

  1075. "sort": 0,

  1076. "value_type": "individual"

  1077. },

  1078. "transparent": false,

  1079. "type": "graph",

  1080. "xaxis": {

  1081. "buckets": null,

  1082. "mode": "time",

  1083. "name": null,

  1084. "show": true,

  1085. "values": []

  1086. },

  1087. "yaxes": [

  1088. {

  1089. "format": "short",

  1090. "label": null,

  1091. "logBase": 1,

  1092. "max": null,

  1093. "min": null,

  1094. "show": true

  1095. },

  1096. {

  1097. "format": "short",

  1098. "label": null,

  1099. "logBase": 1,

  1100. "max": null,

  1101. "min": null,

  1102. "show": true

  1103. }

  1104. ],

  1105. "yaxis": {

  1106. "align": false,

  1107. "alignLevel": null

  1108. }

  1109. },

  1110. {

  1111. "collapsed": false,

  1112. "gridPos": {

  1113. "h": 1,

  1114. "w": 24,

  1115. "x": 0,

  1116. "y": 18

  1117. },

  1118. "id": 36,

  1119. "panels": [],

  1120. "title": "Store",

  1121. "type": "row"

  1122. },

  1123. {

  1124. "aliasColors": {},

  1125. "bars": false,

  1126. "dashLength": 10,

  1127. "dashes": false,

  1128. "datasource": "$datasource",

  1129. "description": "Canal instance ringbuffer内未释放的events数量。",

  1130. "fill": 1,

  1131. "gridPos": {

  1132. "h": 5,

  1133. "w": 6,

  1134. "x": 0,

  1135. "y": 19

  1136. },

  1137. "id": 20,

  1138. "legend": {

  1139. "avg": false,

  1140. "current": false,

  1141. "max": false,

  1142. "min": false,

  1143. "show": true,

  1144. "total": false,

  1145. "values": false

  1146. },

  1147. "lines": true,

  1148. "linewidth": 1,

  1149. "links": [],

  1150. "nullPointMode": "null",

  1151. "percentage": false,

  1152. "pointradius": 5,

  1153. "points": false,

  1154. "renderer": "flot",

  1155. "seriesOverrides": [],

  1156. "spaceLength": 10,

  1157. "stack": false,

  1158. "steppedLine": false,

  1159. "targets": [

  1160. {

  1161. "expr": "canal_instance_store_produce_seq{destination=~\"$destination\"} - canal_instance_store_consume_seq{destination=~\"$destination\"}",

  1162. "format": "time_series",

  1163. "interval": "15s",

  1164. "intervalFactor": 2,

  1165. "legendFormat": "events",

  1166. "refId": "A"

  1167. }

  1168. ],

  1169. "thresholds": [],

  1170. "timeFrom": null,

  1171. "timeShift": null,

  1172. "title": "Store remain events",

  1173. "tooltip": {

  1174. "shared": true,

  1175. "sort": 0,

  1176. "value_type": "individual"

  1177. },

  1178. "type": "graph",

  1179. "xaxis": {

  1180. "buckets": null,

  1181. "mode": "time",

  1182. "name": null,

  1183. "show": true,

  1184. "values": []

  1185. },

  1186. "yaxes": [

  1187. {

  1188. "decimals": null,

  1189. "format": "none",

  1190. "label": "",

  1191. "logBase": 1,

  1192. "max": null,

  1193. "min": null,

  1194. "show": true

  1195. },

  1196. {

  1197. "decimals": null,

  1198. "format": "short",

  1199. "label": null,

  1200. "logBase": 1,

  1201. "max": null,

  1202. "min": null,

  1203. "show": true

  1204. }

  1205. ],

  1206. "yaxis": {

  1207. "align": false,

  1208. "alignLevel": null

  1209. }

  1210. },

  1211. {

  1212. "aliasColors": {},

  1213. "bars": false,

  1214. "dashLength": 10,

  1215. "dashes": false,

  1216. "datasource": "$datasource",

  1217. "description": "Canal instance ringbuffer 内未释放events占用内存。",

  1218. "fill": 1,

  1219. "gridPos": {

  1220. "h": 5,

  1221. "w": 6,

  1222. "x": 6,

  1223. "y": 19

  1224. },

  1225. "id": 22,

  1226. "legend": {

  1227. "avg": false,

  1228. "current": false,

  1229. "max": false,

  1230. "min": false,

  1231. "show": true,

  1232. "total": false,

  1233. "values": false

  1234. },

  1235. "lines": true,

  1236. "linewidth": 1,

  1237. "links": [],

  1238. "nullPointMode": "null",

  1239. "percentage": false,

  1240. "pointradius": 5,

  1241. "points": false,

  1242. "renderer": "flot",

  1243. "seriesOverrides": [],

  1244. "spaceLength": 10,

  1245. "stack": false,

  1246. "steppedLine": false,

  1247. "targets": [

  1248. {

  1249. "expr": "(canal_instance_store_produce_mem{destination=~\"$destination\"} - canal_instance_store_consume_mem{destination=~\"$destination\"}) / 1024",

  1250. "format": "time_series",

  1251. "interval": "15s",

  1252. "intervalFactor": 2,

  1253. "legendFormat": "memsize",

  1254. "refId": "A"

  1255. }

  1256. ],

  1257. "thresholds": [],

  1258. "timeFrom": null,

  1259. "timeShift": null,

  1260. "title": "Store remain mem",

  1261. "tooltip": {

  1262. "shared": true,

  1263. "sort": 0,

  1264. "value_type": "individual"

  1265. },

  1266. "type": "graph",

  1267. "xaxis": {

  1268. "buckets": null,

  1269. "mode": "time",

  1270. "name": null,

  1271. "show": true,

  1272. "values": []

  1273. },

  1274. "yaxes": [

  1275. {

  1276. "format": "deckbytes",

  1277. "label": null,

  1278. "logBase": 1,

  1279. "max": null,

  1280. "min": null,

  1281. "show": true

  1282. },

  1283. {

  1284. "format": "short",

  1285. "label": null,

  1286. "logBase": 1,

  1287. "max": null,

  1288. "min": null,

  1289. "show": true

  1290. }

  1291. ],

  1292. "yaxis": {

  1293. "align": false,

  1294. "alignLevel": null

  1295. }

  1296. }

  1297. ],

  1298. "refresh": false,

  1299. "schemaVersion": 16,

  1300. "style": "dark",

  1301. "tags": [

  1302. "canal"

  1303. ],

  1304. "templating": {

  1305. "list": [

  1306. {

  1307. "current": {

  1308. "text": "prometheus",

  1309. "value": "prometheus"

  1310. },

  1311. "hide": 0,

  1312. "label": "datasource",

  1313. "name": "datasource",

  1314. "options": [],

  1315. "query": "prometheus",

  1316. "refresh": 1,

  1317. "regex": "",

  1318. "type": "datasource"

  1319. },

  1320. {

  1321. "allValue": null,

  1322. "current": {},

  1323. "datasource": "$datasource",

  1324. "hide": 0,

  1325. "includeAll": false,

  1326. "label": "destination",

  1327. "multi": false,

  1328. "name": "destination",

  1329. "options": [],

  1330. "query": "label_values(canal_instance, destination)",

  1331. "refresh": 1,

  1332. "regex": "",

  1333. "sort": 0,

  1334. "tagValuesQuery": "",

  1335. "tags": [],

  1336. "tagsQuery": "",

  1337. "type": "query",

  1338. "useTags": false

  1339. }

  1340. ]

  1341. },

  1342. "time": {

  1343. "from": "now-6h",

  1344. "to": "now"

  1345. },

  1346. "timepicker": {

  1347. "refresh_intervals": [

  1348. "5s",

  1349. "10s",

  1350. "30s",

  1351. "1m",

  1352. "5m",

  1353. "15m",

  1354. "30m",

  1355. "1h",

  1356. "2h",

  1357. "1d"

  1358. ],

  1359. "time_options": [

  1360. "5m",

  1361. "15m",

  1362. "1h",

  1363. "6h",

  1364. "12h",

  1365. "24h",

  1366. "2d",

  1367. "7d",

  1368. "30d"

  1369. ]

  1370. },

  1371. "timezone": "",

  1372. "title": "Canal instances",

  1373. "uid": "8vh8NGpiz",

  1374. "version": 103

  1375. }

猜你喜欢

转载自blog.csdn.net/u011250186/article/details/113133741