{"id":116878,"date":"2018-08-30T08:08:20","date_gmt":"2018-08-30T00:08:20","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=116878"},"modified":"2018-08-23T14:10:03","modified_gmt":"2018-08-23T06:10:03","slug":"zabbix-redis-mem","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/zabbix-redis-mem.html","title":{"rendered":"\u4f7f\u7528zabbix\u76d1\u63a7redis\u5185\u5b58\u4f7f\u7528"},"content":{"rendered":"

\u672c\u7bc7\u63d0\u5230\u7684\u76d1\u63a7\u73af\u5883\u662f\u6709\u6761\u4ef6\u7684\uff0c\u5373\u9ed8\u8ba4\u5355\u673a\u53ea\u8fd0\u884c\u4e00\u4e2aredis\u5b9e\u4f8b\uff0c\u4e14\u9ed8\u8ba4\u8fd0\u884c\u7684\u7aef\u53e3\u662f6379\uff08\u4e5f\u53ef\u4ee5\u662f\u5176\u4ed6\u7aef\u53e3\uff0c\u9700\u8981\u901a\u8fc7sed -i 's\/6379\/\u4f60\u4fee\u6539\u7684\u7aef\u53e3\/g' xml\u6a21\u677f\u6587\u4ef6 \u4fee\u6539\u6a21\u677f\u6587\u4ef6\u91cc\u7684\u7aef\u53e3\u53f7\uff09 \u3002\u5373\u7136\u6709\u8fd9\u4e48\u591a\u5c40\u9650\uff0c\u5c82\u4e0d\u662f\u9002\u5e94\u7528\u73af\u5883\u5f88\u5dee\u3002\u786e\u5b9e\uff0c\u672c\u7bc7\u7b97\u662f\u4e00\u4e2a\u57fa\u7840\u90e8\u5206\uff0c\u4e3a\u540e\u9762\u63d0\u5230\u7684lld\uff08low level discovery\uff09\u81ea\u52a8\u53d1\u73b0\u505a\u94fa\u57ab \u3002\u7531\u4e8e\u524d\u9762\u51e0\u90e8\u5206\u4e5f\u5bf9\u57fa\u7840\u7684\u4e1c\u897f\u505a\u4e86\u5f88\u591a\u603b\u7ed3\uff0c\u8fd9\u91cc\u5f88\u57fa\u672c\u7684\u4e1c\u897f\u4e0d\u63d0\uff0c\u76f4\u63a5\u4e0a\u6b65\u9aa4\u3002<\/p>\n

1\u3001\u5bfc\u5165\u6a21\u677f<\/strong><\/span><\/div>\n

\u540c\u6837\uff0c\u6a21\u677f\u6211\u5df2\u4e0a\u4f20\u5230 github\u9879\u76ee \u4e0a \u3002\u76f4\u63a5\u4e0b\u8f7d\uff0c\u901a\u8fc7\u4e0b\u9762\u7684\u6b65\u9aa4\u5bfc\u5165\u6a21\u677f\uff1a\u70b9\u51fbconfiguration ----> templates ------> import -------> \u5bfc\u5165\u4e0b\u8f7d\u7684xml\u6587\u4ef6 \u3002<\/p>\n

2\u3001\u5ba2\u6237\u7aefkey\u914d\u7f6e<\/strong><\/span><\/div>\n

\u5728\u88ab\u76d1\u63a7\u7684\u4e3b\u673a\u4e0a\uff0c\u6253\u5f00\/etc\/zabbix\/zabbix_agentd.conf \u914d\u7f6e\u6587\u4ef6\uff0c\u5728\u6700\u540e\u4e00\u884c\u52a0\u5165\uff1a<\/p>\n

UserParameter=redis_stats[*],redis-cli -h 127.0.0.1 -p $1 info|grep $2|cut -d : -f2\r\n<\/pre>\n

\u914d\u7f6e\u5b8c\u6210\u540e\u901a\u8fc7\/etc\/init.d\/zabbix_agentd restart \u91cd\u542f\u670d\u52a1\u5e76\u5e94\u7528\u6700\u65b0\u7684\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n

\u6ce8\uff1a\u5728\u8be5\u6587\u4ef6\u4e2d\u8fd8\u8981\u786e\u8ba4UnsafeUserParameters=1 \u3002<\/p>\n

3\u3001\u670d\u52a1\u7aef\u9a8c\u8bc1<\/strong><\/span><\/div>\n

\u9a8c\u8bc1\u65b9\u5f0f\u8fd8\u662f\u901a\u8fc7zabbix_get \u7a0b\u5e8f\u53bb\u83b7\u53d6\u6570\u636e\uff0c\u80fd\u6b63\u5e38\u5f97\u5230\u6570\u636e\uff0c\u8bc1\u660e\u901a\u4fe1\u6b63\u5e38\u3002<\/p>\n

# zabbix_get -s 172.20.0.20 -k redis_stats[6379,total_connections_received]\r\n2249669\r\n<\/pre>\n

\u4e0a\u9762\u6b63\u5e38\u4ece\u88ab\u76d1\u63a7\u4e3b\u673a\u4e0a\u53d6\u5f97\u4e86\u6570\u636e\uff0cc\/s\u901a\u4fe1\u6b63\u5e38 \u3002<\/p>\n

4\u3001\u6dfb\u52a0\u4e3b\u673a\u5173\u8054\u6a21\u677f<\/strong><\/span><\/div>\n

\u901a\u8fc7configuration ------> hosts ------> create host \u521b\u5efa\u65b0\u7684\u4e3b\u673a\uff0c\u5e76\u5728templates\u9879\u4e2d\uff0c\u67e5\u627eTemplates Redis_6379 \u6a21\u677f\uff0c\u5e76link \u8be5\u6a21\u677f \u3002\u5c31\u53ef\u4ee5\u6b63\u5e38\u83b7\u53d6\u6570\u636e\u4e86\u3002\u540c\u6837\uff0c\u9a8c\u8bc1\u6570\u636e\u4f7f\u7528 monitoring ----- lastest data ---- \u6253\u5230\u521a\u521a\u6dfb\u52a0\u7684\u4e3b\u673a\uff0c\u67e5\u770b\u662f\u5426\u6709\u6570\u636e \u3002<\/p>\n

5\u3001\u67e5\u770b\u76d1\u63a7\u56fe<\/strong><\/span><\/div>\n

\u901a\u8fc7monitoring ----- graphs \u53ef\u4ee5\u67e5\u770b\u521a\u521a\u6dfb\u52a0\u7684\u76d1\u63a7\u9879\u7684\u76d1\u63a7\u56fe\uff0c\u8fd9\u91cc\u53ea\u622a\u4e0b\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u56fe<\/p>\n

\n

\u539f\u6587\u6765\u81ea\uff1ahttp:\/\/www.361way.com\/zabbix-redis-6379\/3450.html<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttps:\/\/lrxjmw.cn\/zabbix-redis-mem.html<\/a>\u7f16\u8f91\uff1a\u5f20\u96c4\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u672c\u7bc7\u63d0\u5230\u7684\u76d1\u63a7\u73af\u5883\u662f\u6709\u6761\u4ef6\u7684\uff0c\u5373\u9ed8\u8ba4\u5355\u673a\u53ea\u8fd0\u884c\u4e00\u4e2aredis\u5b9e\u4f8b\uff0c\u4e14\u9ed8\u8ba4\u8fd0\u884c\u7684\u7aef\u53e3\u662f6379\uff08\u4e5f\u53ef\u4ee5\u662f\u5176\u4ed6\u7aef\u53e3 […]<\/p>\n","protected":false},"author":643,"featured_media":116898,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-116878","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/116878","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/643"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=116878"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/116878\/revisions"}],"predecessor-version":[{"id":116950,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/116878\/revisions\/116950"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/116898"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=116878"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=116878"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=116878"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}