Nightingale采集插件prometheus的mysqld_exporter&&redis_exporter安装

12 篇文章 0 订阅
5 篇文章 0 订阅

0、prometheus/mysqld_exporter

Prometheus exporter for MySQL server metrics.

Supported versions:

  • MySQL >= 5.6.
  • MariaDB >= 10.1

NOTE: Not all collection methods are supported on MySQL/MariaDB < 5.6

一、centos7 Mariadb5.5升级到Mariadb10.2

升级过程,在此记录下。

原因:由于prometheus/mysqld_exporter对MySQL的版本要求需要新的数据库版本支持。

升级主要步骤:

备份原数据库 ---》卸载mariadb ---》添加mariadb国内yum源 ---》安装mariadb---》初始化数据库---》导入数据。

1. 备份原数据库

   由于数据库进行升级,需要迁移的数据库的数据到sql文件里。

#备份数据库语句格式:mysqldump  -uroot  -p  --database database_name >name.sql
[root@nightingale sql_bk]# pwd
/root/gopath/src/github.com/sql_bk
[root@nightingale sql_bk]# mysqldump  -uroot  -pproot --database n9e_hbs > n9e_hbs.sql
[root@nightingale sql_bk]# mysqldump  -uroot  -proot  --database n9e_mon > n9e_mon.sql
[root@nightingale sql_bk]# mysqldump  -uroot  -proot  --database n9e_uic > n9e_uic.sql
[root@nightingale sql_bk]# mysqldump  -uroot  -proot  --database mysql > mysql.sql
[root@nightingale sql_bk]# ll
    -rw-r--r-- 1 root root  514427 7月  21 20:37 mysql.sql
    -rw-r--r-- 1 root root    2393 7月  21 20:35 n9e_hbs.sql
    -rw-r--r-- 1 root root 2784544 7月  21 20:36 n9e_mon.sql
    -rw-r--r-- 1 root root    4905 7月  21 20:36 n9e_uic.sql

2. 卸载mariadb

   由于是在同一台服务器进行安装新的Mariadb10.2,所以我们需要将老的版本卸载。

#卸载mariadb
[root@nightingale sql_bk]# yum remove mariadb -y
#删除配置文件:
[root@nightingale sql_bk]# rm -f /etc/my.cnf
#删除数据目录:
[root@nightingale sql_bk]# rm -rf /var/lib/mysql/

3. 添加mariadb10.2的国内yum源

#之前我添加的是国外的源,安装很耗时,所以我找到国内yum源,通过这个源安装较快。
[root@nightingale sql_bk]# vim  /etc/yum.repos.d/Mariadb.repo
    #添加以下内容:
    [mariadb]
    name = MariaDB
    baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.2/centos7-amd64
    gpgkey=https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
    gpgcheck=1
[root@nightingale sql_bk]#yum clean all    #清除yum源缓存数据
[root@nightingale sql_bk]#yum makecache all    #生成新的yum源数据缓存

官方yum源(国内安装较慢)

1

2

3

4

5

6

7

# MariaDB 10.2 CentOS repository list - created 2018-06-06 03:42 UTC

# http://downloads.mariadb.org/mariadb/repositories/

[mariadb]

name = MariaDB

baseurl = http://yum.mariadb.org/10.2/centos7-amd64

gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

gpgcheck=1

官方不同系统yum源网址:https://downloads.mariadb.org/mariadb/repositories/#mirror=tuna

4. 安装mariadb10.2

#安装mariadb10.2
[root@nightingale sql_bk]# yum install MariaDB-server MariaDB-client -y
#启动、添加开机自启、查看运行状态
[root@nightingale sql_bk]# systemctl start mariadb.service
[root@nightingale sql_bk]# systemctl enable mariadb.service
[root@nightingale sql_bk]# systemctl status mariadb.service

5. mariadb的初始化

[root@nightingale sql_bk]# /usr/bin/mysql_secure_installation

Enter current password for root (enter for none): Just press the Enter button
Set root password? [Y/n]: Y
New password: your-MariaDB-root-password
Re-enter new password: your-MariaDB-root-password
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: n
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y


[root@nightingale sql_bk]# mysql_secure_installation #设置数据库用户名、密码以及其他选项
#一般建议按以下进行配置:
 
...
 
Enter current password for root (enter for none): #直接回车
 
...
 
Set root password?[Y/n] Y #配置文件默认密码是1234
 
New password:root
 
Re-enter new password:root
 
...
 
Remove anonymous users?[Y/n]Y
 
...
 
Disallow root login remotely?[Y/n]n
 
...
 
Reload privilege tables now?[Y/n]Y
 
...
 
Thanks for using MariaDB!
 
[root@nightingale sql_bk]# 

6. 导入数据到新版本mariadb

方法一:登陆mysql后用source命令:(后面跟的是我们备份的sql文件的路径)

格式:source /root/backup/name.sql
[root@nightingale sql_bk]# source /root/gopath/src/github.com/sql_bk/mysql.sql
[root@nightingale sql_bk]# source /root/gopath/src/github.com/sql_bk/n9e_hbs.sql
[root@nightingale sql_bk]# source /root/gopath/src/github.com/sql_bk/n9e_uic.sql
[root@nightingale sql_bk]# source /root/gopath/src/github.com/sql_bk/n9e_mon.sql


方法二:在命令行直接导入

格式:mysql -uroot -p < /root/backup/name.sql
[root@nightingale sql_bk]# mysql -uroot -proot < mysql.sql 
[root@nightingale sql_bk]# mysql -uroot -proot < n9e_hbs.sql 
[root@nightingale sql_bk]# mysql -uroot -proot < n9e_uic.sql 
[root@nightingale sql_bk]# mysql -uroot -proot < n9e_mon.sql

以上就是整个版本升级的过程了。



二、安装mysqld_exporter

 

1.以下为安装过程

[root@nightingale github.com]# pwd	#当前工作目录
	/root/gopath/src/github.com
[root@nightingale github.com]# git clone https://github.com/prometheus/mysqld_exporter.git	#克隆mysqld_exporter
[root@nightingale github.com]# ll	#查看拉取结果
	drwxr-xr-x 7 root root 4096 7月  21 21:35 mysqld_exporter
[root@nightingale github.com]# cd mysqld_exporter/	#进入mysqld_exporter
[root@nightingale mysqld_exporter]# ll	#查看mysqld_exporter的目录结构
	-rw-r--r-- 1 root root     9226 7月  21 21:32 CHANGELOG.md
	-rw-r--r-- 1 root root      155 7月  21 21:32 CODE_OF_CONDUCT.md
	drwxr-xr-x 2 root root     4096 7月  21 21:32 collector
	-rw-r--r-- 1 root root     1006 7月  21 21:32 CONTRIBUTING.md
	-rw-r--r-- 1 root root      229 7月  21 21:32 docker-compose.yml
	-rw-r--r-- 1 root root      329 7月  21 21:32 Dockerfile
	-rw-r--r-- 1 root root     3235 7月  21 21:32 example.rules
	-rw-r--r-- 1 root root     2829 7月  21 21:32 example.rules.yml
	-rw-r--r-- 1 root root      574 7月  21 21:32 go.mod
	-rw-r--r-- 1 root root    43092 7月  21 21:32 go.sum
	-rw-r--r-- 1 root root    11357 7月  21 21:32 LICENSE
	-rw-r--r-- 1 root root       32 7月  21 21:32 MAINTAINERS.md
	-rw-r--r-- 1 root root      923 7月  21 21:32 Makefile
	-rw-r--r-- 1 root root     9807 7月  21 21:32 Makefile.common
	-rw-r--r-- 1 root root    10588 7月  21 21:32 mysqld_exporter.go
	-rw-r--r-- 1 root root     7367 7月  21 21:32 mysqld_exporter_test.go
	-rw-r--r-- 1 root root       65 7月  21 21:32 NOTICE
	-rw-r--r-- 1 root root    11663 7月  21 21:32 README.md
	-rwxr-xr-x 1 root root      682 7月  21 21:32 test_image.sh
	drwxr-xr-x 6 root root      102 7月  21 21:32 vendor
	-rw-r--r-- 1 root root        7 7月  21 21:32 VERSION
[root@nightingale mysqld_exporter]# go build	#编译,编译后会生成一个mysqld_exporter可执行执行文件
[root@nightingale mysqld_exporter]# ll
	-rw-r--r-- 1 root root     9226 7月  21 21:32 CHANGELOG.md
	-rw-r--r-- 1 root root      155 7月  21 21:32 CODE_OF_CONDUCT.md
	drwxr-xr-x 2 root root     4096 7月  21 21:32 collector
	-rw-r--r-- 1 root root     1006 7月  21 21:32 CONTRIBUTING.md
	-rw-r--r-- 1 root root      229 7月  21 21:32 docker-compose.yml
	-rw-r--r-- 1 root root      329 7月  21 21:32 Dockerfile
	-rw-r--r-- 1 root root     3235 7月  21 21:32 example.rules
	-rw-r--r-- 1 root root     2829 7月  21 21:32 example.rules.yml
	-rw-r--r-- 1 root root      574 7月  21 21:32 go.mod
	-rw-r--r-- 1 root root    43092 7月  21 21:32 go.sum
	-rw-r--r-- 1 root root    11357 7月  21 21:32 LICENSE
	-rw-r--r-- 1 root root       32 7月  21 21:32 MAINTAINERS.md
	-rw-r--r-- 1 root root      923 7月  21 21:32 Makefile
	-rw-r--r-- 1 root root     9807 7月  21 21:32 Makefile.common
	-rwxr-xr-x 1 root root 16172381 7月  21 21:35 mysqld_exporter
	-rw-r--r-- 1 root root    10588 7月  21 21:32 mysqld_exporter.go
	-rw-r--r-- 1 root root     7367 7月  21 21:32 mysqld_exporter_test.go
	-rw-r--r-- 1 root root       65 7月  21 21:32 NOTICE
	-rw-r--r-- 1 root root    11663 7月  21 21:32 README.md
	-rwxr-xr-x 1 root root      682 7月  21 21:32 test_image.sh
	drwxr-xr-x 6 root root      102 7月  21 21:32 vendor
	-rw-r--r-- 1 root root        7 7月  21 21:32 VERSION
[root@nightingale mysqld_exporter]# vim /usr/lib/systemd/system/mysqld_exporter.service
	[Unit]
	Description=mysqld_exporter
	After=network.target
	[Service]
	Type=simple
	User=root
	Environment=DATA_SOURCE_NAME=root:root@(localhost:3306)/
	ExecStart=/root/gopath/src/github.com/mysqld_exporter/mysqld_exporter --web.listen-address=0.0.0.0:9104
	 --config.my-cnf /etc/my.cnf \
	 --collect.slave_status \
	 --collect.slave_hosts \
	 --log.level=error \
	 --collect.info_schema.processlist \
	 --collect.info_schema.innodb_metrics \
	 --collect.info_schema.innodb_tablespaces \
	 --collect.info_schema.innodb_cmp \
	 --collect.info_schema.innodb_cmpmem \
	Restart=on-failure
	[Install]
	WantedBy=multi-user.target
[root@nightingale mysqld_exporter]# systemctl start mysqld_exporter.service    #启动mysqld_exporter
[root@nightingale mysqld_exporter]# systemctl status mysqld_exporter.service    #查看mysqld_exporter启动状态

2.启动好mysqld_exporter服务,访问http://ip:9104,效果展示如下图:

本例:http://192.168.21.145:9104/metrics

 



三、安装Prometheus-exporter-collector

 

1.安装过程

[root@nightingale github.com]# mkdir n9e
[root@nightingale github.com]# pwd
    /root/gopath/src/github.com/n9e
[root@nightingale github.com]# ll
    drwxr-xr-x 7 root root 4096 7月  21 21:35 mysqld_exporter
    drwxr-xr-x 3 root root   43 7月  21 19:52 n9e
    drwxr-xr-x 2 root root   80 7月  21 21:09 sql_bk
[root@nightingale github.com]# cd n9e/
[root@nightingale n9e]# git clone https://github.com/n9e/prometheus-exporter-collector.git    #克隆prometheus-exporter-collector
[root@nightingale n9e]# ll
    drwxr-xr-x 6 root root 226 7月  21 22:00 prometheus-exporter-collector
[root@nightingale n9e]# cd prometheus-exporter-collector
[root@nightingale prometheus-exporter-collector]# ll    #目录结构
    drwxr-xr-x 2 root root       40 7月  21 19:52 collector
    -rw-r--r-- 1 root root     5505 7月  21 19:52 collector_test.go
    drwxr-xr-x 2 root root       27 7月  21 19:52 config
    -rw-r--r-- 1 root root      446 7月  21 19:52 go.mod
    -rw-r--r-- 1 root root    53799 7月  21 19:53 go.sum
    -rw-r--r-- 1 root root     1964 7月  21 19:52 main.go
    drwxr-xr-x 2 root root       23 7月  21 19:52 model
    -rw-r--r-- 1 root root      273 7月  21 22:00 plugin.test.json
    -rw-r--r-- 1 root root     3591 7月  21 19:52 README.md
[root@nightingale n9e]# go build    #编译后生成prometheus-exporter-collector可执行文件
[root@nightingale prometheus-exporter-collector]# ll
    drwxr-xr-x 2 root root       40 7月  21 19:52 collector
    -rw-r--r-- 1 root root     5505 7月  21 19:52 collector_test.go
    drwxr-xr-x 2 root root       27 7月  21 19:52 config
    -rw-r--r-- 1 root root      446 7月  21 19:52 go.mod
    -rw-r--r-- 1 root root    53799 7月  21 19:53 go.sum
    -rw-r--r-- 1 root root     1964 7月  21 19:52 main.go
    drwxr-xr-x 2 root root       23 7月  21 19:52 model
    -rw-r--r-- 1 root root      273 7月  21 22:00 plugin.test.json
    -rwxr-xr-x 1 root root 11660014 7月  21 21:56 prometheus-exporter-collector
    -rw-r--r-- 1 root root     3591 7月  21 19:52 README.md
[root@nightingale n9e]# cat plugin.test.json | ./prometheus-exporter-collector    #控制台将展示采集到的mysql信息
	#内容比较多,在此使用省略号就不再显示了
	...

2.Nightingale配置mysqld_exporter采集mysql信息

配置参数

NametypeDescription
exporter_urlsarrayAddress to collect metric for prometheus exporter.
append_tagsarrayAppend tags for n9e metric default empty
endpointstringField endpoint for n9e metric default empty
ignore_metrics_prefixarrayIgnore metric prefix default empty
timeoutintTimeout for access a exporter url default 500ms
metric_prefixstringappend metric prefix when push to n9e. e.g. 'xx_exporter.'
metric_typemapspecify metric type
default_mapping_metric_typestringDefault conversion rule for Prometheus cumulative metrics. support COUNTER and SUBTRACT. default SUBTRACT

 3.Nightingale的dashboard查看mysql监控指标



四、安装redis_exporter 服务监控安装与配置

0.Prometheus Redis Metrics Exporter

Build Status Coverage Status codecov docker_pulls
Prometheus exporter for Redis metrics.
Supports Redis 2.x, 3.x, 4.x, 5.x, and 6.x

1.安装步骤:

[root@nightingale github.com]# redis-server -v	#查看Redis的版本
[root@nightingale github.com]# git clone https://github.com/oliver006/redis_exporter.git	#克隆redis_exporter
[root@nightingale github.com]# ll
drwxr-xr-x 7 root root 4096 7月  21 21:35 mysqld_exporter
drwxr-xr-x 3 root root   43 7月  21 19:52 n9e
drwxr-xr-x 6 root root  294 7月  22 11:13 redis_exporter
drwxr-xr-x 2 root root   80 7月  21 21:09 sql_bk
[root@nightingale github.com]# cd redis_exporter/	#redis_exporter的目录结构
[root@nightingale redis_exporter]# ll
-rwxr-xr-x 1 root root     1674 7月  22 11:09 build-github-binaries.sh
drwxr-xr-x 2 root root      323 7月  22 11:09 contrib
drwxr-xr-x 2 root root       76 7月  22 11:09 docker
-rw-r--r-- 1 root root    41779 7月  22 11:09 exporter.go
-rw-r--r-- 1 root root    36734 7月  22 11:09 exporter_test.go
-rw-r--r-- 1 root root      222 7月  22 11:09 go.mod
-rw-r--r-- 1 root root    13214 7月  22 11:09 go.sum
-rw-r--r-- 1 root root     1063 7月  22 11:09 LICENSE
-rw-r--r-- 1 root root     8021 7月  22 11:09 main.go
-rw-r--r-- 1 root root      271 7月  22 11:13 plugin_test.json
-rw-r--r-- 1 root root    13151 7月  22 11:09 README.md
[root@nightingale github.com]# go build	#编译,生成一个redis_exporter可执行文件
[root@nightingale redis_exporter]# ll
-rwxr-xr-x 1 root root     1674 7月  22 11:09 build-github-binaries.sh
drwxr-xr-x 2 root root      323 7月  22 11:09 contrib
drwxr-xr-x 2 root root       76 7月  22 11:09 docker
-rw-r--r-- 1 root root    41779 7月  22 11:09 exporter.go
-rw-r--r-- 1 root root    36734 7月  22 11:09 exporter_test.go
-rw-r--r-- 1 root root      222 7月  22 11:09 go.mod
-rw-r--r-- 1 root root    13214 7月  22 11:09 go.sum
-rw-r--r-- 1 root root     1063 7月  22 11:09 LICENSE
-rw-r--r-- 1 root root     8021 7月  22 11:09 main.go
-rw-r--r-- 1 root root      271 7月  22 11:13 plugin_test.json
-rw-r--r-- 1 root root    13151 7月  22 11:09 README.md
-rwxr-xr-x 1 root root 13609915 7月  22 11:09 redis_exporter

2.查看和启动redis_exporter

[root@nightingale github.com]# ./redis_exporter --version	#查看当前redis_exporter的版本
[root@nightingale github.com]# ./redis_exporter -redis.addr redis://127.0.0.1:6379	#启动redis_exporter

3.访问: http://192.168.21.145:9121/metrics

4.使用systemctl托管redis_exporter

[root@nightingale redis_exporter]# vim /usr/lib/systemd/system/redis_exporter.service
[Unit]
Description=Nightingale collector for redis_exporter
Documentation=https://github.com/oliver006/redis_exporter
After=network-online.target
Wants=network-online.target

[Service]
User=root
Group=root
Type=simple
ExecStart=/root/gopath/src/github.com/redis_exporter/redis_exporter -redis.addr 127.0.0.1:6379
WorkingDirectory=/root/gopath/src/github.com/redis_exporter/
Restart=on-failure
RestartSec=1
StartLimitInterval=0

[Install]
WantedBy=multi-user.target

[Unit]
Description=Nightingale collector for redis_exporter
Documentation=https://github.com/oliver006/redis_exporter
After=network-online.target
Wants=network-online.target

[Service]
User=root
Group=root
Type=simple
ExecStart=/root/gopath/src/github.com/redis_exporter/redis_exporter -redis.addr 127.0.0.1:6379
WorkingDirectory=/root/gopath/src/github.com/redis_exporter/
Restart=on-failure
RestartSec=1
StartLimitInterval=0

[Install]
WantedBy=multi-user.target
#设置服务开机启动
[root@nightingale redis_exporter]# systemctl daemon-reload && systemctl enable redis_exporter && systemctl restart redis_exporter && systemctl status redis_exporter

5.本机获取 redis 监控数据

1
2
使用以下命令可获取到redis的监控数据
curl http://127.0.0.1:9121/metrics

6.Nightingale配置redis_exporter采集redis信息 7.Nightingale的dashboard查看redis监控指标

五、附加内容

MySQL Server Exporter

Collector Flags

NameMySQL VersionDescription
collect.auto_increment.columns5.1Collect auto_increment columns and max values from information_schema.
collect.binlog_size5.1Collect the current size of all registered binlog files
collect.engine_innodb_status5.1Collect from SHOW ENGINE INNODB STATUS.
collect.engine_tokudb_status5.6Collect from SHOW ENGINE TOKUDB STATUS.
collect.global_status5.1Collect from SHOW GLOBAL STATUS (Enabled by default)
collect.global_variables5.1Collect from SHOW GLOBAL VARIABLES (Enabled by default)
collect.info_schema.clientstats5.5If running with userstat=1, set to true to collect client statistics.
collect.info_schema.innodb_metrics5.6Collect metrics from information_schema.innodb_metrics.
collect.info_schema.innodb_tablespaces5.7Collect metrics from information_schema.innodb_sys_tablespaces.
collect.info_schema.innodb_cmp5.5Collect InnoDB compressed tables metrics from information_schema.innodb_cmp.
collect.info_schema.innodb_cmpmem5.5Collect InnoDB buffer pool compression metrics from information_schema.innodb_cmpmem.
collect.info_schema.processlist5.1Collect thread state counts from information_schema.processlist.
collect.info_schema.processlist.min_time5.1Minimum time a thread must be in each state to be counted. (default: 0)
collect.info_schema.query_response_time5.5Collect query response time distribution if query_response_time_stats is ON.
collect.info_schema.replica_host5.6Collect metrics from information_schema.replica_host_status.
collect.info_schema.tables5.1Collect metrics from information_schema.tables.
collect.info_schema.tables.databases5.1The list of databases to collect table stats for, or '*' for all.
collect.info_schema.tablestats5.1If running with userstat=1, set to true to collect table statistics.
collect.info_schema.schemastats5.1If running with userstat=1, set to true to collect schema statistics
collect.info_schema.userstats5.1If running with userstat=1, set to true to collect user statistics.
collect.perf_schema.eventsstatements5.6Collect metrics from performance_schema.events_statements_summary_by_digest.
collect.perf_schema.eventsstatements.digest_text_limit5.6Maximum length of the normalized statement text. (default: 120)
collect.perf_schema.eventsstatements.limit5.6Limit the number of events statements digests by response time. (default: 250)
collect.perf_schema.eventsstatements.timelimit5.6Limit how old the 'last_seen' events statements can be, in seconds. (default: 86400)
collect.perf_schema.eventsstatementssum5.7Collect metrics from performance_schema.events_statements_summary_by_digest summed.
collect.perf_schema.eventswaits5.5Collect metrics from performance_schema.events_waits_summary_global_by_event_name.
collect.perf_schema.file_events5.6Collect metrics from performance_schema.file_summary_by_event_name.
collect.perf_schema.file_instances5.5Collect metrics from performance_schema.file_summary_by_instance.
collect.perf_schema.indexiowaits5.6Collect metrics from performance_schema.table_io_waits_summary_by_index_usage.
collect.perf_schema.tableiowaits5.6Collect metrics from performance_schema.table_io_waits_summary_by_table.
collect.perf_schema.tablelocks5.6Collect metrics from performance_schema.table_lock_waits_summary_by_table.
collect.perf_schema.replication_group_members5.7Collect metrics from performance_schema.replication_group_members.
collect.perf_schema.replication_group_member_stats5.7Collect metrics from performance_schema.replication_group_member_stats.
collect.perf_schema.replication_applier_status_by_worker5.7Collect metrics from performance_schema.replication_applier_status_by_worker.
collect.slave_status5.1Collect from SHOW SLAVE STATUS (Enabled by default)
collect.slave_hosts5.1Collect from SHOW SLAVE HOSTS
collect.heartbeat5.1Collect from heartbeat.
collect.heartbeat.database5.1Database from where to collect heartbeat data. (default: heartbeat)
collect.heartbeat.table5.1Table from where to collect heartbeat data. (default: heartbeat)
collect.heartbeat.utc5.1Use UTC for timestamps of the current server (pt-heartbeat is called with --utc). (default: false)

General Flags

NameDescription
config.my-cnfPath to .my.cnf file to read MySQL credentials from. (default: ~/.my.cnf)
log.levelLogging verbosity (default: info)
exporter.lock_wait_timeoutSet a lock_wait_timeout on the connection to avoid long metadata locking. (default: 2 seconds)
exporter.log_slow_filterAdd a log_slow_filter to avoid slow query logging of scrapes. NOTE: Not supported by Oracle MySQL.
web.listen-addressAddress to listen on for web interface and telemetry.
web.telemetry-pathPath under which to expose metrics.
versionPrint the version information.

Redis Server Exporter

redis 服务监控指标

监控阀值调整是一个长期过程,建议先不设置告警通道,待监控数据采集完成并运行一段时间后,根据当前的数据乘以2倍产生阀值.总之,监控的阀值需要自己根据实际的业务场景进行设置,以下表中如包含了阀值仅供参考和借鉴

key/counterstypetag告警触发条件监控指标备注告警阀值说明
redis_connected_clientsgauge-all(#3)>5000已连接客户端的数量-
redis_blocked_clientsgauge-all(#3)>5000正在等待阻塞命令(BLPOP、BRPOP、BRPOPLPUSH)的客户端的数-
redis_memory_used_bytesgauge-all(#3)>32212254720由 Redis 分配器分配的内存总量,以字节(byte)为单位单实例使用30G,建议拆分扩容;对fork卡停,full_sync时长都有明显性能影响
redis_memory_used_peak_bytesgauge--内存峰值-
redis_mem_fragmentation_ratiogauge-all(#3)>2used_memory_rss 和 used_memory 之间的比率内存碎片过高(如果实例比较小,这个指标可能比较大,不实用)
redis_commands_processed_totalcounter--执行命令总数和qps-
redis_rejected_connections_totalcounter--采集周期内拒绝连接总数-
redis_keyspace_misses_totalcounter--采集周期内key拒绝总数-
redis_keyspace_hits_totalgauge--访问命中率-
redis_aof_enabledgauge-all(#3)!=0appenonly是否开启,appendonly为yes则为1,no则为0-
redis_cluster_enabledgauge-all(#3)!=0是否启用Redis集群模式,0未启用,1启用-
redis_rdb_last_bgsave_statusgauge-all(#3)!=0最近一次rdb持久化是否成功-

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值