Home Operation and Maintenance Linux Operation and Maintenance Zabbix implementation of email alarm example tutorial

Zabbix implementation of email alarm example tutorial

Jun 21, 2017 am 11:15 AM
zabbix accomplish Call the police mail

Description:

Zabbix monitoring server and client have been deployed, the monitored host has been added, and Zabiix monitoring is running normally.

Purpose:

Set an email alarm on the Zabbix server. When the monitored host goes down or reaches the trigger preset value, an alarm email will be automatically sent to Specify email address.

Specific operations:

The following operations are performed on the Zabbix monitoring server

Remarks: Zabbix monitoring server

Operating system: CentOS

Use an external email account to send alarm emails settings:

1. Close sendmail or postfix

service sendmail stop #Close

chkconfig sendmail off #Prohibit Start at boot

service postfix stop

chkconfig postfix off

Note:

When using an external email account, there is no need to start sendmail or postfix

If you use an external mailbox to send alarm emails while sendmail or postfix is ​​started, the external mailbox

configuration information will be read first.

2. Install the mail sending tool mailx

yum install mailx #Install

CentOS 5.x Compile and install mailx. The mailx version installed directly by yum is too old, use external mail There will be problems with sending.

yum remove mailx #Uninstall the old version of mailx that comes with the system

Download mailx:


tar jxvf mailx-12.4.tar.bz2 #Unzip

cd mailx-12.4 #Enter directory

make #Compile

make install UCBINSTALL=/usr/bin/install #Install

ln - s /usr/local/bin/mailx /bin/mail #Create a soft connection from mailx to mail

ln -s /etc/nail.rc /etc/mail.rc #Create a soft connection to the mailx configuration file

3. Configure Zabbix server external mailbox

vi /etc/mail.rc #Edit and add the following information

set from=xxx@163.com smtp=smtp. 163.com //Add the sender and sending server

set smtp-auth-user=xxx@163.com smtp-auth-password=123456 //Add the sending email address and login password.

set smtp-auth=login

:wq! #Save and exit

echo "zabbix test mail" |mail -s "zabbix" yyy@163.com

#Test sending an email, title zabbix, email content: zabbix test mail, email sent to: yyy@163.com

#At this time, the email yyy@163.com will receive a message from xxx Test email from @163.com

4. Configure Zabbix server email alarm

1. Open Zabbix

Management-Alert Media Type-Create Media Type

Name: Sendmail

Type: Script

Script name: sendmail.sh

Enabled: Check

Archive

2. Set Zabbix user alarm email address

Type: Sendmail

Recipient: xxx@163.com

Other defaults are acceptable, or

Set as needed

Status: Enabled

Archive

3. Set the action for Zabbix to trigger the alarm

Configuration-Action-Create Action

Name: Action-Email

Default recipient: Failure {TRIGGER.STATUS}, Server: {HOSTNAME1} Occurrence: {TRIGGER.NAME} failure !

Default information:

Alarm host: {HOSTNAME1}

Alarm time: {EVENT.DATE} {EVENT.TIME}

Alarm level: {TRIGGER.SEVERITY}

Alarm information: {TRIGGER.NAME}

Alarm item:{TRIGGER.KEY1}

Problem details:{ITEM.NAME}:{ITEM .VALUE}

Current status:{TRIGGER.STATUS}:{ITEM.VALUE1}

Event ID:{EVENT.ID}

Restore information: check

Restore purpose: Restore {TRIGGER.STATUS}, Server: {HOSTNAME1}: {TRIGGER.NAME} has been restored !

Recovery information:

Alarm host: {HOSTNAME1}

Alarm time: {EVENT.DATE} {EVENT.TIME}

Alarm level: {TRIGGER.SEVERITY}

Alarm information: {TRIGGER.NAME}

Alarm item:{TRIGGER.KEY1}

Problem details:{ITEM.NAME}:{ITEM .VALUE}

Current status:{TRIGGER.STATUS}:{ITEM.VALUE1}

Event ID:{EVENT.ID}

Enabled: Tick

Switch to operation option

New

Operation type: Send message

Send to user: Add

Default information: Check

Select user: Admin

Select

Send only to: Sendmail

Archive

4. Add Zabbix server email sending script

cd /usr/local/zabbix/share/zabbix/alertscripts #Enter the script storage directory

vi sendmail.sh #Edit and add the following code

#!/bin/sh

echo "$3" | mail -s "$2" $1

:wq! #Save and exit

chown -R zabbix.zabbix Add the relative path of the script to the /usr/local/zabbix/share/zabbix/alertscripts/*

zabbix_server.conf file

AlertScriptsPath=/usr/local/zabbix/share/zabbix/alertscripts

#Set the script owner as the zabbix user

chmod +x /usr/local/zabbix/share/zabbix/alertscripts/sendmail.sh

#Set the script execution permissions

5. Test Zabbix alarm

Close Zabbix client service

service zabbix_agentd stop

Check your xxx@163.com mailbox and you will receive an alarm email

Restart Zabbix client service

service zabbix_agentd start

Check your xxx@163.com mailbox, you will receive a recovery email

Use an external mailbox The settings for sending alarm emails to the account are completed.

At this point, the Zabbix email alarm setting is completed.

The above is the detailed content of Zabbix implementation of email alarm example tutorial. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Outlook emails lost from control panel in Windows 11 Outlook emails lost from control panel in Windows 11 Feb 29, 2024 pm 03:16 PM

Is the Outlook mail icon missing from Windows 11's Control Panel? This unexpected situation has caused confusion and concern among some individuals who rely on OutlookMail for their communication needs. Why don't my Outlook emails show up in Control Panel? There may be several possible reasons why there are no Outlook mail icons in Control Panel: Outlook is not installed correctly. Installing Office applications from the Microsoft Store does not add the Mail applet to Control Panel. The location of the mlcfg32.cpl file in Control Panel is missing. The path to the mlcfg32.cpl file in the registry is incorrect. The operating system is not currently configured to run this application

How to implement dual WeChat login on Huawei mobile phones? How to implement dual WeChat login on Huawei mobile phones? Mar 24, 2024 am 11:27 AM

How to implement dual WeChat login on Huawei mobile phones? With the rise of social media, WeChat has become one of the indispensable communication tools in people's daily lives. However, many people may encounter a problem: logging into multiple WeChat accounts at the same time on the same mobile phone. For Huawei mobile phone users, it is not difficult to achieve dual WeChat login. This article will introduce how to achieve dual WeChat login on Huawei mobile phones. First of all, the EMUI system that comes with Huawei mobile phones provides a very convenient function - dual application opening. Through the application dual opening function, users can simultaneously

Word mail merge prints blank page Word mail merge prints blank page Feb 19, 2024 pm 04:51 PM

If you find that blank pages appear when printing a mail merge document using Word, this article will help you. Mail merge is a convenient feature that allows you to easily create personalized documents and send them to multiple recipients. In Microsoft Word, the mail merge feature is highly regarded because it helps users save time manually copying the same content for each recipient. In order to print the mail merge document, you can go to the Mailings tab. But some Word users have reported that when trying to print a mail merge document, the printer prints a blank page or doesn't print at all. This may be due to incorrect formatting or printer settings. Try checking the document and printer settings and make sure to preview the document before printing to ensure the content is correct. if

PHP Programming Guide: Methods to Implement Fibonacci Sequence PHP Programming Guide: Methods to Implement Fibonacci Sequence Mar 20, 2024 pm 04:54 PM

The programming language PHP is a powerful tool for web development, capable of supporting a variety of different programming logics and algorithms. Among them, implementing the Fibonacci sequence is a common and classic programming problem. In this article, we will introduce how to use the PHP programming language to implement the Fibonacci sequence, and attach specific code examples. The Fibonacci sequence is a mathematical sequence defined as follows: the first and second elements of the sequence are 1, and starting from the third element, the value of each element is equal to the sum of the previous two elements. The first few elements of the sequence

How to implement the WeChat clone function on Huawei mobile phones How to implement the WeChat clone function on Huawei mobile phones Mar 24, 2024 pm 06:03 PM

How to implement the WeChat clone function on Huawei mobile phones With the popularity of social software and people's increasing emphasis on privacy and security, the WeChat clone function has gradually become the focus of people's attention. The WeChat clone function can help users log in to multiple WeChat accounts on the same mobile phone at the same time, making it easier to manage and use. It is not difficult to implement the WeChat clone function on Huawei mobile phones. You only need to follow the following steps. Step 1: Make sure that the mobile phone system version and WeChat version meet the requirements. First, make sure that your Huawei mobile phone system version has been updated to the latest version, as well as the WeChat App.

Three cameras with 20x zoom, Honor selects Xiaopai Smart Camera Pro innovation is coming Three cameras with 20x zoom, Honor selects Xiaopai Smart Camera Pro innovation is coming Aug 23, 2024 pm 09:44 PM

Have you installed cameras in your home? In recent years, home camera products have suddenly become a hit. I asked my friends around me, and boy, every house has one, and some even have more than one. However, with the popularity of the product, it has also brought some complaints during use. For example, you can only see one place at the same time, and if you want to see other places, you have to adjust the pan/tilt and rotate the camera back and forth. There is a certain blind spot and time difference when viewing the picture; or when you want to take a closer look at a certain location in your home, you find that the picture is blurry and you cannot see it at all. Clarity; etc... The experience is greatly compromised. Honor Select and Xiaopai Technology jointly launched the Honor Select Xiaopai Smart Camera Pro featuring "three lenses and dual images". Provides new solutions to industry and user pain points

Master how Golang enables game development possibilities Master how Golang enables game development possibilities Mar 16, 2024 pm 12:57 PM

In today's software development field, Golang (Go language), as an efficient, concise and highly concurrency programming language, is increasingly favored by developers. Its rich standard library and efficient concurrency features make it a high-profile choice in the field of game development. This article will explore how to use Golang for game development and demonstrate its powerful possibilities through specific code examples. 1. Golang’s advantages in game development. As a statically typed language, Golang is used in building large-scale game systems.

PHP Game Requirements Implementation Guide PHP Game Requirements Implementation Guide Mar 11, 2024 am 08:45 AM

PHP Game Requirements Implementation Guide With the popularity and development of the Internet, the web game market is becoming more and more popular. Many developers hope to use the PHP language to develop their own web games, and implementing game requirements is a key step. This article will introduce how to use PHP language to implement common game requirements and provide specific code examples. 1. Create game characters In web games, game characters are a very important element. We need to define the attributes of the game character, such as name, level, experience value, etc., and provide methods to operate these

See all articles