zabbix监控presto状态

zabbix监控presto,通过prestocli命令行工具,查询presto的系统运行记录表system.runtime.queries,配置如下:

cd /etc/zabbix/zabbix_agent.d

vi current_mater_status.conf
UserParameter=mater.status[*],/etc/zabbix/zabbix_agentd.d/current_mater_status.sh $1

vi current_mater_status.sh
#!/bin/bash
export JAVA_HOME=/Data/opt/jdk1.8.0_181
export PATH=$JAVA_HOME/bin:$PATH
    function mater_faile {
		/Data/presto/prestocli --server localhost:8080 --execute "select count(1) from system.runtime.queries where state='FAILED' and query like '%insert into%';"  | sed 's/\"//g'
    }
    function faile_sql {
        /Data/presto/prestocli --server localhost:8080 --execute "select query from system.runtime.queries where state='FAILED' and query like '%insert into%';" 
    }
    	function dead_node {
	if [ `curl -s http://$HOST:$PORT/v1/cluster | awk -F ":" '{print $5}' | awk -F "," '{print $1}'` -lt 5 ] 
	then 
	/data/presto/presto --server localhost:18080 --execute "select node_id,http_uri from system.runtime.nodes where state='active';" 
	else
	echo "none"
	fi
}
  $1*

由于presto worker节点挂掉时,system.runtime.nodes表里查不到节点信息,只能先把active状态的节点全部查出来,再另行对比正常状态清单,找出故障节点。

zabbix web上的配置略。

其中shell脚本里需要把jdk环境变量写上,否则会报错,这里查了很多资料都没有说明。

Exception in thread "main" java.lang.UnsupportedClassVersionError: com/facebook/presto/cli/Presto : Unsupported major.minor version 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:808)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:442)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:64)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:354)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:430)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:323)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值