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

Deploy and configure zabbix 3.2.x monitoring tools under CentOS 7.x

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

one。 Install the zabbix server

1. Download the official Yum source:

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

two。 Install the zabbix server (httpd and php services will be installed automatically):

Yum-enablerepo=zabbix install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-sender zabbix-get-y

3. Verify the installation package:

Rpm-qa | grep "zabbix\ | php\ | httpd"

Note that if the network speed is too slow and the installation continues to time out, you can download the rpm package through wget before installing it locally:

Wget "http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-server-mysql-3.2.4-2.el7.x86_64.rpm" wget "http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-web-mysql-3.2.4-2.el7.noarch.rpm"wget" http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/ Zabbix-agent-3.2.4-2.el7.x86_64.rpm "wget" http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-sender-3.2.4-2.el7.x86_64.rpm"wget "http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-get-3.2.4-2.el7.x86_64.rpm"

Install after download (dependencies will be installed automatically):

Yum localinstall zabbix-server-mysql-3.2.4-2.el7.x86_64.rpm-yyum localinstall zabbix-web-mysql-3.2.4-2.el7.noarch.rpm-yyum localinstall zabbix-agent-3.2.4-2.el7.x86_64.rpm-yyum localinstall zabbix-sender-3.2.4-2.el7.x86_64.rpm-yyum localinstall zabbix-get-3.2.4-2.el7.x86_64.rpm-y

Verify the installation package:

Rpm-qa | grep "zabbix\ | php\ | httpd"

If you are not familiar with selinux, it is best to disable selinux first to avoid errors during deployment:

Sed-I "s / ^ Selinus = enforcing/SELINUX=disabled/g" / etc/selinux/configsetenforce 0

II. Install and configure the database

1. Install the mariadb database:

Yum install mariadb-server mariadb mariadb-devel-y

two。 Configure the mariadb database, modify the data storage path, and modify the optimization parameters according to the actual situation:

# vim / etc/my.cnfdatadir=/data/mysql

3. Create a database data storage directory and grant mysql user rights:

Mkdir-p / data/mysqlchown-R mysql.mysql / data/mysql

4. Start mariadb and set Boot self-boot:

Systemctl start mariadbsystemctl enable mariadb

5. Configure database users and permissions:

Shell > mysqladmin-uroot password "cB5wB2mD1qR6lR1n" shell > mysql-uroot-pMariaDB [(none)] > drop database test;MariaDB [(none)] > grant all privileges on *. * to root@'localhost' identified by 'cB5wB2mD1qR6lR1n';MariaDB [(none)] > grant all privileges on *. * to root@'127.0.0.1' identified by' cB5wB2mD1qR6lR1n';MariaDB [(none)] > create database zabbix character set utf8 collate utf8_bin;MariaDB [(none)] > grant all privileges on zabbix.* to zabbix@localhost identified by 'dR1dF4fR1iP1dB1l';MariaDB [(none)] > quit

6. Import zabbix data:

Zcat / usr/share/doc/zabbix-server-mysql-3.2.*/create.sql.gz | mysql- uzabbix-p zabbix

3. Configure zabbix

1. Change the permissions of the fping command:

Chown root:zabbix / usr/sbin/fpingchmod 4710 / usr/sbin/fping

two。 Configure the zabbix service to modify the password parameters of the database zabbix user:

# vi / etc/zabbix/zabbix_server.confDBHost=localhostDBName=zabbixDBUser=zabbixDBPassword=dR1dF4fR1iP1dB1lFpingLocation=/usr/sbin/fping

3. Start the zabbix service and set it to boot:

Systemctl start zabbix-serversystemctl enable zabbix-server

Configure php and apache services

1. Modify the php configuration to change the time zone to East Zone 8:

# vim / etc/httpd/conf.d/zabbix.confphp_value date.timezone Asia/Shanghai

two。 Modify the apache configuration. For security reasons, change the default port 80 to other ports, especially if you need to access through the public network:

# vim / etc/httpd/conf/httpd.confListen 53302

3. Start the apache service and set it to boot:

Systemctl start httpdsystemctl enable httpd

4. Configure firewall to open apache port

Iptables-I INPUT-p tcp-- dport 53302-j ACCEPT

5. Initialize and install zabbix on the web:

Log in to zabbix and follow the prompts to install:

Http://10.135.3.135:53302/zabbix

Make sure that all the php test items pass, no problem, click next:

Enter the password for the database, and others use the default parameters:

Using the default parameters, click next:

Check the configuration information and proceed to the next step if there is no problem:

The installation is complete and the configuration information is written to the zabbix.conf.php file:

6. Configure zabbix

1. After installation, log in with the default account password:

Default username / password:

Admin/zabbix

two。 Do not reinstall zabbix:

Cd / usr/share/zabbix & & mv setup.php setup.php.default

3. Change the language to Chinese in the interface

4. Change the default account password

5. Disable Guests user groups

6. Solve the problem of Chinese garbled in zabbix chart display:

Go to the windows directory C:\ Windows\ Fonts\ Microsoft Yahei to find the file Microsoft Yahei-regular font, copy it, change the file name to msyh.ttf, and upload it to the / usr/share/zabbix/fonts directory of the zabbix server.

Edit the / usr/share/zabbix/include/defines.inc.php file to change the 45-line 'graphfont' to' msyh'

7. Create a new zabbix template:

1) Linux generic template:

Create a general template to make it easy for all linux hosts to link directly to use the template:

2) Windows generic template:

Create a general template to make it easy for all windows hosts to link directly to use the template:

8. Configure the alarm medium and use the mailbox to send the alarm email (the mailbox used to send the alarm must first open SMTP):

9. Configure the user's alarm medium (specify alarm recipient information):

10. Configure alarm actions:

1) create an alarm action:

2) configuration operation:

Default recipient: alarm {TRIGGER.STATUS}, server: {HOSTNAME1} occurs: {TRIGGER.NAME} alarm!

Default information:

Alarm host: {HOSTNAME1}

Alarm IP: {HOST.IP}

Alarm group: {TRIGGER.HOSTGROUP.NAME}

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

Alarm level: {TRIGGER.SEVERITY}

Alarm message: {TRIGGER.NAME}

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

Event ID: {EVENT.ID}

-

3) configure the recovery operation:

Default recipient: restore {TRIGGER.STATUS}, server: {HOSTNAME1}: {TRIGGER.NAME} has been restored!

Default information:

Alarm host: {HOSTNAME1}

Alarm IP: {HOST.IP}

Alarm group: {TRIGGER.HOSTGROUP.NAME}

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

Alarm level: {TRIGGER.SEVERITY}

Alarm message: {TRIGGER.NAME}

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

Event ID: {EVENT.ID}

-

11. Configure automatic discovery

1) configure auto-discovery rules:

2) configure auto-discovery action:

3) the discovered host is automatically linked to the general template:

4) after configuration, activate the activation rule

5) Note that when using autodiscovery, all client IP and hostname mappings need to be configured in the / etc/hosts file on the server side so that the hostname of the discovered monitoring host displays the hostname instead of the IP address.

[root@monitor ~] # cat / etc/hosts127.0.0.1 localhost localhost.localdomain VM_3_135_centos::1 localhost localhost.localdomain localhost6 localhost6.localdomain610.104.46.195 phptest

7. Install zabbix on the client host

The 1.linux server installs the zabbix client:

1) install the official Yum source:

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

2) install the zabbix client:

Yum-enablerepo=zabbix install zabbix-agent

Note that if the network speed is too slow and the installation continues to time out, you can download the rpm package through wget before installing it locally:

Wget "http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-agent-3.2.4-2.el7.x86_64.rpm"

Install after download:

Yum localinstall zabbix-agent-3.2.4-2.el7.x86_64.rpm-y

3) verify the installation package:

Rpm-qa | grep "zabbix"

4) configure client service:

Sed-I's servers 127.0.0.1 Timeout=3#Timeout=30#g' servers 10.135.3.135g'/ etc/zabbix/zabbix_agentd.confsed-I's #\ # Timeout=3#Timeout=30#g' / etc/zabbix/zabbix_agentd.conf

Modify the Hostname parameter to the hostname of the client

5) start the zabbix service and set it to boot:

Systemctl start zabbix-agentsystemctl enable zabbix-agent

6) zabbix client automatic installation script:

[root@test2 ~] # cat install_zabbix_agent.sh #! / bin/bash### author:ellen# describe: automatically install zabbix client service # updated:20170531## # error message shows _ err () {echo-e "\ 033 [1] in red 31m [ERROR] $@ 033 [0m "} # General information is shown in green _ info () {echo-e"\ 033 [132m [Info] $@\ 033 [0m "} rpm-qa | grep zabbix-agentif [$?-eq 0]; then _ err" zabbix client already exists, please check. " Exit 1fi# download zabbix official source _ info "start installing Zabix official source." rpm-ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpmif [$?-eq 0]; then _ info "zabbix official source installed successfully, start installing the zabbix client." else rpm-qa | grep zabbix-release-3.2 if [$?-eq 0] Then _ info "zabbix official source already exists, start installing zabbix client." Else _ err "zabbix official source installation failed, please check." Exit 1 fifi# online installation of zabbix client yum-- enablerepo=zabbix install zabbix-agent- y# locally installed zabbix client # yum localinstall / root/zabbix-agent-3.2.4-2.el7.x86_64.rpm-yif [$?-eq 0]; then _ info "zabbix client installation succeeded and started to configure zabbix client." else _ err "zabbix client installation failed, please check." Exit 1fi# modifies the zabbix configuration sed-I server server 127.0.0.1 server server 10.135.3.135g'/ etc/zabbix/zabbix_agentd.confgrep "^ Server=" / etc/zabbix/zabbix_agentd.confsed-I's #\ # Timeout=3#Timeout=30#g' / etc/zabbix/zabbix_agentd.confgrep "^ Timeout=" / etc/zabbix/zabbix_agentd.confsed-I "s/Hostname=Zabbix server/Hostname= `hostname` / g" / etc/zabbix/zabbix_agentd.confgrep The "^ Hostname=" / etc/zabbix/zabbix_agentd.conf_info "configuration has been modified. Now start the zabbix client. "# start the zabbix client and set the boot systemctl enable zabbix-agentsystemctl start zabbix-agentif [$?-eq 0] Then _ info "zabbix client started successfully." Else _ err "zabbix client failed to start, please check." Exit 1fips aux | grep-v grep | grep zabbix_ agentd [root @ test2 ~] #

If the following process occurs when starting the zabbix client using script automatic installation, execute the systemctl restart zabbix-agent command to restart the zabbix client

The service is normal after restart:

The 2.windows server installs the zabbix client:

1) download the client package http://www.zabbix.com/downloads/3.2.0/zabbix_agents_3.2.0.win.zip

Extract the package and rename the zabbix_agentd.win.conf in the extracted subdirectory conf to zabbix_agentd.conf

2) modify the following parameters in the zabbix_agentd.conf configuration:

Server=10.135.3.135ServerActive=10.135.3.135Timeout=30Hostname=10_104_102_26

Note: the Hostname hostname is obtained by opening the cmd command line locally and executing hostname.

3) after modification, copy the zabbix_agents_3.2.0.win program directory to disk C, cut zabbix_agentd.conf to disk C, and go to the C:\ Windows\ System32 directory to open cmd as an administrator:

4) execute the following command to install the client:

Zabbix_agentd.exe-install

5) after installation, execute the following command to start the client:

Zabbix_agentd.exe-start

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

Servers

Wechat

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

12
Report