


Zabbix implementation of email alarm example tutorial
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



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? 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

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

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 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.

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

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 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
