大网数据广告活动
服务器运维问答

Zabbix does not run custom alertscript

· 52CE 我爱测

I'm running Debian 8 and Zabbix 3.2. I've made a custom alert script, which runs fine when I run in terminal: /bin/sh /usr/lib/zabbix/alertscripts/send_sms.sh 4483222740 Hello This send a SMS via Twilio, works fine. In my zabbix_…

问题原文

原帖链接 · Michael Nielsen · CC BY-SA 3.0

I'm running Debian 8 and Zabbix 3.2.

I've made a custom alert script, which runs fine when I run in terminal:

/bin/sh /usr/lib/zabbix/alertscripts/send_sms.sh 4483222740 Hello

This send a SMS via Twilio, works fine.

In my zabbix_server.conf I have:

AlertScriptsPath=/usr/lib/zabbix/alertscripts

I've created a custom media type following https://www.zabbix.com/documentation/3.2/manual/config/notifications/media/script

But the script is not being called. I have a general media type for e-mail which are being triggered correctly.

My permissions for the script is:

ls -alh
total 12K
drwxr-xr-x 2 root root 4.0K Mar  9 09:04 .
drwxr-xr-x 4 root root 4.0K Feb  3 13:36 ..
-rwxr--r-- 1 root root  165 Mar  9 09:12 send_sms.sh

I've tried to grep for "send_sms" in the /var/log/ directory to see if any errors occurred. Nothing.

I'm ending my script with

exit 0

How to debug?

已采纳解答

原帖链接 · Richlv · CC BY-SA 3.0

a) the permissions you quote, -rwxr--r-- 1 root root 165 Mar 9 09:12 send_sms.sh, only allow to execute the script to the root user (owner of the script). Zabbix daemons normally run as the zabbix user, so that user doesn't have the permission to run the script. As the script it already world readable, changing the permissions to 755 should be acceptable and will allow Zabbix to run the script

b) if your script relies on any environment variables, make sure to set those in the script itself - Zabbix does not source the profile or anything else you might expect to set those variables

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-03-09)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。