介绍redis_exporter是一个收集redis服务指标的应用。下载并运行wget-c-t100https://github.com/oliver006/redis_exporter/releases/download/v1.15.0/redis_exporter-v1.15.0.linux-amd64.tar.gztarzxvfredis_exporter-v1.15.0.linux-amd64.tar.gzcdredis_exporter-v1.15.0.linux-amd64./redis_exporterINFO[0000]RedisMetricsExporterv1.15.0builddate:2020-12-27-18:57:05sha1:43ec65f7a22041e64ec557291c36500d04c6f6b0Go:go1.15.6GOOS:linuxGOARCH:amd64INFO[0000]Providingmetricsat:9121/metrics默认端口为9121,默认链接为redis://localhost:6379。如果设置了密码,执行时需要指定密码。-groupsstringCommaseparatedlistofluareregexforgroupingkeys-check-key-groups-batch-sizeintCheckkeygroupsbatchsizehintfortheunderlyingSCAN(default10000)-check-keysstringCommaseparatedlistofkey-patternstoexportvalueandlength/size,searchedforwithSCAN-check-single-keysstringCommaseparatedlistofsinglekeystoexportvalueandlength-checkstringsCingleommaseparatedlistofsinglestreamstoexportinfoaboutstreams,groupsandconsumers-check-streamsstringCommaseparatedlistofstream-patternstoexportinfoaboutstreams,groupsandconsumers,searchedforwithSCAN-config-commandstringWhattousefortheCONFIGcommand(default"CONFIG")-connection-timeoutstringTimeoutforconnectiontoRedisinstance(default"15s")-count-keysstringCommaseparatedlistofpatternstocount,eg:'db3=sessions:*'.Warning:TheexporterrunsSCANtocountthekeys.-debugOutputverbosedebuginformation-export-client-listWhethertoscrapeClientListspecificmetrics-export-client-portWhethertoincludetheclient'sportwhenexportingtheclientlist.Warning:includingtheportincreasesthenumberofmetricsgeneratedandwillmakeyourPrometheusservertakeupmorememory-include-system-metricsWhethertoincludesystemmetricslikee.g.redis_total_system_memory_bytes-is-tile38WhethertoscrapeTile38specificmetrics-log-formatstringLogformat,validoptionsaretxtandjson(default"txt")-max-distinct-key-groupsintThemaximumnumberofdistinctkeygroupswiththemostmemoryutilizationtopresentasdistinctmetricsperdatabase,theleftoverkeygroupswillbeaggregatedinthe'overflow'bucket(default100)-namespacestringNamespaceformetrics(default"redis")-ping-on-connectWhethertopingtheredisinstanceafterconnecting-redis-only-metricsWhethertoalsoexportgoruntimemetrics-redis.addrstringAddressoftheRedisinstancetoscrape(default"redis://localhost:6379")-redis.passwordstringPasswordoftheRedisinstancetoscrape-redis.userstringUsernametouseforauthentication(RedisACLforRedis6.0andnewer)-scriptstringPathtoLuaRedisscriptforcollectingextrametrics-set-client-nameWhethertosetclientnametoredis_exporter(defaulttrue)-skip-tls-verificationWhethertotoskipTLSverification-tls-ca-cert-filestringNameoftheCAcertificatefile(includingfullpath)iftheserverrequiresTLSclientauthentication-tls-client-cert-filestringClient证书文件的名称(包括完整路径)iftheserverrequiresTLSclientauthentication-tls-client-key-filestringNameoftheclientkeyfile(includingfullpath)iftheserverrequiresTLSclientauthentication-tls-server-cert-filestringNameoftheservercertificatefile(includingfullpath)ifthewebinterfaceandtelemetryshoulduseTLS-tls-server-key-filestringNameoftheserverkeyfile(includingfullpath)ifthewebinterfaceandtelemetryshoulduseTLS-versionShowversioninformationandexit-web.listen-addressstringAddresstolistenonforwebinterfaceandtelemetry.(default":9121")-web.telemetry-pathstringPathunderwhichtoexposemetrics.(default"/metrics")部分脚本#!/bin/bashVERSION="1.15.0"wget-t100-chttps://github.com/oliver006/redis_exporter/releases/download/v${VERSION}/redis_exporter-${VERSION}.linux-amd64.tar.gzif[!-eredis_exporter-${VERSION}.linux-amd64.tar.gz]thenecho"安装包下载失败"exit1fitarxvfzredis_exporter-${VERSION}.linux-amd64.tar.gz-C/opt/cd/optln-sredis_exporter-${VERSION}.linux-amd64redis_exportercat>/etc/systemd/system/redis_exporter.service<
