• Home
  • Services
    • DBA Support
    • DBA Consultancy Services
    • PostgreSQL Support
    • Website Maintenance
  • Courses

    About Courses

    • List Of Courses
    • Become an Instructor
    Greenplum Database

    Greenplum Database

    $2,000.00 $1,500.00
    Read More
  • Company
    • FAQs
    • About Us
    • Contact
  • Events
  • Portfolio
  • Blogs
    • Blog – RayaFeeL
    • Blog – PostgreSQL Support
    • Blog – PostgreSQL Migration
    • Blog – All DB’s
    • Blog – Linux
    • Blog – Medical Coding
      • Cart

        0

    Have any question?
    (+91)8838953252
    ITsupport@rayafeel.com
    RegisterLogin
    RayaFeeL
    • Home
    • Services
      • DBA Support
      • DBA Consultancy Services
      • PostgreSQL Support
      • Website Maintenance
    • Courses

      About Courses

      • List Of Courses
      • Become an Instructor
      Greenplum Database

      Greenplum Database

      $2,000.00 $1,500.00
      Read More
    • Company
      • FAQs
      • About Us
      • Contact
    • Events
    • Portfolio
    • Blogs
      • Blog – RayaFeeL
      • Blog – PostgreSQL Support
      • Blog – PostgreSQL Migration
      • Blog – All DB’s
      • Blog – Linux
      • Blog – Medical Coding
        • Cart

          0

      alerting the zabbix server for postgres Database

      Home › Forums › PostgreSQL Database › alerting the zabbix server for postgres Database

      • This topic has 1 reply, 1 voice, and was last updated 2 years ago by Admin bar avatarNijamutheen J.
      Viewing 2 posts - 1 through 2 (of 2 total)
      • Author
        Posts
      • February 16, 2019 at 2:52 am #16951
        Admin bar avatarNijamutheen J
        Participant

        When I configure smtp for alerting, the zabbix server crashes
        how should I do?

        February 16, 2019 at 3:06 am #16952
        Admin bar avatarNijamutheen J
        Participant

        If you are using Zabbix to monitor your infrastructure you might want to receive email alerts from your local domain somewhere on public internet domain, even if you don’t own a valid registered internet domain name with a mail server which you can configure on your own.

        Configure Zabbix Mail Alerts
        Configure Zabbix Mail Alerts – Part 2

        This tutorial will briefly discuss you on how to setup Zabbix server to send mail reports to a Gmail address by using SSMTP program, without the need to install and configure any local MTA daemon, such as Postfix, Exim etc.

        Requirements
        Install Zabbix Monitoring Server
        Step 1: Install and Configure SSMTP
        1. SSMTP is a small software, which does not fulfill any of the functionality of a mail server, but only delivers emails from a local machine to an external email address on a mailhub.

        To install SSMTP program alongside with mailutils package that you will use it to send mails, issue the following command on your RedHat and Debian like server:

        # yum install ssmtp mailx [On RHEL/CentOS 7]
        $ sudo apt-get install ssmtp mailutils [On Debian 8]
        2. After the packages are installed on the system, configure SSMTP program to send local emails to your Gmail account by opening the main configuration file for editing with your favorite text editor and root privileges and use the following parameter settings:

        # vi /etc/ssmtp/ssmtp.conf [On RHEL/CentOS 7]
        $ sudo nano /etc/ssmtp/ssmtp.conf [On Debian 8]
        SSMTP settings for GMAIL account

        root=gmail-username@gmail.com
        mailhub=smtp.gmail.com:587
        rewriteDomain=your_local_domain
        hostname=your_local_FQDN
        UseTLS=Yes
        UseSTARTTLS=Yes
        AuthUser=Gmail_username
        AuthPass=Gmail_password
        FromLineOverride=YES
        Configure Zabbix Email Alerts
        Configure Zabbix Email Alerts

        Step 2: Gmail Tests for Zabbix Email Alerts
        3. On the next step it’s time to send a local generated email to Gmail account by issuing the below command.

        # echo “Body test email from ‘hostname -f’ “| mail -s “subject here” gmail_user@gmail.com
        Gmail Tests
        Gmail Tests

        4. Normally, Gmail prevents different types of authentications to their servers from your account, so, in case you get the error “mail: cannot send message: Process exited with non-zero status”, then login to your Gmail account from browser and navigate to the following link https://www.google.com/settings/security/lesssecureapps in order to allow access for less secure apps as in the following screen.

        Manage Secure Gmail Apps
        Manage Secure Gmail Apps

        5. After you have turned on Less Secure Apps feature on your Gmail account, run the above mail command again and verify your Inbox after a few seconds to check if the locally generated email has been successfully delivered – you should normally see the email has incoming from Gmail.

        Mail Delivery Confirm
        Mail Delivery Confirm

        Step 3: Configure Zabbix Sendmail Script
        6. Further, based on the $(which mail) command create the following Bash script to Zabbix alertscripts directory with the following content and give it execute permissions:

        # vi /usr/local/share/zabbix/alertscripts/zabbix-sendmail [On RHEL/CentOS 7]
        $ sudo nano /usr/local/share/zabbix/alertscripts/zabbix-sendmail [On Debian 8]
        Script content:

        #!/bin/bash
        echo “$3” | /usr/bin/mail -s “$2” $1
        Configure Sendmail Zabbix
        Configure Sendmail Zabbix

        Next, set the execute permission on the script file.

        # chmod +x /usr/local/share/zabbix/alertscripts/zabbix-sendmail
        7. Next, as previously, test the script functionality by sending a local email to Gmail account. The way to run the script with positional parameters is explained above:

        # /usr/local/share/zabbix/alertscripts/zabbix-sendmail gmail_username@gmail.com “Subject here” “Body of the message here”
        Send Mail to Gmail Account from Linux
        Send Mail to Gmail Account

        Afterwards, verify Gmail Inbox and check if the new local message has arrived.

        Verify Mail Delivery
        Verify Mail Delivery

        Step 4: Configure Zabbix to Send Alerts to Gmail
        8. If the tests so far were successful, then you can move to next step and setup Zabbix to send generated email alerts to Gmail. First, login to Zabbix web interface and navigate to the following menu: Administration -> Media types -> Create media type.

        Zabbix Administration
        Zabbix Administration

        9. On the next screen enter an arbitrary Name to uniquely identify for the script in the Zabbix configurations (in this example Send-Email-Script is used), choose Script as Type from the list and enter the name of the Bash script created earlier (zabbix-sendmail used in this tutorial) to send email from command line (don’t use the path for the script, only the script name). When you’re done, hit the Add button below to reflect changes.

        Create Zabbix Email Alerts
        Create Zabbix Email Alerts

        10. Further, let’s configure an email address to which you will send Zabbix alerts. Go to Profile -> Media -> Add and a new pop-up window should appear.

        Here, select the name of the script that you have earlier named (in this example Send-Email-Script is used) for Type, enter the Gmail address to which you will send emails, choose the time period (week, hours) when email reports should be active for sending, choose the severity of the messages that you want to receive on your Gmail address, select Enabled as Status and hit the Add button to add the media. Finally hit the Update button to apply configuration.

        Configure Zabbix Mail Address
        Configure Zabbix Mail Address

        Zabbix Update Configuration
        Zabbix Update Configuration

        11. On the next step, enable the defult zabbix alerts by navigating to Configuration -> Actions, select as the Event Source – > Triggers from the right menu and hit on Disabled Status in order to enable it. Repeat the step for Event Source – > Internal or other custom created Actions and you’re done.

        Enable Default Zabbix Mail Alert
        Enable Default Zabbix Mail Alert

        Zabbix Enabled Actions
        Zabbix Enabled Actions

        Wait for a while for Zabbix to start gather information and generate some reports, then verify your Gmail Inbox and you should see some Zabbix alerts submitted so far.

        Zabbix Monitoring Mail Alerts
        Zabbix Monitoring Mail Alerts

        That’s all! Although this guide was mainly focused on sending Zabbix alerts to a Gmail account using Gmail SMTP server as a mailhub, using the same configuration you can, also, push zabbix email alerts further to other valid internet email accounts by relying on Gmail to route your emails through SMTP servers.

      • Author
        Posts
      Viewing 2 posts - 1 through 2 (of 2 total)

      You must be logged in to reply to this topic. Login here

      Search

      ADVERTISEMENT

      Latest Posts

      PostgreSQL Patching version 9, 10,11
      10Oct2019
      Tools for PostgreSQL
      16Sep2019
      Postgres user creation and restrict DDL & database access
      13Sep2019
      PostgreSQL SSL Setup
      07Sep2019
      How to DELETE current XLOG / WAL LOG in postgresql database ?
      19Aug2019

      Latest Courses

      PostgreSQL Database

      PostgreSQL Database

      $600.00 $500.00
      Greenplum Database

      Greenplum Database

      $2,000.00 $1,500.00

      Preview Course

      Free

      Recent Forum Topics

      • thought behind whiteboard activity
      • Are you going to take your first ste
      • How to start working on an application?
      • please let me know pre requirements to increase work_mem
      • how to copy some data in one table to another table in postgres

      2ndquadrant.in

      (+91) 8838953252

      ITsupport@rayafeel.com

      Company

      • About Us
      • Contact
      • Our Team
      • Blog

      COURSES

      • List Of Course
      • Become An Instructor
      • Events
      • Postgres Support Blog

      Support

      • DBA Support
      • Consultancy Services
      • Postgres Migration Blogs
      • Forum

      Recommend

      • Groups
      • Login
      • FAQs
      • SignUp

      IT Services by rayafeel.com. Powered by Rayafeel Technologies Pvt Ltd.

      • Privacy
      • Terms

      Become An Instructor?

      Join thousand of instructors and earn money hassle free!

      Get Started Now

      Login with:

      Login with Google Login with Twitter Login with LinkedIn Login with Microsoft

      Login with your site account

      Lost your password?

      Not a member yet? Register now

      Register a new account

      Are you a member? Login now