I would like to create an action to send me an email when a host became unavailable.
In a first try, I configured the default zabbix send mail option, but it didn´t work.
And I saw within Google, Zabbix does not provide SMTP with authentication - please tell me if I am wrong with that.
Then I tried to create a shell script to send the email.
Running the following command using zabbix linux user ( su zabbix ) I can send the e-mail.
#sh /etc/zabbix/scripts/scriptmail.sh "[email protected]" "Subject" "Mail body"
Now dumpping the .sh file:
#!/bin/bash
echo "$3" > /etc/zabbix/scripts/tmp
mail -s "$2" "$1" < /etc/zabbix/scripts/tmp
At zabbix_server.conf file, I removed the comments from the following lines and now it´s just like this:
AlertScriptsPath=/etc/zabbix/scripts/
ExternalScripts=/etc/zabbix/scripts/
I have added the script as media at the following path:
Administration->Media Types->Create Media Type, selected Type:script and
at Scriptname I put scriptmail.sh
( and then I also tried to fill Scriptname field using /etc/zabbix/script/scriptmail.sh instead of scriptmail.sh)
So I defined a link from the script to 'admin' user and then created an action that calls up the script when the trigger is started.
But, when the trigger is started up, nothing happens! No mail is sent!
Is there anybody here to point me a clue? Or am I making something wrong?
Attached files contains some screenshots of my current zabbix configurtion.
In a first try, I configured the default zabbix send mail option, but it didn´t work.
And I saw within Google, Zabbix does not provide SMTP with authentication - please tell me if I am wrong with that.
Then I tried to create a shell script to send the email.
Running the following command using zabbix linux user ( su zabbix ) I can send the e-mail.
#sh /etc/zabbix/scripts/scriptmail.sh "[email protected]" "Subject" "Mail body"
Now dumpping the .sh file:
#!/bin/bash
echo "$3" > /etc/zabbix/scripts/tmp
mail -s "$2" "$1" < /etc/zabbix/scripts/tmp
At zabbix_server.conf file, I removed the comments from the following lines and now it´s just like this:
AlertScriptsPath=/etc/zabbix/scripts/
ExternalScripts=/etc/zabbix/scripts/
I have added the script as media at the following path:
Administration->Media Types->Create Media Type, selected Type:script and
at Scriptname I put scriptmail.sh
( and then I also tried to fill Scriptname field using /etc/zabbix/script/scriptmail.sh instead of scriptmail.sh)
So I defined a link from the script to 'admin' user and then created an action that calls up the script when the trigger is started.
But, when the trigger is started up, nothing happens! No mail is sent!
Is there anybody here to point me a clue? Or am I making something wrong?
Attached files contains some screenshots of my current zabbix configurtion.
Comment