zabbix_get cannot execute the script file solution on the agent side

Reference website; http://blog.51cto.com/13589448/2070180

Insufficient permissions prompt:  

Server side prompt:

[root@yao local]# zabbix_get -s 10.116.0.41 -p 10050 -k "test"
sh: /root/zabbix_agent/scripts/test.sh: Insufficient permissions

Agent side switch user test;

Insufficient permissions when executing custom keys in Zabbix

If I can't execute the command by switching the user identity, I suddenly realized that the zabbix user cannot enter the root user's home directory. As can be seen from the figure below, the permission of the /root directory is 550, and zabbix cannot enter, not to mention The command is executed.
Insufficient permissions when executing custom keys in Zabbix

4. Problem solving

Put the script to be run under a directory that the zabbix user can execute. For uniform specification, place all scripts in the /etc/zabbix/scripts directory.

1. Common script directory

~]# mkdir -pv /etc/zabbix/scripts ~]# cp /root/bin/baidu.sh /etc/zabbix/scripts

2. Modify the zabbix-agent configuration file

Insufficient permissions when executing custom keys in Zabbix

3. Restart zabbix-agent

~]# service zabbix-agent restart

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325257887&siteId=291194637