Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to carry out centos7.2+zabbix3.2+sedmail email alarm

Shulou Source: shulou.com Published: 2022-06-01 02:37:19 11月13日 Update

Today, I would like to talk to you about how to carry out centos7.2+zabbix3.2+sedmail email alarm. maybe many people don't know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something from this article.

First, Overview sendEmail is a lightweight, command-line SMTP mail client. If you need to use the command line to send mail, then sendEmail is the perfect choice: easy to use and powerful. This is designed to be used in php, bash, perl and web sites to make sendEmail installation and configuration 1, need to install dependency package yum install perl-Net-SSLeay perl-IO-Socket-SSL-y2, download sendEmial package cd / usr/local/src/wget-c http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz3, Extract and install tar-xvf sendEmail-v1.56.tar.gzcd sendEmail-v1.56/cp-a sendEmail / usr/local/bin/chmod + x / usr/local/bin/sendEmail 4, execute sendEmail to view help information / usr/local/bin/sendEmail sendEmail-1.56 by Brandon Zehm Synopsis: sendEmail- f ADDRESS [options] Required:-f ADDRESS from (sender) email address * At least one recipient required via-t -cc, or-bcc * Message body required via-m, STDIN, or-o message-file=FILE Common:-t ADDRESS [ADDR...] To email address (es)-u SUBJECT message subject-m MESSAGE message body-s SERVER [: PORT] smtp mail relay, default is localhost:25 Optional:-a FILE [FILE...] File attachment (s)-cc ADDRESS [ADDR...] Cc email address (es)-bcc ADDRESS [ADDR...] Bcc email address (es)-xu USERNAME username for SMTP authentication-xp PASSWORD password for SMTP authentication Paranormal:-b BINDADDR [: PORT] local host bind address-l LOGFILE log to the specified file-v verbosity Use multiple times for greater effect-q be quiet (i.e. No STDOUT output)-o NAME=VALUE advanced options For details try:-- help misc-o message-content-type=-o message-file=FILE-o message-format=raw-o message-header=HEADER-o message-charset=CHARSET-o reply-to=ADDRESS-o timeout=SECONDS-o username=USERNAME-o password=PASSWORD-o tls=-o fqdn=FQDN Help:-- help the helpful overview you' Re reading now-help addressing explain addressing and related options-help message explain message body input and related options-help networking explain-s -b, etc-- help output explain logging and other output options-- help misc explain-o options, TLS, SMTP auth And more4 、 SendEmail mail test parameter description / usr/local/bin/sendEmail # Command main program-f from@test.cn # Sender mailbox-t to@test.cn # recipient mailbox-s smtp.test.cn # smtp server of sender mailbox-u "MY test Try message subject # title of message-o message-content-type=html # format of message content Html indicates that it is in html format-o message-charset=utf8 # message content encoding-xu from@test.cn # user name of sender mailbox-xp $passwd # sender mailbox password-m "message content of MY test" # specific content of message test / usr / local/bin/sendEmail-f my@test.com-t to@test.com-s smtp.test.cn-u "MY Test message subject"-o message-content-type=html-o message-charset=utf8-xu my@test.com-xp $passwd-m "MY Test message content"

3. Zabbix alarm configuration and alarm test 1. The specified directory defined by zabbix grep'^ [amurz]'/ etc/zabbix/zabbix_server.conf LogFile=/var/log/zabbix/zabbix_server.logLogFileSize=0PidFile=/var/run/zabbix/zabbix_server.pidDBHost=localhostDBName=zabbixDBUser=zabbixDBPassword=zabbixSNMPTrapperFile=/var/log/snmptrap/snmptrap.logTimeout=4AlertScriptsPath=/usr/lib/zabbix/alertscriptsExternalScripts=/usr/lib/zabbix/externalscriptsLogSlowQueries=3000cd / usr/lib/zabbix/alertscripts2, The sendEmail script vim sendEmail.shendEmail.shangxinxxanxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx The variable value needs to modify the username='my@test.com' # username, the password='$passwd'# password, and the from_email_address='my@test.com' # sender Email address. The value of the variable needs to be modified by to_email_address= "$1" # recipient Email address. The first parameter passed in by zabbix, message_subject_utf8= "$2" # message title, and the second parameter passed in by zabbix, message_body_utf8= "$3" # message content. The third parameter passed in by zabbix # converts the email title to GB2312 to solve the problem that the email title contains Chinese and the received email shows garbled codes. Message_subject_gb2312= `iconv-t GB2312-f UTF-8

Tags: Message content test sender mailbox parameter value subject command title script garbled address password recipient server format user user name UTF-8 Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft OPPO Reno Redmi Shulou Technology Shulou Information