AlertScriptsPath definition in zabbix_server.conf.If you can not found this file then search it:
whereis zabbix_server.conf
Check for existing setting. This can report nothing:
grep "^AlertScriptsPath" /usr/local/etc/zabbix_server.conf
Check if you can use existing line. This should report only one line
grep "AlertScriptsPath=" /usr/local/etc/zabbix_server.conf
Set that AlertScriptsPath will be in /var/zabbix/alertscripts:
sed -i "s/^.*AlertScriptsPath=.*$/AlertScriptsPath=\/var\/zabbix\/alertscripts/" /usr/local/etc/zabbix_server.conf
Make sure you have this directory and the owner is zabbix:
mkdir -p /var/zabbix/alertscripts
chown -R zabbix:zabbix /var/zabbix/
Go to this directory and download script:
cd /var/zabbix/alertscripts
wget "https://gist.githubusercontent.com/superdaigo/3754055/raw/e28b4b65110b790e4c3e4891ea36b39cd8fcf8e0/zabbix-alert-smtp.sh" -O zabbix-alert-smtp.py
Set file executable:
chmod +x zabbix-alert-smtp.py
Open this file and enter your email address and password at line 14 and 15:
vi zabbix-alert-smtp.py
Test if sending works.
./zabbix-alert-smtp.py yourname@gmail.com "subject" "this is test"
If you receive error like this:
Traceback (most recent call last):
File "./zabbix-alert-smtp.sh", line 58, in <module>
body=sys.argv[3])
File "./zabbix-alert-smtp.sh", line 42, in send_mail
Please log in via your web browser and\n5.7.14 then try again.\n5.7.14 Learn more at\n5.7.14 dq10sm1596135lbc.12 - gsmtp')
Then go to https://www.google.com/settings/security/lesssecureapps and turn on less secure apps.Now go to zabbix WEB interface:
Open [Media types] section and click [Create media type]:
Script and write down zabbix-alert-smtp.py:
zabbix-alert-smtp.py and write down your e-mail address. Press [Add] at the end:
No comments:
Post a Comment