In order to provide flexible notification messages,I use php script as remote command to send notification email.However,I've found some problem as follow.
At first ,the script is usable,I can receive email as defined upon event.Then,for example,I'd like the email contains command top's output.I use following command:
$mailbody = shell_exec("top -n 1");
The above is one of the main code in my script,in order to get top's output.
If I run the script by hand in command,then I can get top's output in the email.But if I run it through zabbix frontend, the email I received just with an empty content.It seemed that $mailbody = shell_exec("top -n 1") wasn't parsed properly.
After that,I do followings
I replace the "top" with absolute path that is "/usr/bin/top" or command non-exist,I find the status of the action is ok in the frontend,But also have empty message.
I also gussed that maybe user zabbix with a shell "/sbin/nologin" causes the problem,then I changed its shell to /bin/bash and create it home dir,but that have no effect.
I refer to the log file, but found nothing.
Can anybody give me some advice?
At first ,the script is usable,I can receive email as defined upon event.Then,for example,I'd like the email contains command top's output.I use following command:
$mailbody = shell_exec("top -n 1");
The above is one of the main code in my script,in order to get top's output.
If I run the script by hand in command,then I can get top's output in the email.But if I run it through zabbix frontend, the email I received just with an empty content.It seemed that $mailbody = shell_exec("top -n 1") wasn't parsed properly.
After that,I do followings
I replace the "top" with absolute path that is "/usr/bin/top" or command non-exist,I find the status of the action is ok in the frontend,But also have empty message.
I also gussed that maybe user zabbix with a shell "/sbin/nologin" causes the problem,then I changed its shell to /bin/bash and create it home dir,but that have no effect.
I refer to the log file, but found nothing.
Can anybody give me some advice?
Comment