I'm trying to use GMail for Zabbix email alerts. As I'm well aware, you cannot directly point to Google's SMTP server because Zabbix doesn't support TLS, so I downloaded the script here and created a new media type pointing to it in the Zabbix /alertscripts directory.
The alert appears to be working from the Zabbix frontend, as the Audit -> Actions page shows a 'Sent' status with no errors. However, the email never comes through. I created a second simple script as the media type to output the user / timestamps and Zabbix never touches it. I can execute the script from the shell and everything works as intended. The Zabbix user can also run it from the shell, so permissions don't seem to be the problem. There's nothing in the zabbix_server.log referencing these files. How the hell do I see what the Zabbix frontend is doing that it's never calling my scripts? Here's the script I have it pointed to now:
And some output from out.txt:
These are from the executions of my second script from the shell. As mentioned above, an action appearing in the Zabbix Audit log never has a corresponding entry in my output file. Even if the email was failing for some other reason, shouldn't there should at least be some reference to the args passed in by Zabbix when executing the script?
The alert appears to be working from the Zabbix frontend, as the Audit -> Actions page shows a 'Sent' status with no errors. However, the email never comes through. I created a second simple script as the media type to output the user / timestamps and Zabbix never touches it. I can execute the script from the shell and everything works as intended. The Zabbix user can also run it from the shell, so permissions don't seem to be the problem. There's nothing in the zabbix_server.log referencing these files. How the hell do I see what the Zabbix frontend is doing that it's never calling my scripts? Here's the script I have it pointed to now:
Code:
#!/bin/bash
function echo {
/bin/echo `whoami`:`date +"%H:%M:%S"` $* | tee -a out.txt
}
echo "Arguments:"
for var in "$@"
do
echo "\"$var\""
done
/usr/bin/python /usr/share/zabbix/alertscripts/zabbix.py "$1" "2" "3"
echo "Script finished"
echo "--------------------"
Code:
root:10:54:32 Arguments: root:10:54:32 "[email protected]" root:10:54:32 "test" root:10:54:32 "test" root:10:54:35 Script finished root:10:54:35 -------------------- zabbix:10:54:22 Arguments: zabbix:10:54:22 "[email protected]" zabbix:10:54:22 "test" zabbix:10:54:22 "test" zabbix:10:55:24 Script finished zabbix:10:55:24 --------------------
Comment