Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Zabbix3.2 super-detailed building process + email alarm mechanism

2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Change the address of the blog to www.qxfell.com

Zabbix:zabbix 3.2

Linux: CentOS 7

Yum source: 163epel whichever is fine

163The wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

Epel yum-y install epel-release

Close selinux: setenforce 0

Turn off the firewall: systemctl stop firewalld.service

Or open port 10050 10051 80

Firewall-cmd-permanent-add-port=10050/tcp

Firewall-cmd-permanent-add-port=10051/tcp

Firewall-cmd-permanent-add-port=80/tcp

Firewall-cmd-reload quickly reload firewall rules

Xshell connection virtual machine NAT mode (you can also create 2 network cards to connect to Xshell)

Open the virtual network editor

In this way, Xshell can connect to the Linux system in NAT mode.

The perl version of Centos7 defaults to 5.16. If you send mail with sendemail, you will get an error, so uninstall 5.16 and then install the 5.10 version in the source code.

When uninstalling perl5.16, vim will be treated as a dependency and uninstalled together. You can use vi to edit files. (actually, I don't quite understand. Version 5.16 of perl email seems to be able to send normally. In the first experiment, this error was reported online. The solution found on the Internet is the perl version problem.)

Wget http://www.cpan.org/src/5.0/perl-5.10.0.tar.gz

. / configure.gnu-des-Dprefix=/usr/local/perl (remember to install gcc* for source code installation)

Make

Make test (please ignore any error report)

Make install

Mv / usr/bin/perl / usr/bin/perl.bak

Ln-s / usr/local/perl/bin/perl / usr/bin/perl

Perl-v (view perl version)

Send a test email after installing sendemail. If the perl version is 5.16, the following error occurs

Download the zabbix3.2 rpm feed (put it on / etc/yum.repos.d/)

Rpm-ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm

Server yum install zabbix-server-mysqlzabbix-web-mysql

Client yum install zabbix-agent (client needs to be installed because you want to monitor the native machine)

Install the database yum-y installmariadb mariadb-server (centos7's database is no longer using mysql but mariadb)

Modify the encoding format of the database to utf8 vim / etc/my.cnf (web interface to better support Chinese)

Add

Character_set_server=utf8

Init_connect='SETNAMES utf8'

Initialize the database

Mysql_secure_installation

Enter to set the database password

Remove anonymous users? Delete anonymous users?

Disallow root login remotely? Prohibit root remote login

Remove test database and access to it? Delete the test database and access it

Reload privilege tables now? Reload the privilege table

Create databases and users and grant authorization

Create database zabbix_db

Grant all privileges on zabbix_db.* to zabbix@localhost identified by 'zabbix'

Flush privileges; (refresh privileges authorization)

Exit

Import zabbix3.2 database

Cd / usr/share/doc/zabbix-server-mysql-3.0.4/

Gunzip create.sql.gz

Mysql-uroot-p zabbix_db

< create.sql 修改php参数 Vim /etc/php.ini max_execution_time = 300 memory_limit = 128M post_max_size = 16M upload_max_filesize = 2M max_input_time = 300 always_populate_raw_post_data = -1 date.timezone = Asia/Shanghai 修改zabbix_server的配置文件 vim /etc/zabbix/zabbix_server.conf DBHost=localhost DBName=zabbix_db 数据库名 DBUser=zabbix 授权的数据库用户 DBPassword=zabbix 授权的数据库用户密码 修改zabbix-agent配置文件 vim/etc/zabbix/zabbix_agent.conf Server=127.0.0.1 (服务端IP) ServerActive=127.0.0.1 (服务端IP) Hostname=zabbix (被监测主机的主机名) 开启服务 systemctl start mariadb systemctl enable mariadb systemctl start httpd systemctl enable httpd systemctl start zabbix-server systemctl enable zabbix-server systemctl start zabbix-agent 打开浏览器输入 ip/zabbix 安装zabbix3.2

Default login user name admin password zabbix

Web interface changed to Chinese

Normal interface

Monitor Linux hosts (need to turn off selinux and open firewall)

Rpm-ivh http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm

Yum install-y zabbix-agent

Modify zabbix-agent client profile

Vim / etc/zabbix/zabbix_agentd.conf

Server=192.168.110.10 (server IP)

Serveractive=192.168.110.10 (server IP)

Hostname=fei00 (hostname of the monitored host)

Open zabbix-agent service / etc/init.d/zabbix-agent start after saving and exiting

Set self-boot chkconfig zabbix-agent on

Add hosts in the web interface

If the availability is green, it means that it has been enabled successfully.

Check the host through graphical view

Solve the problem of incomplete display of Chinese garbled codes in web interface

Download (available on native windows) Microsoft Yahei or other font ttf format and upload it to / usr/share/zabbix/fonts directory

Modify the configuration front-end file

Vim / usr/share/zabbix/include/defines.inc.php

Just save and exit.

Sendemail email alarm

Wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz

Tar-xvf sendEmail-v1.56.tar.gz

Cp sendEmail-v1.56/sendEmail / usr/local/bin/

Chmod 755 / usr/local/bin/sendEmail

Go to the zabbix default script directory / usr/lib/zabbix/alertscripts

Create script vim SendEmail.sh

Don't forget to set execution permissions and groups for the script

Chmod 777 SendEmail.sh

Chown zabbix.zabbix SendEmail.sh

Email delivery test bash SendEmail 1183766365@qq.com "subject"content"

If verification fails when sending a test message, port 25 cannot be opened

Dec 03 22:47:02 zabbixsendEmail [3439]: ERROR = > ERROR = > SMTP-AUTH: Authentication tosmtp.163.com:25 failed.

Please confirm whether the smtp service is enabled in your email client.

Web interface settin

{ALERT.SENDTO} recipient address

{ALERT.SUBJECT} topic

{ALERT.MESSAGE} details

Alarm message

The blogger is also a novice in the article. If there are any mistakes, please contact me to correct them in time.

Mailbox 17601611570@163.com

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report