zabbix_get查看agent端的key值提示没有权限:Permission denied
作者:互联网
zabbix使用自动发现创建监控项
agent端的配置:
自动发现实例名,ip,端口
#!/bin/bash printf "{\n" printf '\t'"\"data\":[" first=1 for info in `cat /root/test.log` do IFS=',' read -r -a itmes <<< $info if [ $first == 1 ];then printf '\n\t\t{' echo "\"{#PIDNAME}\":\"${itmes[0]}\",\"{#IP}\":\"${itmes[1]}\",\"{#PORT}\":\"${itmes[2]}\"}" first=0 else printf '\n\t\t' echo ",{\"{#PIDNAME}\":\"${itmes[0]}\",\"{#IP}\":\"${itmes[1]}\",\"{#PORT}\":\"${itmes[2]}\"}" fi done; printf "\n\t]\n" printf "}\n"
agent的配置文件
[root@accur1 zabbix_agentd.d]# vim flume.conf UserParameter=disc_flume,bash /etc/zabbix/zabbix_agentd.d/disc_flume.sh
server端执行zabbix_get提示报错:没有权限
[root@zabbix ~]# zabbix_get -s 192.168.191.151 -p 10050 -k disc_flume { "data":[cat: /root/test.log: Permission denied ] }
分析结果:agent端的selinux和firewalld已经关闭
需要更改agent的配置文件
修改为AllowRoot=1
server端再次执行脚本结果:
[root@zabbix ~]# zabbix_get -s 192.168.191.151 -p 10050 -k disc_flume { "data":[ {"{#PIDNAME}":"flume-test1","{#IP}":"192.168.1.1","{#PORT}":"9092"} ,{"{#PIDNAME}":"flume-test2","{#IP}":"192.168.1.2","{#PORT}":"9093"} ] }
标签:flume,Permission,get,agent,zabbix,disc,root 来源: http://blog.51cto.com/12182612/2348308