zabbix 的啥基础知识啥的,请看由本站大牛凉白开先生写的zabbix教程。这里说说如何监控ssdb。SSDB 是一个 C/C++ 语言开发的高性能 NoSQL 数据库, 支持 KV, list, map(hash), zset(sorted set) 等数据结构, 用来替代或者与 Redis 配合存储十亿级别列表的数据。
- 导入ssdb模板
这个是我自己创建的。不合适的地方自行修改。
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792<? xml version = "1.0" encoding = "UTF-8" ?>< zabbix_export >< version > 3.2 < / version >< date > 2017 - 07 - 05T06 : 50 : 33Z < / date >< groups >< group >< name > Templates < / name >< / group >< / groups >< templates >< template >< template > Template App SSDB < / template >< name > Template App SSDB < / name >< description > ssdb < / description >< groups >< group >< name > Templates < / name >< / group >< / groups >< applications >< application >< name > ssdb < / name >< / application >< / applications >< items >< item >< name > ssdb server is running < / name >< type > 0 < / type >< snmp_community / >< multiplier > 0 < / multiplier >< snmp_oid / >< key > net . tcp . listen [ { $ SSDB . PORT } ] < / 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 > ssdb < / name >< / application >< / applications >< valuemap >< name > Service state < / name >< / valuemap >< logtimefmt / >< / item >< item >< name > ssdb $ 1 < / name >< type > 0 < / type >< snmp_community / >< multiplier > 0 < / multiplier >< snmp_oid / >< key > ssdb [ available ] < / 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 > ssdb < / name >< / application >< / applications >< valuemap >< name > Service state < / name >< / valuemap >< logtimefmt / >< / item >< item >< name > ssdb $ 1 max_seq < / name >< type > 0 < / type >< snmp_community / >< multiplier > 0 < / multiplier >< snmp_oid / >< key > ssdb [ binlogs ] < / 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 > The maximum binlog number in the current queue < / description >< inventory_link > 0 < / inventory_link >< applications >< application >< name > ssdb < / name >< / application >< / applications >< valuemap / >< logtimefmt / >< / item >< item >< name > ssdb $ 1 < / name >< type > 0 < / type >< snmp_community / >< multiplier > 0 < / multiplier >< snmp_oid / >< key > ssdb [ dbsize ] < / 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 > ssdb < / name >< / application >< / applications >< valuemap / >< logtimefmt / >< / item >< item >< name > ssdb links < / name >< type > 0 < / type >< snmp_community / >< multiplier > 0 < / multiplier >< snmp_oid / >< key > ssdb [ links ] < / 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 > ssdb < / name >< / application >< / applications >< valuemap / >< logtimefmt / >< / item >< item >< name > ssdb $ 1 $ 2 < / name >< type > 0 < / type >< snmp_community / >< multiplier > 0 < / multiplier >< snmp_oid / >< key > ssdb [ replication . client , last_seq ] < / 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 > ssdb < / name >< / application >< / applications >< valuemap / >< logtimefmt / >< / item >< item >< name > ssdb $ 1 $ 2 < / name >< type > 0 < / type >< snmp_community / >< multiplier > 0 < / multiplier >< snmp_oid / >< key > ssdb [ replication . client , status ] < / key >< delay > 30 < / delay >< history > 90 < / history >< trends > 0 < / trends >< status > 0 < / status >< value_type > 4 < / 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 > ssdb < / name >< / application >< / applications >< valuemap / >< logtimefmt / >< / item >< item >< name > ssdb $ 1 < / name >< type > 0 < / type >< snmp_community / >< multiplier > 0 < / multiplier >< snmp_oid / >< key > ssdb [ total_calls ] < / 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 > ssdb < / name >< / application >< / applications >< valuemap / >< logtimefmt / >< / item >< / items >< discovery_rules >< discovery_rule >< name > SSDB cmd discovery < / name >< type > 0 < / type >< snmp_community / >< snmp_oid / >< key > ssdb . cmd . discovery < / key >< delay > 30 < / delay >< status > 0 < / status >< allowed_hosts / >< snmpv3_contextname / >< snmpv3_securityname / >< snmpv3_securitylevel > 0 < / snmpv3_securitylevel >< snmpv3_authprotocol > 0 < / snmpv3_authprotocol >< snmpv3_authpassphrase / >< snmpv3_privprotocol > 0 < / snmpv3_privprotocol >< snmpv3_privpassphrase / >< delay_flex / >< params / >< ipmi_sensor / >< authtype > 0 < / authtype >< username / >< password / >< publickey / >< privatekey / >< port / >< filter >< evaltype > 0 < / evaltype >< formula / >< conditions / >< / filter >< lifetime > 30 < / lifetime >< description / >< item_prototypes >< item_prototype >< name > ssdb cmd $ 1 $ 2 < / name >< type > 0 < / type >< snmp_community / >< multiplier > 0 < / multiplier >< snmp_oid / >< key > ssdb [ { #SSDBCMD},calls]</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 > ssdb < / name >< / application >< / applications >< valuemap / >< logtimefmt / >< application_prototypes >< application_prototype >< name > ssdb cmd discovery < / name >< / application_prototype >< / application_prototypes >< / item_prototype >< item_prototype >< name > ssdb cmd $ 1 $ 2 < / name >< type > 0 < / type >< snmp_community / >< multiplier > 0 < / multiplier >< snmp_oid / >< key > ssdb [ { #SSDBCMD},time_proc]</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 > ssdb < / name >< / application >< / applications >< valuemap / >< logtimefmt / >< application_prototypes >< application_prototype >< name > ssdb cmd discovery < / name >< / application_prototype >< / application_prototypes >< / item_prototype >< item_prototype >< name > ssdb cmd $ 1 $ 2 < / name >< type > 0 < / type >< snmp_community / >< multiplier > 0 < / multiplier >< snmp_oid / >< key > ssdb [ { #SSDBCMD},time_wait]</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 > ssdb < / name >< / application >< / applications >< valuemap / >< logtimefmt / >< application_prototypes >< application_prototype >< name > ssdb cmd discovery < / name >< / application_prototype >< / application_prototypes >< / item_prototype >< / item_prototypes >< trigger_prototypes / >< graph_prototypes >< graph_prototype >< name > ssdb { #SSDBCMD}</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 > 1A7C11 < / color >< yaxisside > 0 < / yaxisside >< calc_fnc > 2 < / calc_fnc >< type > 0 < / type >< item >< host > Template App SSDB < / host >< key > ssdb [ { #SSDBCMD},calls]</key>< / item >< / graph_item >< graph_item >< sortorder > 1 < / sortorder >< drawtype > 0 < / drawtype >< color > F63100 < / color >< yaxisside > 0 < / yaxisside >< calc_fnc > 2 < / calc_fnc >< type > 0 < / type >< item >< host > Template App SSDB < / host >< key > ssdb [ { #SSDBCMD},time_proc]</key>< / item >< / graph_item >< graph_item >< sortorder > 2 < / sortorder >< drawtype > 0 < / drawtype >< color > 2774A4 < / color >< yaxisside > 0 < / yaxisside >< calc_fnc > 2 < / calc_fnc >< type > 0 < / type >< item >< host > Template App SSDB < / host >< key > ssdb [ { #SSDBCMD},time_wait]</key>< / item >< / graph_item >< / graph_items >< / graph_prototype >< / graph_prototypes >< host_prototypes / >< / discovery_rule >< / discovery_rules >< httptests / >< macros >< macro >< macro > { $ SSDB . PORT } < / macro >< value > 8888 < / value >< / macro >< / macros >< templates / >< screens / >< / template >< / templates >< triggers >< trigger >< expression > { Template App SSDB : net . tcp . listen [ { $ SSDB . PORT } ] . last ( ) } = 0 < / expression >< recovery_mode > 1 < / recovery_mode >< recovery_expression > { Template App SSDB : net . tcp . listen [ { $ SSDB . PORT } ] . last ( ) } = 1 < / recovery_expression >< name > ssdb is down on { HOST . NAME } < / name >< correlation_mode > 0 < / correlation_mode >< correlation_tag / >< url / >< status > 0 < / status >< priority > 4 < / priority >< description / >< type > 0 < / type >< manual_close > 0 < / manual_close >< dependencies / >< tags / >< / trigger >< trigger >< expression > { Template App SSDB : ssdb [ binlogs ] . last ( ) } - { Template App SSDB : ssdb [ replication . client , last_seq ] . last ( ) } & gt ; 3600 < / expression >< recovery_mode > 0 < / recovery_mode >< recovery_expression / >< name > ssdb replacation is behind on { HOST . NAME } < / name >< correlation_mode > 0 < / correlation_mode >< correlation_tag / >< url / >< status > 0 < / status >< priority > 2 < / priority >< description / >< type > 0 < / type >< manual_close > 0 < / manual_close >< dependencies >< dependency >< name > ssdb replacation is failed on { HOST . NAME } < / name >< expression > { es1 : ssdb [ replication . client , status ] . str ( SYNC ) } & lt ; & gt ; 1 < / expression >< recovery_expression / >< / dependency >< / dependencies >< tags / >< / trigger >< trigger >< expression > { Template App SSDB : ssdb [ replication . client , status ] . str ( SYNC ) } & lt ; & gt ; 1 < / expression >< recovery_mode > 0 < / recovery_mode >< recovery_expression / >< name > ssdb replacation is failed on { HOST . NAME } < / name >< correlation_mode > 0 < / correlation_mode >< correlation_tag / >< url / >< status > 0 < / status >< priority > 2 < / priority >< description / >< type > 0 < / type >< manual_close > 0 < / manual_close >< dependencies >< dependency >< name > ssdb is down on { HOST . NAME } < / name >< expression > { es1 : net . tcp . listen [ { $ SSDB . PORT } ] . last ( ) } = 0 < / expression >< recovery_expression > { es1 : net . tcp . listen [ { $ SSDB . PORT } ] . last ( ) } = 1 < / recovery_expression >< / dependency >< / dependencies >< tags / >< / trigger >< trigger >< expression > { Template App SSDB : ssdb [ available ] . last ( ) } & lt ; & gt ; 1 < / expression >< recovery_mode > 0 < / recovery_mode >< recovery_expression / >< name > ssdb service availability on { HOST . NAME } < / name >< correlation_mode > 0 < / correlation_mode >< correlation_tag / >< url / >< status > 0 < / status >< priority > 2 < / priority >< description / >< type > 0 < / type >< manual_close > 0 < / manual_close >< dependencies >< dependency >< name > ssdb is down on { HOST . NAME } < / name >< expression > { Template App SSDB : net . tcp . listen [ { $ SSDB . PORT } ] . last ( ) } = 0 < / expression >< recovery_expression > { Template App SSDB : net . tcp . listen [ { $ SSDB . PORT } ] . last ( ) } = 1 < / recovery_expression >< / dependency >< / dependencies >< tags / >< / trigger >< / triggers >< graphs >< graph >< name > ssdb current connections < / 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 > 1A7C11 < / color >< yaxisside > 0 < / yaxisside >< calc_fnc > 2 < / calc_fnc >< type > 0 < / type >< item >< host > Template App SSDB < / host >< key > ssdb [ links ] < / key >< / item >< / graph_item >< / graph_items >< / graph >< graph >< name > ssdb database size estimate < / 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 > 1A7C11 < / color >< yaxisside > 0 < / yaxisside >< calc_fnc > 2 < / calc_fnc >< type > 0 < / type >< item >< host > Template App SSDB < / host >< key > ssdb [ dbsize ] < / key >< / item >< / graph_item >< / graph_items >< / graph >< / graphs >< value_maps >< value_map >< name > Service state < / name >< mappings >< mapping >< value > 0 < / value >< newvalue > Down < / newvalue >< / mapping >< mapping >< value > 1 < / value >< newvalue > Up < / newvalue >< / mapping >< / mappings >< / value_map >< / value_maps >< / zabbix_export >
文件下载:zbx_ssdb_templates.xml - 脚本
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960$ cat / etc / zabbix / libexec / ssdb . py#!/bin/env pythonimport sys , json , socket , refrom SSDB import SSDBdef get_stats ( ip , port ) :ssdb = SSDB ( ip , port )info = ssdb . request ( 'info' , [ 'cmd' ] )result = info . data [ 1 : ]return resultdef discovery_cmd ( info ) :d = { 'data' : [ ] }for i in range ( 0 , len ( info ) , 2 ) :if info [ i ] . find ( 'cmd' ) != - 1 :d [ 'data' ] . append ( { '{#SSDBCMD}' : info [ i ] } )return json . dumps ( d )def check ( ip , port ) :ssdb = SSDB ( ip , port )try :ssdb . request ( 'set' , [ 'zabbix' , '123' ] )ssdb . request ( 'get' , [ 'zabbix' ] )return 1except :return 0if __name__ == '__main__' :ip = socket . gethostbyname ( socket . getfqdn ( socket . gethostname ( ) ) )port = 8888stats = get_stats ( ip , port )res = { }for i in range ( 0 , len ( stats ) , 2 ) :if stats [ i ] == 'replication' :stats [ i ] = stats [ i ] + '.' + stats [ i + 1 ] . split ( ) [ 0 ]res [ stats [ i ] ] = stats [ i + 1 ]cmd = sys . argv [ 1 ]filter = sys . argv [ 2 ] if len ( sys . argv ) > 2 else ''if cmd == 'discover' :print discovery_cmd ( stats )elif cmd . find ( 'cmd' ) != - 1 :p = re . compile ( '(\w+):\s+(\d+)\s+(\w+):\s+(\d+)\s+(\w+):\s+(\d+)' )m = p . match ( res [ cmd ] )d = dict ( zip ( m . group ( 1 , 3 , 5 ) , m . group ( 2 , 4 , 6 ) ) )#print d[filter]print d . get ( filter , 'not support' )elif cmd == 'replication.client' :for i in res [ 'replication.client' ] . split ( '\n' ) :if i . split ( ':' ) [ 0 ] . strip ( ) == filter :print i . split ( ':' ) [ 1 ] . strip ( )elif cmd == 'binlogs' :print res [ 'binlogs' ] . split ( '\n' ) [ - 1 ] . split ( ':' ) [ - 1 ] . strip ( )elif cmd == 'available' :print check ( ip , port )else :print res . get ( cmd , 'not support' ) - userparameter配置
123$ cat / etc / zabbix / zabbix_agentd . d / userparameter_ssdb . confUserParameter = ssdb . cmd . discovery , / etc / zabbix / libexec / ssdb . py discoverUserParameter = ssdb [ * ] , / etc / zabbix / libexec / ssdb . py $ 1 $ 2
需要使用到ssdb的python客户端,我这里是使用ssdb源码自带的python客户端。
item的定义:
triggers定义:
注意:适用于ssdb 主主复制。单实例、主从、多主并未测试过。
收 藏
转载请注明:成长的对话 » zabbix 监控ssdb