一 Tomcat监控
1.1.1 Tomcat 端配置 JMX
编辑catalina.sh文件,配置如下:
CATALINA_OPTS="$CATALINA_OPTS
-Dcom.sun.management.jmxremote # 启用远程监控JMX
-Dcom.sun.management.jmxremote.port=12345 # 默认启动的JMX端口号,要和zabbix添加主机的端口一致
-Dcom.sun.management.jmxremote.authenticate=false # 不使用用户名密码认证
-Dcom.sun.management.jmxremote.ssl=false # 不适用ssl认证
-Djava.rmi.server.hostname=172.16.0.20" # tomcat主机地址
重启Tomcat
/usr/local/tomcat/bin/shutdown.sh
/usr/local/tomcat/bin/startup.sh
~]# ss -lnt
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 50 :::12345 :::*
1.1.2 编译zabbix server,加入对java支持
默认情况下,zabbix server 是没有加入java支持,所以要让zabbix监控tomcat,就需要开启zabbix监控java的专用服务zabbix-java-gateway.
yum install -y java java-devel zabbix-java-gateway
编辑zabbix-java-gateway配置文件
~]# grep ^[a-Z] /etc/zabbix/zabbix_java_gateway.conf
LISTEN_IP="0.0.0.0" # 监听地址
LISTEN_PORT=10052 # 监听端口
PID_FILE="/var/run/zabbix/zabbix_java.pid" # pid文件
START_POLLERS=20 # 启动多少线程轮训java,要和java应用保持一定短息
TIMEOUT=30 # 超时时间
配置zabbix server调用java gateway
~]# grep ^[a-Z] /etc/zabbix/zabbix_server.conf
JavaGateway=172.16.0.88 # 指定java gateway的地址
JavaGatewayPort=10052 # 指定java gateway的服务器监听端口,如果是默认端口可不写
StartJavaPollers=20 # 轮训
Timeout=30 # 超时时间
1.1.3 图形化配置
导入模板
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>3.0</version>
<date>--26T13::54Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
<template>
<template>Tomcat JMX</template>
<name>Tomcat JMX</name>
<description/>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<applications>
<application>
<name>class</name>
</application>
<application>
<name>HeapStatistics</name>
</application>
<application>
<name>Sessions</name>
</application>
<application>
<name>ThreadStatistics</name>
</application>
<application>
<name>Tomcat</name>
</application>
</applications>
<items>
<item>
<name>Sessions-当前活动会话数</name>
<type></type>
<snmp_community/>
<multiplier></multiplier>
<snmp_oid/>
<key>jmx["Catalina:type=Manager,context=/,host=localhost",activeSessions]</key>
<delay></delay>
<history></history>
<trends></trends>
<status></status>
<value_type></value_type>
<allowed_hosts/>
<units/>
<delta></delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel></snmpv3_securitylevel>
<snmpv3_authprotocol></snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol></snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula></formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type></data_type>
<authtype></authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link></inventory_link>
<applications>
<application>
<name>Sessions</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>Sessions-The maximum number of active Sessions allowed, or - for no limit</name>
<type></type>
<snmp_community/>
<multiplier></multiplier>
<snmp_oid/>
<key>jmx["Catalina:type=Manager,context=/,host=localhost",maxActiveSessions]</key>
<delay></delay>
<history></history>
<trends></trends>
<status></status>
<value_type></value_type>
<allowed_hosts/>
<units/>
<delta></delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel></snmpv3_securitylevel>
<snmpv3_authprotocol></snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol></snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula></formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type></data_type>
<authtype></authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link></inventory_link>
<applications>
<application>
<name>Sessions</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>Sessions-最大活动会话数</name>
<type></type>
<snmp_community/>
<multiplier></multiplier>
<snmp_oid/>
<key>jmx["Catalina:type=Manager,context=/,host=localhost",maxActive]</key>
<delay></delay>
<history></history>
<trends></trends>
<status></status>
<value_type></value_type>
<allowed_hosts/>
<units/>
<delta></delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel></snmpv3_securitylevel>
<snmpv3_authprotocol></snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol></snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula></formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type></data_type>
<authtype></authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link></inventory_link>
<applications>
<application>
<name>Sessions</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>Sessions-Number of sessions we rejected due to maxActive beeing reached</name>
<type></type>
<snmp_community/>
<multiplier></multiplier>
<snmp_oid/>
<key>jmx["Catalina:type=Manager,context=/,host=localhost",rejectedSessions]</key>
<delay></delay>
<history></history>
<trends></trends>
<status></status>
<value_type></value_type>
<allowed_hosts/>
<units/>
<delta></delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel></snmpv3_securitylevel>
<snmpv3_authprotocol></snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol></snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula></formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type></data_type>
<authtype></authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link></inventory_link>
<applications>
<application>
<name>Sessions</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>Sessions-会话数</name>
<type></type>
<snmp_community/>
<multiplier></multiplier>
<snmp_oid/>
<key>jmx["Catalina:type=Manager,context=/,host=localhost",sessionCounter]</key>
<delay></delay>
<history></history>
<trends></trends>
<status></status>
<value_type></value_type>
<allowed_hosts/>
<units/>
<delta></delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel></snmpv3_securitylevel>
<snmpv3_authprotocol></snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol></snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula></formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type></data_type>
<authtype></authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link></inventory_link>
<applications>
<application>
<name>Sessions</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>http- gzip compression</name>
<type></type>
<snmp_community/>
<multiplier></multiplier>
<snmp_oid/>
<key>jmx["Catalina:type=ProtocolHandler,port=",compression]</key>
<delay></delay>
<history></history>
<trends></trends>
<status></status>
<value_type></value_type>
<allowed_hosts/>
<units/>
<delta></delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel></snmpv3_securitylevel>
<snmpv3_authprotocol></snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol></snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula></formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type></data_type>
<authtype></authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link></inventory_link>
<applications/>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>Tomcat version</name>
<type></type>
<snmp_community/>
<multiplier></multiplier>
<snmp_oid/>
<key>jmx["Catalina:type=Server",serverInfo]</key>
<delay></delay>
<history></history>
<trends></trends>
<status></status>
<value_type></value_type>
<allowed_hosts/>
<units/>
<delta></delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel></snmpv3_securitylevel>
<snmpv3_authprotocol></snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol></snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula></formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type></data_type>
<authtype></authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link></inventory_link>
<applications>
<application>
<name>Tomcat</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>类-已加载</name>
<type></type>
<snmp_community/>
<multiplier></multiplier>
<snmp_oid/>
<key>jmx["java.lang:type=ClassLoading","LoadedClassCount"]</key>
<delay></delay>
<history></history>
<trends></trends>
<status></status>
<value_type></value_type>
<allowed_hosts/>
<units/>
<delta></delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel></snmpv3_securitylevel>
<snmpv3_authprotocol></snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol></snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula></formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type></data_type>
<authtype></authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link></inventory_link>
<applications>
<application>
<name>class</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>类-总计</name>
<type></type>
<snmp_community/>
<multiplier></multiplier>
<snmp_oid/>
<key>jmx["java.lang:type=ClassLoading","TotalLoadedClassCount"]</key>
<delay></delay>
<history></history>
<trends></trends>
<status></status>
<value_type></value_type>
<allowed_hosts/>
<units/>
<delta></delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel></snmpv3_securitylevel>
<snmpv3_authprotocol></snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol></snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula></formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type></data_type>
<authtype></authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link></inventory_link>
<applications>
<application>
<name>class</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>类-已卸载</name>
<type></type>
<snmp_community/>
<multiplier></multiplier>
<snmp_oid/>
<key>jmx["java.lang:type=ClassLoading","UnloadedClassCount"]</key>
<delay></delay>
<history></history>
<trends></trends>
<status></status>
<value_type></value_type>
<allowed_hosts/>
<units/>
<delta></delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel></snmpv3_securitylevel>
<snmpv3_authprotocol></snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol></snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula></formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type></data_type>
<authtype></authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link></inventory_link>
<applications>
<application>
<name>class</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>堆内存已提交</name>
<type></type>
<snmp_community/>
<multiplier></multiplier>
<snmp_oid/>
<key>jmx["java.lang:type=Memory","HeapMemoryUsage.committed"]</key>
<delay></delay>
<history></history>
<trends></trends>
<status></status>
<value_type></value_type>
<allowed_hosts/>
<units/>
<delta></delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel></snmpv3_securitylevel>
<snmpv3_authprotocol></snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol></snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula></formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type></data_type>
<authtype></authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link></inventory_link>
<applications>
<application>
<name>HeapStatistics</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>堆内存最大</name>
<type></type>
<snmp_community/>
<multiplier></multiplier>
<snmp_oid/>
<key>jmx["java.lang:type=Memory","HeapMemoryUsage.max"]</key>
<delay></delay>
<history></history>
<trends></trends>
<status></status>
<value_type></value_type>
<allowed_hosts/>
<units/>
<delta></delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel></snmpv3_securitylevel>
<snmpv3_authprotocol></snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol></snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula></formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type></data_type>
<authtype></authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link></inventory_link>
<applications>
<application>
<name>HeapStatistics</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>堆内存已使用</name>
<type></type>
<snmp_community/>
<multiplier></multiplier>
<snmp_oid/>
<key>jmx["java.lang:type=Memory","HeapMemoryUsage.used"]</key>
<delay></delay>
<history></history>
<trends></trends>
<status></status>
<value_type></value_type>
<allowed_hosts/>
<units/>
<delta></delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel></snmpv3_securitylevel>
<snmpv3_authprotocol></snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol></snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula></formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type></data_type>
<authtype></authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link></inventory_link>
<applications>
<application>
<name>HeapStatistics</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>http-8080线程峰值</name>
<type></type>
<snmp_community/>
<multiplier></multiplier>
<snmp_oid/>
<key>jmx["java.lang:type=Threading","PeakThreadCount"]</key>
<delay></delay>
<history></history>
<trends></trends>
<status></status>
<value_type></value_type>
<allowed_hosts/>
<units/>
<delta></delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel></snmpv3_securitylevel>
<snmpv3_authprotocol></snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol></snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula></formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type></data_type>
<authtype></authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link></inventory_link>
<applications>
<application>
<name>ThreadStatistics</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>http-8080活动线程</name>
<type></type>
<snmp_community/>
<multiplier></multiplier>
<snmp_oid/>
<key>jmx["java.lang:type=Threading","ThreadCount"]</key>
<delay></delay>
<history></history>
<trends></trends>
<status></status>
<value_type></value_type>
<allowed_hosts/>
<units/>
<delta></delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel></snmpv3_securitylevel>
<snmpv3_authprotocol></snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol></snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula></formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type></data_type>
<authtype></authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link></inventory_link>
<applications>
<application>
<name>ThreadStatistics</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>http-8080线程总计</name>
<type></type>
<snmp_community/>
<multiplier></multiplier>
<snmp_oid/>
<key>jmx["java.lang:type=Threading","TotalStartedThreadCount"]</key>
<delay></delay>
<history></history>
<trends></trends>
<status></status>
<value_type></value_type>
<allowed_hosts/>
<units/>
<delta></delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel></snmpv3_securitylevel>
<snmpv3_authprotocol></snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol></snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula></formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type></data_type>
<authtype></authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link></inventory_link>
<applications>
<application>
<name>ThreadStatistics</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
</items>
<discovery_rules/>
<macros/>
<templates/>
<screens/>
</template>
</templates>
<graphs>
<graph>
<name>会话状态</name>
<width></width>
<height></height>
<yaxismin>0.0000</yaxismin>
<yaxismax>100.0000</yaxismax>
<show_work_period></show_work_period>
<show_triggers></show_triggers>
<type></type>
<show_legend></show_legend>
<show_3d></show_3d>
<percent_left>0.0000</percent_left>
<percent_right>0.0000</percent_right>
<ymin_type_1></ymin_type_1>
<ymax_type_1></ymax_type_1>
<ymin_item_1></ymin_item_1>
<ymax_item_1></ymax_item_1>
<graph_items>
<graph_item>
<sortorder></sortorder>
<drawtype></drawtype>
<color>C80000</color>
<yaxisside></yaxisside>
<calc_fnc></calc_fnc>
<type></type>
<item>
<host>Tomcat JMX</host>
<key>jmx["Catalina:type=Manager,context=/,host=localhost",maxActive]</key>
</item>
</graph_item>
<graph_item>
<sortorder></sortorder>
<drawtype></drawtype>
<color>00C800</color>
<yaxisside></yaxisside>
<calc_fnc></calc_fnc>
<type></type>
<item>
<host>Tomcat JMX</host>
<key>jmx["Catalina:type=Manager,context=/,host=localhost",activeSessions]</key>
</item>
</graph_item>
<graph_item>
<sortorder></sortorder>
<drawtype></drawtype>
<color>0000C8</color>
<yaxisside></yaxisside>
<calc_fnc></calc_fnc>
<type></type>
<item>
<host>Tomcat JMX</host>
<key>jmx["Catalina:type=Manager,context=/,host=localhost",sessionCounter]</key>
</item>
</graph_item>
<graph_item>
<sortorder></sortorder>
<drawtype></drawtype>
<color>C800C8</color>
<yaxisside></yaxisside>
<calc_fnc></calc_fnc>
<type></type>
<item>
<host>Tomcat JMX</host>
<key>jmx["Catalina:type=Manager,context=/,host=localhost",rejectedSessions]</key>
</item>
</graph_item>
<graph_item>
<sortorder></sortorder>
<drawtype></drawtype>
<color>00C8C8</color>
<yaxisside></yaxisside>
<calc_fnc></calc_fnc>
<type></type>
<item>
<host>Tomcat JMX</host>
<key>jmx["Catalina:type=Manager,context=/,host=localhost",maxActiveSessions]</key>
</item>
</graph_item>
</graph_items>
</graph>
<graph>
<name>堆内存状态</name>
<width></width>
<height></height>
<yaxismin>0.0000</yaxismin>
<yaxismax>100.0000</yaxismax>
<show_work_period></show_work_period>
<show_triggers></show_triggers>
<type></type>
<show_legend></show_legend>
<show_3d></show_3d>
<percent_left>0.0000</percent_left>
<percent_right>0.0000</percent_right>
<ymin_type_1></ymin_type_1>
<ymax_type_1></ymax_type_1>
<ymin_item_1></ymin_item_1>
<ymax_item_1></ymax_item_1>
<graph_items>
<graph_item>
<sortorder></sortorder>
<drawtype></drawtype>
<color>C80000</color>
<yaxisside></yaxisside>
<calc_fnc></calc_fnc>
<type></type>
<item>
<host>Tomcat JMX</host>
<key>jmx["java.lang:type=Memory","HeapMemoryUsage.used"]</key>
</item>
</graph_item>
<graph_item>
<sortorder></sortorder>
<drawtype></drawtype>
<color>00C800</color>
<yaxisside></yaxisside>
<calc_fnc></calc_fnc>
<type></type>
<item>
<host>Tomcat JMX</host>
<key>jmx["java.lang:type=Memory","HeapMemoryUsage.committed"]</key>
</item>
</graph_item>
<graph_item>
<sortorder></sortorder>
<drawtype></drawtype>
<color>0000C8</color>
<yaxisside></yaxisside>
<calc_fnc></calc_fnc>
<type></type>
<item>
<host>Tomcat JMX</host>
<key>jmx["java.lang:type=Memory","HeapMemoryUsage.max"]</key>
</item>
</graph_item>
</graph_items>
</graph>
<graph>
<name>类状态</name>
<width></width>
<height></height>
<yaxismin>0.0000</yaxismin>
<yaxismax>100.0000</yaxismax>
<show_work_period></show_work_period>
<show_triggers></show_triggers>
<type></type>
<show_legend></show_legend>
<show_3d></show_3d>
<percent_left>0.0000</percent_left>
<percent_right>0.0000</percent_right>
<ymin_type_1></ymin_type_1>
<ymax_type_1></ymax_type_1>
<ymin_item_1></ymin_item_1>
<ymax_item_1></ymax_item_1>
<graph_items>
<graph_item>
<sortorder></sortorder>
<drawtype></drawtype>
<color>C80000</color>
<yaxisside></yaxisside>
<calc_fnc></calc_fnc>
<type></type>
<item>
<host>Tomcat JMX</host>
<key>jmx["java.lang:type=ClassLoading","LoadedClassCount"]</key>
</item>
</graph_item>
<graph_item>
<sortorder></sortorder>
<drawtype></drawtype>
<color>00C800</color>
<yaxisside></yaxisside>
<calc_fnc></calc_fnc>
<type></type>
<item>
<host>Tomcat JMX</host>
<key>jmx["java.lang:type=ClassLoading","UnloadedClassCount"]</key>
</item>
</graph_item>
<graph_item>
<sortorder></sortorder>
<drawtype></drawtype>
<color>0000C8</color>
<yaxisside></yaxisside>
<calc_fnc></calc_fnc>
<type></type>
<item>
<host>Tomcat JMX</host>
<key>jmx["java.lang:type=ClassLoading","TotalLoadedClassCount"]</key>
</item>
</graph_item>
</graph_items>
</graph>
<graph>
<name>线程状态</name>
<width></width>
<height></height>
<yaxismin>0.0000</yaxismin>
<yaxismax>100.0000</yaxismax>
<show_work_period></show_work_period>
<show_triggers></show_triggers>
<type></type>
<show_legend></show_legend>
<show_3d></show_3d>
<percent_left>0.0000</percent_left>
<percent_right>0.0000</percent_right>
<ymin_type_1></ymin_type_1>
<ymax_type_1></ymax_type_1>
<ymin_item_1></ymin_item_1>
<ymax_item_1></ymax_item_1>
<graph_items>
<graph_item>
<sortorder></sortorder>
<drawtype></drawtype>
<color>C80000</color>
<yaxisside></yaxisside>
<calc_fnc></calc_fnc>
<type></type>
<item>
<host>Tomcat JMX</host>
<key>jmx["java.lang:type=Threading","ThreadCount"]</key>
</item>
</graph_item>
<graph_item>
<sortorder></sortorder>
<drawtype></drawtype>
<color>00C800</color>
<yaxisside></yaxisside>
<calc_fnc></calc_fnc>
<type></type>
<item>
<host>Tomcat JMX</host>
<key>jmx["java.lang:type=Threading","PeakThreadCount"]</key>
</item>
</graph_item>
<graph_item>
<sortorder></sortorder>
<drawtype></drawtype>
<color>0000C8</color>
<yaxisside></yaxisside>
<calc_fnc></calc_fnc>
<type></type>
<item>
<host>Tomcat JMX</host>
<key>jmx["java.lang:type=Threading","TotalStartedThreadCount"]</key>
</item>
</graph_item>
</graph_items>
</graph>
</graphs>
</zabbix_export>
图形化添加:
1.1.4 效果展示
二 监控Redis
2.1.1 简介
Redis有自带的redis-cli客户端,通过redis的info命令可以查询redis的运行状态,那么zabbix对redis的监控就是客户端,redis-cli登陆redis,然后根据info命令去获取状态数据的,
2.1.2 redis中info的命令的使用
要获得redis的当前情况,可以通过redis-cli工具登陆到redis命令行,然后通过info命令查看
redis-cli命令格式:
redis-cli -h [hostnam] -p [port] -a [password] info [参数]
可选参数:
server: Redis服务器相关的通用信息
clients: 客户端连接的相关信息
memory: 内存消耗相关的信息
persistence: RDB(Redis DataBase) 和 AOF (Append-Only File)的相关信息
stats: 通过统计数据
replication: 主从复制相关信息
cpu: CPU消耗的统计数据
commandstats: redis命令的统计数据
cluster: Redis集群的相关信息
keyspace: 数据库相关的统计数据
all: 返回所有服务器信息
default: 值返回默认的信息集合
2.1.3 参数详细说明:
Server
#redis-cli -h 127.0.0.1 -p 6379 info server
# Server
redis_version:4.0.1
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:6cc565d4f2a4a6cb
redis_mode:standalone
os:Linux 2.6.32-696.1.1.el6.x86_64 x86_64
arch_bits:64
multiplexing_api:epoll
atomicvar_api:sync-builtin
gcc_version:4.4.7
process_id:5955
run_id:d408e7fc06ccb368ff5cb9883311131639ba78b4
tcp_port:6379
uptime_in_seconds:6137350
uptime_in_days:71
hz:10
lru_clock:7062882
executable:/usr/local/redis/./redis-server
config_file: # 说明
redis_version: Redis服务器版本号
redis_git_sha1: Git SHA1
redis_git_dirty: Git dirtyflag
os: Redis服务器的宿主机操作系统
arch_bits: 架构(32/64)
multiplexing_api: Redis所使用的事件处理机制
gcc_version: 编译Redis时所使用的Gcc版本
process_id: 服务器进程的Pid
run_id: Redis服务器的随机标识符,(用于Sentinel和集群)
tcp_port: TCP/IP监听端口
uptime_in_seconds: 自Redis服务器启动以来,经过的秒数
uptime_in_days: 自Redis服务器启动以来,经过的天数
lru_clock: 以分钟为单位进行自增的始终,用于LRU管理
查询内存信息
# redis-cli -h 127.0.0.1 -p 6379 info memory
# Memory
used_memory:597014232
used_memory_human:569.36M
used_memory_rss:641613824
used_memory_rss_human:611.89M
used_memory_peak:608983824
used_memory_peak_human:580.77M
used_memory_peak_perc:98.03%
used_memory_overhead:1509006
used_memory_startup:765984
used_memory_dataset:595505226
used_memory_dataset_perc:99.88%
total_system_memory:4018581504
total_system_memory_human:3.74G
used_memory_lua:37888
used_memory_lua_human:37.00K
maxmemory:0
maxmemory_human:0B
maxmemory_policy:noeviction
mem_fragmentation_ratio:1.07
mem_allocator:jemalloc-4.0.3
active_defrag_running:0
lazyfree_pending_objects:0 # 说明
used_memory: 由Redis分配器分配的内存总量,以字节(byte)为单位
used_memory_human: 以人类可读的格式返回Redis分配的内存总数
used_memory_rss: 从操作系统角度,返回Redis已分配的内存总数量(俗称常驻集大小).这个值和top,ps等命令的输出一致
used_memory_peak: Redis的内存消耗峰值(以字节为单位)
used_memory_peak_human: 以人类可读的格式返回Redis的内存消耗峰值
used_memory_lua: lua引擎所使用的内存大小(以字节为单位)
mem_fragmentation_ratio: used_memory_rss和used_memory之间的比率
mem_allocator: 在编译时指定的,Redis所使用的内存分配器,可以是libc,jemalloc或者tomalloc
查看客户端连接信息
# redis-cli -h 127.0.0.1 -p 6379 info clients
# Clients
connected_clients:37
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0 # 说明
connected_clients: 已连接客户端的数量(不包括通过从属服务器连接的客户端)
client_longest_output_list: 当前连接的客户端当中,最长的输出列表
client_biggest_input_buf: 当前连接的客户端中,最大输入缓存
blocked_clients: 正在等待阻塞命令(BLPOP,BRPOP,BRPOPLPUSH)的客户端数量
查看CPU使用情况:
# redis-cli -h 127.0.0.1 -p 6379 info cpu
# CPU
used_cpu_sys:8585.28
used_cpu_user:7876.75
used_cpu_sys_children:2415.57
used_cpu_user_children:18470.18 # 说明
used_cpu_sys: Redis 服务器耗费的系统CPU
used_cpu_user: Redis 服务器耗费的用户CPU
used_cpu_sys_children: 后台进程消耗的系统CPU
used_cpu_user_children: 后台进程耗费的用户CPU
查询一般统计信息:
# /usr/local/redis/redis-cli -h 127.0.0.1 -p 6379 info stats
# Stats
total_connections_received:2237
total_commands_processed:349644510
instantaneous_ops_per_sec:22
total_net_input_bytes:238485917420
total_net_output_bytes:56383049698
instantaneous_input_kbps:0.50
instantaneous_output_kbps:0.98
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:0
evicted_keys:0
keyspace_hits:52382
keyspace_misses:413948
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:22767
migrate_cached_sockets:0
slave_expires_tracked_keys:0
active_defrag_hits:0
active_defrag_misses:0
active_defrag_key_hits:0
active_defrag_key_misses:0 # 说明
total_connections_received: 服务器已接受的链接请求数量
total_commands_processed: 服务器已执行的命令数量
instantaneous_ops_per_sec: 服务器每秒钟执行的命令数量
rejected_connections: 因为最大客户端数量限制而被拒绝的链接请求数量
expired_keys: 因为过期而被自动删除的数据库键数量
evicted_keys: 因为最大内存容量限制而被驱逐(evict) 的键数量
keyspace_hits: 查找数据库键成功的次数
keyspace_misses: 查找数据库键失败的次数
pubsub_channels: 目前被订阅的频道数量
pubsub_patterns: 目前被订阅的模式数量
latest_fork_usec: 最近一次 fork() 操作耗费的毫秒数
查询Redis主从复制信息:
# /usr/local/redis/redis-cli -h 127.0.0.1 -p 6379 info Replication
# Replication
role:master
connected_slaves:0
master_replid: 0
master_replid2:0
master_repl_offset:0
second_repl_offset:-1
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0 # 说明
role: 如果当前服务器没有在复制任何其他服务器,那么这个域的值就是master;否则的话,这个域的值就是slave. 注意,在创建复制链的时候,一个从服务器也可能是另外一个服务器的主服务器.
connected_slaves: 已连接的Redis从机的数量
master_replid: 全局的复制偏移量
master_replid2: 用于存在该节点上一次连接主实例的实例master_replid
master_repl_offset: 可以得到当前master记录的复制偏移量。
second_repl_offset: 备份日志的
repl_backlog_active: 表示backlog的达标,backlog是一个缓冲区,在slave端失连时存放要同步到slave的数据,因此当一个slave要重连时,经常是不需要完全同步,执行局部同步就可以,backlog设置的越大,slave可以失连的事件就越长.
repl_backlog_size: 表示该buffer的大小(默认1024*1024,即1Mb)。该buffer是作为一个环形缓存区使用的,当有数据超过buffer的大小以后就会重新从buffer的头部开始写入
repl_backlog_first_byte_offset: 备份日志缓冲区中的首个字节的复制偏移量.
repl_backlog_histlen: 备份日志的实际数据长度. 如果当前服务器是一个从服务器的话,那么这个部分还会加上一下内容
master_host: 主服务器的 IP 地址
master_prt: 主服务器的 TCP 监听端口
master_link_status: 复制链接当前的状态, up表示链接正常, down表示链接断开
master_last_io_seconds_ago: 距离最近一次与主服务器进行通信已经过去了多少秒
master_sync_in_progress: 一个标志值,记录了主服务器是否正在与这个从服务器进行同步. # 如果同步操作正在进行,那么这个部分还会加上一下内容,
master_sync_left_bytes: 距离同步完成还缺少多少字节数据,
master_sync_last_io_seconds_ago: 距离最近一次因为SYNC操作而进行I/O已经过去了多少秒. # 如果主从服务器之间的链接处于断线状态,那么这个部分还会加上一下内容.
master_link_down_since_seconds: 主从服务器连接断开了多少秒.
2.1.4 编写Shell脚本并验证
#!/bin/bash
REDISCLI="/usr/bin/redis-cli"
HOST="127.0.0.1"
PORT=6379
PASS="123456" if [[ $# == 1 ]];then
case $1 in
version)
result=`$REDISCLI -h $HOST -a $PASS -p $PORT info server | grep -w "redis_version" | awk -F':' '{print $2}'`
echo $result
;;
uptime)
result=`$REDISCLI -h $HOST -a $PASS -p $PORT info server | grep -w "uptime_in_seconds" | awk -F':' '{print $2}'`
echo $result
;;
connected_clients)
result=`$REDISCLI -h $HOST -a $PASS -p $PORT info clients | grep -w "connected_clients" | awk -F':' '{print $2}'`
echo $result
;;
blocked_clients)
result=`$REDISCLI -h $HOST -a $PASS -p $PORT info clients | grep -w "blocked_clients" | awk -F':' '{print $2}'`
echo $result
;;
used_memory)
result=`$REDISCLI -h $HOST -a $PASS -p $PORT info memory | grep -w "used_memory" | awk -F':' '{print $2}'`
echo $result
;;
used_memory_rss)
result=`$REDISCLI -h $HOST -a $PASS -p $PORT info memory | grep -w "used_memory_rss" | awk -F':' '{print $2}'`
echo $result
;;
used_memory_peak)
result=`$REDISCLI -h $HOST -a $PASS -p $PORT info memory | grep -w "used_memory_peak" | awk -F':' '{print $2}'`
echo $result
;;
used_memory_lua)
result=`$REDISCLI -h $HOST -a $PASS -p $PORT info memory | grep -w "used_memory_lua" | awk -F':' '{print $2}'`
echo $result
;;
used_cpu_sys)
result=`$REDISCLI -h $HOST -a $PASS -p $PORT info cpu | grep -w "used_cpu_sys" | awk -F':' '{print $2}'`
echo $result
;;
used_cpu_user)
result=`$REDISCLI -h $HOST -a $PASS -p $PORT info cpu | grep -w "used_cpu_user" | awk -F':' '{print $2}'`
echo $result
;;
used_cpu_sys_children)
result=`$REDISCLI -h $HOST -a $PASS -p $PORT info cpu | grep -w "used_cpu_sys_children" | awk -F':' '{print $2}'`
echo $result
;;
used_cpu_user_children)
result=`$REDISCLI -h $HOST -a $PASS -p $PORT info cpu | grep -w "used_cpu_user_children" | awk -F':' '{print $2}'`
echo $result
;;
rdb_last_bgsave_status)
result=`$REDISCLI -h $HOST -a $PASS -p $PORT info Persistence | grep -w "rdb_last_bgsave_status" | awk -F':' '{print $2}' | grep -c ok`
echo $result
;;
aof_last_bgrewrite_status)
result=`$REDISCLI -h $HOST -a $PASS -p $PORT info Persistence | grep -w "aof_last_bgrewrite_status" | awk -F':' '{print $2}' | grep -c ok`
echo $result
;;
aof_last_write_status)
result=`$REDISCLI -h $HOST -a $PASS -p $PORT info Persistence | grep -w "aof_last_write_status" | awk -F':' '{print $2}' | grep -c ok`
echo $result
;;
*)
echo -e "\033[33mUsage: $0 {connected_clients|blocked_clients|used_memory|used_memory_rss|used_memory_peak|used_memory_lua|used_cpu_sys|used_cpu_user|used_cpu_sys_children|used_cpu_user_children|rdb_last_bgsave_status|aof_last_bgrewrite_status|aof_last_write_status}\033[0m"
;;
esac
elif [[ $# == 2 ]];then
case $2 in
keys)
result=`$REDISCLI -h $HOST -a $PASS -p $PORT info | grep -w "$1" | grep -w "keys" | awk -F'=|,' '{print $2}'`
echo $result
;;
expires)
result=`$REDISCLI -h $HOST -a $PASS -p $PORT info | grep -w "$1" | grep -w "keys" | awk -F'=|,' '{print $4}'`
echo $result
;;
avg_ttl)
result=`$REDISCLI -h $HOST -a $PASS -p $PORT info | grep -w "$1" | grep -w "avg_ttl" | awk -F'=|,' '{print $6}'`
echo $result
;;
*)
echo -e "\033[33mUsage: $0 {db0 keys|db0 expires|db0 avg_ttl}\033[0m"
;;
esac
fi
验证:
# 验证脚本
# pwd
/etc/zabbix/zabbix_agentd.d
# chmod 755 redis_status
# chmod +x redis_status
# ./redis_status used_memory
590056848 # 在/etc/zabbix/zabbix_agentd.d目录下创建redis_status.conf文件
UserParameter=Redis.Info[*],/etc/zabbix/zabbix_agentd.d/redis_status $1 $2
UserParameter=Redis.Status,/usr/local/redis/redis-cli -h 127.0.0.1 -p 6379 ping | grep -c PONG # 重启zabbix-agentd服务
service zabbix-agent restart # zabbix-server 验证测试
# zabbix_get -s 47.92.105.38 -k Redis.Info["used_memory"]
590061088
2.1.5 创建模板并验证结果
模板包含19监控项,5图形,1触发器,5应用集
模板内容:
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>2.0</version>
<date>2018-08-07T10:04:35Z</date>
<groups>
<group>
<name>Template DB Redis</name>
</group>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
<template>
<template>Template DB Redis</template>
<name>Template DB Redis</name>
<groups>
<group>
<name>Template DB Redis</name>
</group>
<group>
<name>Templates</name>
</group>
</groups>
<applications>
<application>
<name>Redis Clients</name>
</application>
<application>
<name>Redis CPU</name>
</application>
<application>
<name>Redis DbKey</name>
</application>
<application>
<name>Redis Memory</name>
</application>
<application>
<name>Redis WriteStatus</name>
</application>
</applications>
<items>
<item>
<name>Redis.Info[aof_last_bgrewrite_status]</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>Redis.Info[aof_last_bgrewrite_status]</key>
<delay>30</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Redis WriteStatus</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>Redis.Info[aof_last_write_status]</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>Redis.Info[aof_last_write_status]</key>
<delay>30</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Redis WriteStatus</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>Redis.Info[blocked_clients]</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>Redis.Info[blocked_clients]</key>
<delay>30</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Redis Clients</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>Redis.Info[connected_clients]</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>Redis.Info[connected_clients]</key>
<delay>30</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Redis Clients</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>Redis.Info[db0,avg_ttl]</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>Redis.Info[db0,avg_ttl]</key>
<delay>30</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Redis DbKey</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>Redis.Info[db0,expires]</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>Redis.Info[db0,expires]</key>
<delay>30</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Redis DbKey</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>Redis.Info[db0,keys]</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>Redis.Info[db0,keys]</key>
<delay>30</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Redis DbKey</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>Redis.Info[rdb_last_bgsave_status]</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>Redis.Info[rdb_last_bgsave_status]</key>
<delay>30</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Redis WriteStatus</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>Redis.Info[uptime]</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>Redis.Info[uptime]</key>
<delay>30</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units>uptime</units>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications/>
<valuemap/>
</item>
<item>
<name>Redis.Info[used_cpu_sys]</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>Redis.Info[used_cpu_sys]</key>
<delay>30</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>0</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Redis CPU</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>Redis.Info[used_cpu_sys_children]</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>Redis.Info[used_cpu_sys_children]</key>
<delay>30</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>0</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Redis CPU</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>Redis.Info[used_cpu_user]</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>Redis.Info[used_cpu_user]</key>
<delay>30</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>0</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Redis CPU</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>Redis.Info[used_cpu_user_children]</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>Redis.Info[used_cpu_user_children]</key>
<delay>30</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>0</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Redis CPU</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>Redis.Info[used_memory]</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>Redis.Info[used_memory]</key>
<delay>30</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Redis Memory</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>Redis.Info[used_memory_lua]</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>Redis.Info[used_memory_lua]</key>
<delay>30</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Redis Memory</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>Redis.Info[used_memory_peak]</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>Redis.Info[used_memory_peak]</key>
<delay>30</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Redis Memory</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>Redis.Info[used_memory_rss]</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>Redis.Info[used_memory_rss]</key>
<delay>30</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Redis Memory</name>
</application>
</applications>
<valuemap/>
</item>
<item>
<name>Redis.Info[version]</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>Redis.Info[version]</key>
<delay>30</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>1</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications/>
<valuemap/>
</item>
<item>
<name>Redis Status</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>Redis.Status</key>
<delay>30</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications/>
<valuemap/>
</item>
</items>
<discovery_rules/>
<macros/>
<templates/>
<screens/>
</template>
</templates>
<triggers>
<trigger>
<expression>{Template DB Redis:Redis.Status.last(0)}=0</expression>
<name>Redis is down</name>
<url/>
<status>0</status>
<priority>5</priority>
<description/>
<type>0</type>
<dependencies/>
</trigger>
</triggers>
<graphs>
<graph>
<name>Redis Client</name>
<width>900</width>
<height>200</height>
<yaxismin>0.0000</yaxismin>
<yaxismax>100.0000</yaxismax>
<show_work_period>1</show_work_period>
<show_triggers>1</show_triggers>
<type>0</type>
<show_legend>1</show_legend>
<show_3d>0</show_3d>
<percent_left>0.0000</percent_left>
<percent_right>0.0000</percent_right>
<ymin_type_1>0</ymin_type_1>
<ymax_type_1>0</ymax_type_1>
<ymin_item_1>0</ymin_item_1>
<ymax_item_1>0</ymax_item_1>
<graph_items>
<graph_item>
<sortorder>0</sortorder>
<drawtype>0</drawtype>
<color>C80000</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template DB Redis</host>
<key>Redis.Info[blocked_clients]</key>
</item>
</graph_item>
<graph_item>
<sortorder>1</sortorder>
<drawtype>0</drawtype>
<color>00C800</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template DB Redis</host>
<key>Redis.Info[connected_clients]</key>
</item>
</graph_item>
</graph_items>
</graph>
<graph>
<name>Redis CPU</name>
<width>900</width>
<height>200</height>
<yaxismin>0.0000</yaxismin>
<yaxismax>100.0000</yaxismax>
<show_work_period>1</show_work_period>
<show_triggers>1</show_triggers>
<type>0</type>
<show_legend>1</show_legend>
<show_3d>0</show_3d>
<percent_left>0.0000</percent_left>
<percent_right>0.0000</percent_right>
<ymin_type_1>0</ymin_type_1>
<ymax_type_1>0</ymax_type_1>
<ymin_item_1>0</ymin_item_1>
<ymax_item_1>0</ymax_item_1>
<graph_items>
<graph_item>
<sortorder>0</sortorder>
<drawtype>2</drawtype>
<color>C80000</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template DB Redis</host>
<key>Redis.Info[used_cpu_sys]</key>
</item>
</graph_item>
<graph_item>
<sortorder>1</sortorder>
<drawtype>2</drawtype>
<color>00C800</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template DB Redis</host>
<key>Redis.Info[used_cpu_user]</key>
</item>
</graph_item>
<graph_item>
<sortorder>2</sortorder>
<drawtype>2</drawtype>
<color>0000C8</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template DB Redis</host>
<key>Redis.Info[used_cpu_sys_children]</key>
</item>
</graph_item>
<graph_item>
<sortorder>3</sortorder>
<drawtype>2</drawtype>
<color>C800C8</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template DB Redis</host>
<key>Redis.Info[used_cpu_user_children]</key>
</item>
</graph_item>
</graph_items>
</graph>
<graph>
<name>Redis DbKeys</name>
<width>900</width>
<height>200</height>
<yaxismin>0.0000</yaxismin>
<yaxismax>100.0000</yaxismax>
<show_work_period>1</show_work_period>
<show_triggers>1</show_triggers>
<type>0</type>
<show_legend>1</show_legend>
<show_3d>0</show_3d>
<percent_left>0.0000</percent_left>
<percent_right>0.0000</percent_right>
<ymin_type_1>0</ymin_type_1>
<ymax_type_1>0</ymax_type_1>
<ymin_item_1>0</ymin_item_1>
<ymax_item_1>0</ymax_item_1>
<graph_items>
<graph_item>
<sortorder>0</sortorder>
<drawtype>2</drawtype>
<color>C80000</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template DB Redis</host>
<key>Redis.Info[db0,avg_ttl]</key>
</item>
</graph_item>
<graph_item>
<sortorder>1</sortorder>
<drawtype>2</drawtype>
<color>00C800</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template DB Redis</host>
<key>Redis.Info[db0,expires]</key>
</item>
</graph_item>
<graph_item>
<sortorder>2</sortorder>
<drawtype>2</drawtype>
<color>0000C8</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template DB Redis</host>
<key>Redis.Info[db0,keys]</key>
</item>
</graph_item>
</graph_items>
</graph>
<graph>
<name>Redis Memory</name>
<width>900</width>
<height>200</height>
<yaxismin>0.0000</yaxismin>
<yaxismax>100.0000</yaxismax>
<show_work_period>1</show_work_period>
<show_triggers>1</show_triggers>
<type>0</type>
<show_legend>1</show_legend>
<show_3d>0</show_3d>
<percent_left>0.0000</percent_left>
<percent_right>0.0000</percent_right>
<ymin_type_1>0</ymin_type_1>
<ymax_type_1>0</ymax_type_1>
<ymin_item_1>0</ymin_item_1>
<ymax_item_1>0</ymax_item_1>
<graph_items>
<graph_item>
<sortorder>0</sortorder>
<drawtype>2</drawtype>
<color>C80000</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template DB Redis</host>
<key>Redis.Info[used_memory]</key>
</item>
</graph_item>
<graph_item>
<sortorder>1</sortorder>
<drawtype>2</drawtype>
<color>00C800</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template DB Redis</host>
<key>Redis.Info[used_memory_lua]</key>
</item>
</graph_item>
<graph_item>
<sortorder>2</sortorder>
<drawtype>2</drawtype>
<color>0000C8</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template DB Redis</host>
<key>Redis.Info[used_memory_peak]</key>
</item>
</graph_item>
<graph_item>
<sortorder>3</sortorder>
<drawtype>2</drawtype>
<color>C800C8</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template DB Redis</host>
<key>Redis.Info[used_memory_rss]</key>
</item>
</graph_item>
</graph_items>
</graph>
<graph>
<name>Redis WriteStatus</name>
<width>900</width>
<height>200</height>
<yaxismin>0.0000</yaxismin>
<yaxismax>100.0000</yaxismax>
<show_work_period>1</show_work_period>
<show_triggers>1</show_triggers>
<type>0</type>
<show_legend>1</show_legend>
<show_3d>0</show_3d>
<percent_left>0.0000</percent_left>
<percent_right>0.0000</percent_right>
<ymin_type_1>0</ymin_type_1>
<ymax_type_1>0</ymax_type_1>
<ymin_item_1>0</ymin_item_1>
<ymax_item_1>0</ymax_item_1>
<graph_items>
<graph_item>
<sortorder>0</sortorder>
<drawtype>2</drawtype>
<color>C80000</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template DB Redis</host>
<key>Redis.Info[aof_last_bgrewrite_status]</key>
</item>
</graph_item>
<graph_item>
<sortorder>1</sortorder>
<drawtype>2</drawtype>
<color>0000C8</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template DB Redis</host>
<key>Redis.Info[rdb_last_bgsave_status]</key>
</item>
</graph_item>
<graph_item>
<sortorder>2</sortorder>
<drawtype>2</drawtype>
<color>00C800</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template DB Redis</host>
<key>Redis.Info[aof_last_write_status]</key>
</item>
</graph_item>
</graph_items>
</graph>
</graphs>
</zabbix_export>
# 图形使用