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

Zabbix&LAMP installation configuration

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

The operation on the monitoring side is based on the LAMP architecture to deploy the Zabbix installation Zabbix#lamp () {

# turn off firewall & core security function

Systemctl stop firewalld.service

Systemctl disable firewalld.service & > / dev/null

Setenforce 0

Sed-I "7cSELINUX=disabled" / etc/sysconfig/selinux

# download and install the necessary components

Yum install-y\

Httpd\

Mariadb-server mariadb\

Php\

Php-mysql\

Php-gd\

Libjpeg*\

Php-ldap\

Php-odbc\

Php-pear\

Php-xml\

Php-xmlrpc\

Php-mhash\

Expect

# modify the configuration file of httpd

Sed-I-e "95aServerName www.kgc.com"-e "/ DirectoryIndex/s/index.html/index.html index.php/" / etc/httpd/conf/httpd.conf

# modify the time zone of PHP

Sed-I "878cdate.timezone = PRC" / etc/php.ini

# Database & httpd startup

Systemctl start httpd.service

Systemctl enable httpd.service

Systemctl start mariadb.service

Systemctl enable mariadb.service

# set the initial database password

/ usr/bin/expect / dev/null

Systemctl restart mariadb & > / dev/null

Netstat-atnp | egrep'(httpd | 3306)'& > / dev/null

If [$?-ne 0]; then

Lamp

Fi

# set up zabbix database and manage users

Mysql-uroot-p123123-e "CREATE DATABASE zabbix character set utf8 collate utf8_bin;"

Mysql-uroot-p123123-e "GRANT all privileges ON. TO 'zabbix'@'%' IDENTIFIED BY' 123123;"

Mysql-uroot-p123123-e "flush privileges;"

Echo "start preparing to install zabbix"

Sleep 3

# install PHP corresponding tools

Yum install php-bcmath php-mbstring-y

# generate zabbix corresponding yum source

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

# install zabbix (wait patiently...)

For ((iFix _ 1 ~ (I > 0 ~ x ~ +)); do

Rpm-Q zabbix-web-mysql & > / dev/null

If [$?-ne 0]; then

Yum install zabbix-server-mysql zabbix-web-mysql-y

Else

Break

Fi

Done

# solve the local unable to login problem

Mysql-uroot-p123123-e "drop user'@ localhost;"

Mysql-uroot-p123123-e "drop user'@ localhost.localdomain;"

Mysql-uroot-p123123-e "flush privileges"

# generate database files

Zcat / usr/share/doc/zabbix-server-mysql-4.0.0/create.sql.gz | mysql- uzabbix-p123123 zabbix

# modify zabbix server configuration file

Sed-I "125cDBPassword=123123" / etc/zabbix/zabbix_server.conf

# modify time zone

Sed-I "20cphp_value date.timezone Asia/Shanghai" / etc/httpd/conf.d/zabbix.conf

# set boot self-boot

Systemctl enable zabbix-server

# start the service

Systemctl start zabbix-server

# restart the HTTP service

Service httpd restart

# View service status

Netstat-anpt | grep zabbix & > / dev/null

If [$?-eq 0]; then

Echo "zabbix server setup complete"

Fi

Dizhi=ifconfig ens33 | awk 'NR==2 {print $2}'

Echo "Please use your browser to log in to ${dizhi} / zabbix/ to install.

The default login user name is: Admin

Default login password is: zabbix "

-Log into the monitoring platform! [insert picture description here] (https://img-blog.csdnimg.cn/20200205193117319.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Nhb3poZW5ndGFvMTIxMw==,size_16,color_FFFFFF,t_70)! [insert picture description here] (https://img-blog.csdnimg.cn/20200206200439502.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Nhb3poZW5ndGFvMTIxMw==,size_16,color_FFFFFF,t_70)--- configuration agent

The agent is the controlled server. If the server needs to be monitored by itself, it also needs to install abbix-agent.

````bash# close firewall and set boot self-shutdown systemctl stop firewalld.service systemctl disable firewalld.service # install YumSource rpm-ivh http://repo.zabbix.com/zabbix/3.5/rhel/7/x86_64/zabbix-release-3.5-1.el7.noarch.rpm# install zabbix-agentyum install-y zabbix-agent# modify configuration file grep-n'^'[Amurz] / etc/zabbix/zabbix_agentd.conf13:PidFile=/var/run/zabbix / zabbix_agentd.pid32:LogFile=/var/log/zabbix/zabbix_agentd.log43:LogFileSize=098:Server=127.0.0.1139:ServerActive=127.0.0.1150:Hostname=Zabbix server268:Include=/etc/zabbix/zabbix_agentd.d/*.conf# modify the following line vim / etc/zabbix/zabbix_agentd.confServer=192.168.142.123 # 98 Point to the monitoring server IPServerActive=192.168.142.123 # 139line, point to the monitoring server IPHostname=czt # 150line, you can define your own hostname # start the service systemctl enable zabbix-agent.servicesystemctl start zabbix-agent.service# to view the service listening port netstat-anpt | grep zabbix adds the controlled host on the WEB platform so that the monitoring end can identify it.

Access http://192.168.142.123/zabbix/ configuration-hosts-create hosts:

Under configuration, click create Host.

Fill in the appropriate content in the host configuration interface, and then click the template

Select the template links for HTTP and SSH in the template, click add in the prompt, and then click add.

Newly added monitoring item

Thank you for reading!

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