Hey Ya'll
I'm trying to configure an alert script that enables smtp authorization for my exchange server and sends an email to an outside account. Zabbix 1.4.1 is running on FreeBSD.
I was working off of this thread.
Now, I can run the script from the command line and it executes and emails fine (of course the variables that should be supplied by zabbix are empty). The owner of the script is zabbix, and the perms are set to 777 for troubleshooting purposes. I have set the webgui to create the script and named it appropriately. The AlertScript location in zabbix_server.conf is default (/home/zabbix/bin/).
However, when I have an alert, no email is received. Since I can run the script manually, it must be something in zabbix. If I look at the actions tab, it shows it as being sent, but it must fail sometime after that. ONe other tidbit, when sent manually, it shows in the /var/log/maillog file, but not when zabbix supposedly sends it.
Does anyone have any thoughts?
I can supply any logs needed.
Thanks
on edit, here's my script that works from commandline, but not when called by zabbix.
#!/bin/sh
export [email protected]
export zabbixmailto=$1
export zabbixsubject=$2
export zabbixbody=$3
export smtpdomain=mydomain.org
export smtpserver=mail.mydomain.org
export smtplogin=zabbix
export smtppass=secretpasswd
echo "From: \"Zabbix Monitor\"<$smtpemailfrom>" > /tmp/mymailinput
echo "T0: $zabbixmailto" >> /tmp/mymailinput
echo "Subject: $zabbixsubject" >> /tmp/mymailinput
echo "" >> /tmp/mymailinput
echo "This is automated. The message is $zabbixbody" >> /tmp/mymailinput
ssmtp -v -au zabbix -ap secretpasswd [email protected] < /tmp/mymailinput
Rob
I'm trying to configure an alert script that enables smtp authorization for my exchange server and sends an email to an outside account. Zabbix 1.4.1 is running on FreeBSD.
I was working off of this thread.
Now, I can run the script from the command line and it executes and emails fine (of course the variables that should be supplied by zabbix are empty). The owner of the script is zabbix, and the perms are set to 777 for troubleshooting purposes. I have set the webgui to create the script and named it appropriately. The AlertScript location in zabbix_server.conf is default (/home/zabbix/bin/).
However, when I have an alert, no email is received. Since I can run the script manually, it must be something in zabbix. If I look at the actions tab, it shows it as being sent, but it must fail sometime after that. ONe other tidbit, when sent manually, it shows in the /var/log/maillog file, but not when zabbix supposedly sends it.
Does anyone have any thoughts?
I can supply any logs needed.
Thanks
on edit, here's my script that works from commandline, but not when called by zabbix.
#!/bin/sh
export [email protected]
export zabbixmailto=$1
export zabbixsubject=$2
export zabbixbody=$3
export smtpdomain=mydomain.org
export smtpserver=mail.mydomain.org
export smtplogin=zabbix
export smtppass=secretpasswd
echo "From: \"Zabbix Monitor\"<$smtpemailfrom>" > /tmp/mymailinput
echo "T0: $zabbixmailto" >> /tmp/mymailinput
echo "Subject: $zabbixsubject" >> /tmp/mymailinput
echo "" >> /tmp/mymailinput
echo "This is automated. The message is $zabbixbody" >> /tmp/mymailinput
ssmtp -v -au zabbix -ap secretpasswd [email protected] < /tmp/mymailinput
Rob
Comment