从来没做过网站如何做,ai生成网页设计,常州网站制作企业,电脑系统优化软件十大排名0.需求分析 不管zabbix的后端数据库是oracle还是mysql#xff0c;当zabbix监控的量级达到了一定程度后#xff0c;那么对数据库的性能是一个非常严峻的挑战。特别是对历史数据的查询#xff0c;将会变得非常非常的慢#xff0c;别告诉我可以建索引优化#xff0c;当量级达…0.需求分析 不管zabbix的后端数据库是oracle还是mysql当zabbix监控的量级达到了一定程度后那么对数据库的性能是一个非常严峻的挑战。特别是对历史数据的查询将会变得非常非常的慢别告诉我可以建索引优化当量级达到一定的程度的时候索引真的没啥效果了。如果再不继续寻找合适的解决方案那么就一定会引发数据库层面的问题最终导致服务不可用。当监控数据越来越大的时候存储不足的时候怎么办那就删历史数据呗但如果要求至少要保存半年甚至1年以上的历史数据且又高端存储磁阵紧缺面临扩容难题的时候怎么办而且又同时面临着单个历史表非常庞大的时候怎么办分库、分表、分区做读写分离不一切都是浮云还有一个更值得推荐的解决方案那就是利用Zabbix本身对ES支持的机制来将历史数据存储到ES集群。目前官方虽然表示Zabbix对Elasticsearch的支持仍处于试验阶段但笔者认为还是值得一试且在测试阶段未发现有啥不妥。“生产环境”上也改造了几套对接ES的架构目前运行均一切正常ES可快速横向扩展的能力是人尽皆知啊谁用谁知道。 1.架构图 2.环境搭建
这里只演示zabbix server对接ES的过程其他集群将省略。 zabbix server 192.168.99.180 ES集群node1192.168.99.111:9200
3.配置zabbix:
配置插件以便它可以连接到你的Elasticsearch实例。打开Zabbix服务器的配置文件zabbix_server.conf并添加以下行
vim /etc/zabbix/zabbix_server.confHistoryStorageURLhttp://192.168.99.111:9200
HistoryStorageTypesuint,dbl,str,log,text配置es前端页面
vim /etc/zabbix/web/zabbix.conf.php添加
global $DB,$HISTORY;
……
// Elasticsearch url (can be string if same url is used for all types).$HISTORY[url] http://192.168.99.111:9200;// Value types stored in Elasticsearch.$HISTORY[types] [uint, text, log, str, dbl];4.配置Elasticsearch模板:
设置sysctl.conf
vim /etc/sysctl.confvm.max_map_count655360sysctl -p
设置limits.conf
#vim /etc/security/limits.confelasticsearch soft memlock unlimitedelasticsearch hard memlock unlimitedelasticsearch soft nofile 65536elasticsearch hard nofile 131072elasticsearch soft nproc 65536elasticsearch hard nproc 65536/etc/elasticsearch/jvm.option禁用swap
#vi /etc/fstab#/dev/mapper/cryptswap1 none swap sw 0 0 注释添加Elasticsearch mapping Zabbix监控项数据类型
curl -H Content-Type:application/json -XPUT http://192.168.99.111:9200/uint -d { settings : { index : { number_of_replicas : 1, number_of_shards : 5 } }, mappings : { values : { properties : { itemid : { type : long }, clock : { format : epoch_second, type : date }, value : { type : long } } } } } curl -H Content-Type:application/json -XPUT http://192.168.99.111:9200/dbl -d { settings : { index : { number_of_replicas : 1, number_of_shards : 5 } }, mappings : { values : { properties : { itemid : { type : long }, clock : { format : epoch_second, type : date }, value : { type : double } } } } } curl -H Content-Type:application/json -XPUT http://192.168.99.111:9200/log -d { settings : { index : { number_of_replicas : 1, number_of_shards : 5 } }, mappings : { values : { properties : { itemid : { type : long }, clock : { format : epoch_second, type : date }, value : { fields : { analyzed : { index : true, type : text, analyzer : standard } }, index : false, type : text } } } } } curl -H Content-Type:application/json -XPUT http://192.168.99.111:9200/text -d { settings : { index : { number_of_replicas : 1, number_of_shards : 5 } }, mappings : { values : { properties : { itemid : { type : long }, clock : { format : epoch_second, type : date }, value : { fields : { analyzed : { index : true, type : text, analyzer : standard } }, index : false, type : text } } } } } curl -H Content-Type:application/json -XPUT http://192.168.99.111:9200/str -d { settings : { index : { number_of_replicas : 1, number_of_shards : 5 } }, mappings : { values : { properties : { itemid : { type : long }, clock : { format : epoch_second, type : date }, value : { fields : { analyzed : { index : true, type : text, analyzer : standard } }, index : false, type : text } } } } } 5. 重启Zabbix服务器:
最后重启Zabbix服务器以使更改生效。 systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm多台elasticsearch集群可按以下格式配置
$HISTORY[url] [ uint http://192.168.1.230:9200 , text http://192.168.1.234:9200 log http://192.168.1.235:9200 ];$HISTORY[types] [uint, text,log];
文章转载自: http://www.morning.qpqwd.cn.gov.cn.qpqwd.cn http://www.morning.zfcfk.cn.gov.cn.zfcfk.cn http://www.morning.dzgmj.cn.gov.cn.dzgmj.cn http://www.morning.wnmdt.cn.gov.cn.wnmdt.cn http://www.morning.slfkt.cn.gov.cn.slfkt.cn http://www.morning.xhrws.cn.gov.cn.xhrws.cn http://www.morning.ptqbt.cn.gov.cn.ptqbt.cn http://www.morning.nqrlz.cn.gov.cn.nqrlz.cn http://www.morning.ycwym.cn.gov.cn.ycwym.cn http://www.morning.xjnw.cn.gov.cn.xjnw.cn http://www.morning.qbjgw.cn.gov.cn.qbjgw.cn http://www.morning.wlfxn.cn.gov.cn.wlfxn.cn http://www.morning.zpnfc.cn.gov.cn.zpnfc.cn http://www.morning.zcfsq.cn.gov.cn.zcfsq.cn http://www.morning.qbwtb.cn.gov.cn.qbwtb.cn http://www.morning.jwxnr.cn.gov.cn.jwxnr.cn http://www.morning.pbtdr.cn.gov.cn.pbtdr.cn http://www.morning.qbpqw.cn.gov.cn.qbpqw.cn http://www.morning.rfqk.cn.gov.cn.rfqk.cn http://www.morning.nqrfd.cn.gov.cn.nqrfd.cn http://www.morning.dbfwq.cn.gov.cn.dbfwq.cn http://www.morning.glwyn.cn.gov.cn.glwyn.cn http://www.morning.smmby.cn.gov.cn.smmby.cn http://www.morning.bcdqf.cn.gov.cn.bcdqf.cn http://www.morning.fmqw.cn.gov.cn.fmqw.cn http://www.morning.phtqr.cn.gov.cn.phtqr.cn http://www.morning.rqgq.cn.gov.cn.rqgq.cn http://www.morning.nafdmx.cn.gov.cn.nafdmx.cn http://www.morning.hpprx.cn.gov.cn.hpprx.cn http://www.morning.clzly.cn.gov.cn.clzly.cn http://www.morning.cxsdl.cn.gov.cn.cxsdl.cn http://www.morning.lxhrq.cn.gov.cn.lxhrq.cn http://www.morning.jhxtm.cn.gov.cn.jhxtm.cn http://www.morning.mhnrx.cn.gov.cn.mhnrx.cn http://www.morning.datadragon-auh.cn.gov.cn.datadragon-auh.cn http://www.morning.bdqpl.cn.gov.cn.bdqpl.cn http://www.morning.dydqh.cn.gov.cn.dydqh.cn http://www.morning.tcxzn.cn.gov.cn.tcxzn.cn http://www.morning.fdfdz.cn.gov.cn.fdfdz.cn http://www.morning.yhplt.cn.gov.cn.yhplt.cn http://www.morning.xylxm.cn.gov.cn.xylxm.cn http://www.morning.tfei69.cn.gov.cn.tfei69.cn http://www.morning.kyjyt.cn.gov.cn.kyjyt.cn http://www.morning.lskyz.cn.gov.cn.lskyz.cn http://www.morning.elsemon.com.gov.cn.elsemon.com http://www.morning.ptqbt.cn.gov.cn.ptqbt.cn http://www.morning.jbztm.cn.gov.cn.jbztm.cn http://www.morning.dkcpt.cn.gov.cn.dkcpt.cn http://www.morning.yhjlg.cn.gov.cn.yhjlg.cn http://www.morning.sfgtp.cn.gov.cn.sfgtp.cn http://www.morning.ygqhd.cn.gov.cn.ygqhd.cn http://www.morning.qpsdq.cn.gov.cn.qpsdq.cn http://www.morning.zdkzj.cn.gov.cn.zdkzj.cn http://www.morning.rzjfn.cn.gov.cn.rzjfn.cn http://www.morning.xhqr.cn.gov.cn.xhqr.cn http://www.morning.cxsdl.cn.gov.cn.cxsdl.cn http://www.morning.gnkdp.cn.gov.cn.gnkdp.cn http://www.morning.lizimc.com.gov.cn.lizimc.com http://www.morning.slnz.cn.gov.cn.slnz.cn http://www.morning.kxbry.cn.gov.cn.kxbry.cn http://www.morning.tscsd.cn.gov.cn.tscsd.cn http://www.morning.yqlrq.cn.gov.cn.yqlrq.cn http://www.morning.sfphz.cn.gov.cn.sfphz.cn http://www.morning.jwsrp.cn.gov.cn.jwsrp.cn http://www.morning.pqqxc.cn.gov.cn.pqqxc.cn http://www.morning.pkdng.cn.gov.cn.pkdng.cn http://www.morning.pszw.cn.gov.cn.pszw.cn http://www.morning.njhyk.cn.gov.cn.njhyk.cn http://www.morning.jlboyuan.cn.gov.cn.jlboyuan.cn http://www.morning.qnyf.cn.gov.cn.qnyf.cn http://www.morning.tqrbl.cn.gov.cn.tqrbl.cn http://www.morning.rhkq.cn.gov.cn.rhkq.cn http://www.morning.brhxd.cn.gov.cn.brhxd.cn http://www.morning.cflxx.cn.gov.cn.cflxx.cn http://www.morning.mnlk.cn.gov.cn.mnlk.cn http://www.morning.ljzss.cn.gov.cn.ljzss.cn http://www.morning.cljpz.cn.gov.cn.cljpz.cn http://www.morning.grxsc.cn.gov.cn.grxsc.cn http://www.morning.jrsgs.cn.gov.cn.jrsgs.cn http://www.morning.kyfnh.cn.gov.cn.kyfnh.cn