I'm trying to set up alerts through MSMTP and the GMail.com SMTP server on an Ubuntu 14.04 server.
I have MSMTP functioning to the point where command line entry sends me a test email:
sudo echo -e "Subject: Test Mail\r\n\r\nThis is a test mail" |msmtp --debug --from=zabbix -t [email protected]
I've enabled a Media type called "GMail SMTP" of type "Script" pointing to "zext_msmtp.sh".
"zext_msmtp.sh" is in "/etc/zabbix/alert.d" per this line in the Zabbix config:
AlertScriptsPath=/etc/zabbix/alert.d
Under Administration/Users/Media tab, I've added and enable the "GMail SMTP" media type.
Under Configuration/Actions, default action, Operations, this is the only active step:
Send message to user groups: Zabbix administrators via GMail SMTP
Immediately Default
I've been testing this by stopping the Zabbix service on one of the monitored servers, and waiting 5 minutes. I can then monitor the progress of the alert by viewing the server log. This is the output I get:
3585:20150419:100112.836 Zabbix agent item "vfs.fs.inode[/,pfree]" on host "theserver" failed: first network error, wait for 15 seconds
3586:20150419:100127.511 Zabbix agent item "vfs.fs.inode[/,pfree]" on host "theserver" failed: another network error, wait for 15 seconds
3586:20150419:100142.550 Zabbix agent item "vfs.fs.size[/mnt/filesvr,total]" on host "theserver" failed: another network error, wait for 15 seconds
3586:20150419:100158.668 temporarily disabling Zabbix agent checks on host "theserver": host unavailable
3604:20150419:112215.446 executing housekeeper
3604:20150419:112229.617 housekeeper [deleted 11693 hist/trends, 0 items, 0 events, 0 sessions, 0 alarms, 0 audit items in 14.170411 sec, idle 1 hour(s)]
... and sometimes, but not always ...
sh: 1: /etc/zabbix/alert.d/zext_msmtp.sh: not found
More on that later.
On the monitor page, I will see, under "Last 20 Issues", that the issue was caught and that 1 action was triggered. It'll start read, then after a few seconds, cycle to green. If I hover over it, it'll say:
User: Admin
Details: GMail SMTP
Status: Sent
... but I never get the email. I can check the sending account and confirm it never went out, as well.
My msmtp.log file will have no entry for the attempt, so it doesn't appear to actually call the script.
The fact that it doesn't always complain about not being able to find the script makes this twice as much fun. It's unquestionably where it's supposed to be, and I've set the access to 777 on that file.
Presumably, there must be something wrong with my "zext_msmtp.sh", or possibly "msmprc". But I'm not getting any useful error messages to help me track this down.
Anyone have any other ideas on where else I can look?
I have MSMTP functioning to the point where command line entry sends me a test email:
sudo echo -e "Subject: Test Mail\r\n\r\nThis is a test mail" |msmtp --debug --from=zabbix -t [email protected]
I've enabled a Media type called "GMail SMTP" of type "Script" pointing to "zext_msmtp.sh".
"zext_msmtp.sh" is in "/etc/zabbix/alert.d" per this line in the Zabbix config:
AlertScriptsPath=/etc/zabbix/alert.d
Under Administration/Users/Media tab, I've added and enable the "GMail SMTP" media type.
Under Configuration/Actions, default action, Operations, this is the only active step:
Send message to user groups: Zabbix administrators via GMail SMTP
Immediately Default
I've been testing this by stopping the Zabbix service on one of the monitored servers, and waiting 5 minutes. I can then monitor the progress of the alert by viewing the server log. This is the output I get:
3585:20150419:100112.836 Zabbix agent item "vfs.fs.inode[/,pfree]" on host "theserver" failed: first network error, wait for 15 seconds
3586:20150419:100127.511 Zabbix agent item "vfs.fs.inode[/,pfree]" on host "theserver" failed: another network error, wait for 15 seconds
3586:20150419:100142.550 Zabbix agent item "vfs.fs.size[/mnt/filesvr,total]" on host "theserver" failed: another network error, wait for 15 seconds
3586:20150419:100158.668 temporarily disabling Zabbix agent checks on host "theserver": host unavailable
3604:20150419:112215.446 executing housekeeper
3604:20150419:112229.617 housekeeper [deleted 11693 hist/trends, 0 items, 0 events, 0 sessions, 0 alarms, 0 audit items in 14.170411 sec, idle 1 hour(s)]
... and sometimes, but not always ...
sh: 1: /etc/zabbix/alert.d/zext_msmtp.sh: not found
More on that later.
On the monitor page, I will see, under "Last 20 Issues", that the issue was caught and that 1 action was triggered. It'll start read, then after a few seconds, cycle to green. If I hover over it, it'll say:
User: Admin
Details: GMail SMTP
Status: Sent
... but I never get the email. I can check the sending account and confirm it never went out, as well.
My msmtp.log file will have no entry for the attempt, so it doesn't appear to actually call the script.
The fact that it doesn't always complain about not being able to find the script makes this twice as much fun. It's unquestionably where it's supposed to be, and I've set the access to 777 on that file.
Presumably, there must be something wrong with my "zext_msmtp.sh", or possibly "msmprc". But I'm not getting any useful error messages to help me track this down.
Anyone have any other ideas on where else I can look?
Comment