Ad Widget

Collapse

Email Notifications Not Sending

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dshortall
    Junior Member
    • Oct 2022
    • 7

    #1

    Email Notifications Not Sending

    Hello all,

    I'm attempting a proof of concept for sending email notifications with Zabbix. Thus far we've never had it working.

    I've read many forum posts, official documentation and third party guides - which broadly agree on the configuration necessary to make this work. Namely, configuring users, media types, triggers and actions.

    However, despite all attempts, I never receive any emails. I want to outline what I've tried and open this up to suggestions. In particular I'm curious if there are particular logs I can interrogate, and where these might be located.

    Environment

    Zabbix 4.0.20

    Aim is to send an email to myself when a PowerShell script on a host returns a 0 instead of a 1.

    PowerShell script is stored on the host in C:\Program Files\Zabbix Agent

    zabbix_agentd.conf modified to use a custom user parameter that calls 'Check.PrimaryStatus' key to invoke the script.

    UserParameter=Check.PrimaryStatus,powershell.exe -NoProfile -ExecutionPolicy Bypass -File "C:\Program Files\Zabbix Agent\Check.PrimaryStatus.ps1"

    Normally, the 0 and 1 values in the script are reversed - I've set them as above so that 0 is the standard output. Because during the PoC, I want this to be the value that triggers the alert.

    This all feeds the script value back into the Zabbix front-end console. This part is working fine, and if I check Monitoring > Latest Data > History for my host, filtered by the 'Item' in question, I get a value of 0 every 30 seconds.

    That's great; theoretically, I should now be able create a trigger for an action so long as the condition '0' is met on this host. Which is what I've configured below.

    Configuration

    Under Administration > Media Types, I created a new media type called 'Email Alerts'.

    Configured it as below.
    • SMTP server: Tried my mail server. (On-prem Exchange)
    • SMTP Port: 25
    • SMTP helo: Have made this the same as the SMTP server.
    • SMTP email: This is just the address the email will be coming from, can effectively be anything.
    • Authentication: Tried this with and without. With, using my admin creds which I know have authority to log onto the mail server.
    ​​

    Under Administration > Users, I selected my own user account, confirmed it had read-write permission over all hosts, and had been set up with a Media Type 'Email Alerts', with a 'Send to' address matching my own.

    Click image for larger version

Name:	image.png
Views:	3919
Size:	98.6 KB
ID:	452901​​

    Under Configuration > Hosts > (Hostname) > Items, I created a new item called 'Check Whether Primary or Secondary' as below. The key matches up to the key in the zabbix_agentd.config UserParameter line.

    Click image for larger version

Name:	image.png
Views:	3824
Size:	64.6 KB
ID:	452902

    Under Configuration > Hosts > (Hostname) > Triggers, I created a new trigger and configured as below.

    Click image for larger version

Name:	image.png
Views:	3805
Size:	56.6 KB
ID:	452903

    ​Under Configuration > Actions, I created an action as below. Gave it a name, said A and B must be true, set the conditions to "Trigger severity equals Warning' and 'Trigger equals <trigger name>'



    Under Operations tab​​, I configured the below. Default message recurring every 60 seconds, sending a message to my own user account, using the media type 'Email Alerts'.



    If I examine the Triggers for this host, my custom trigger exists and is reporting as a Warning with a PROBLEM value. As expected.

    Attached Files
  • dshortall
    Junior Member
    • Oct 2022
    • 7

    #2
    Hi all,

    Apologies, I didn't understand that I couldn't edit my post after posting - And what I've posted is only partial, missing screenshots due to the 5 attachment limit. I also can't delete the post to clean this up.

    While most of my problem is evident from what's here, it's unclear about everything I've tried so far, due to the missing screenshots and a lack of my conclusion - Which I can't add now.

    So probably best to just ignore this post - I'll re-post later when I can find a way to submit everything properly in one attempt.

    Thanks,

    David

    Comment

    • Markku
      Senior Member
      Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
      • Sep 2018
      • 1781

      #3
      Hi, just a small comment anyway, there is the Actions log in the Reports section, that should get you an idea if your action is attempted or not, if you are unsure about that.

      Markku

      Comment

      Working...