In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
I. brief introduction
Zabbix (pronounced zbix) is an enterprise-level open source solution based on WEB interface that provides distributed system monitoring and network monitoring capabilities.
Zabbix can monitor various network parameters to ensure the safe operation of the server system, and provides a flexible notification mechanism to enable system administrators to quickly locate / solve various problems.
Zabbix consists of two parts, zabbix server and optional component zabbix agent.
Zabbix server can provide remote server / network status monitoring, data collection and other functions through SNMP,zabbix agent,ping, port monitoring and other methods. It can run on platforms such as Linux,Solaris,HP-UX,AIX,Free BSD,Open BSD,OS X.
Second, the experimental environment
Mainframe
The operating system IP address mainly includes software Zabbix ServerCentos7.2192.168.1.103zabbix-3.2.4, httpd, mariadb, php and so on. Zabbix AgentCentos7.2192.168.1.105zabbix-3.2.4Zabbix AgentWindows Server 2008 R2192.168.1.106
Third, set up Zabbix Server and add hosts
1. Install Zabbix Server
Install the required software packages
[root@bogon ~] # yum-y install gcc* make php php-gd php-mysql php-bcmath php-mbstring php-xml curl curl-devel net-snmp net-snmp-devel perl-DBI httpd mariadb* mysql-devel libxml2-devel curl-devel unixODBC-devel net-snmp-devel OpenIPMI-devel vim
Create a zabbix user
[root@bogon zabbix-3.2.4] # useradd zabbix
Turn off the firewall (since this is the experimental environment for debugging convenience, the firewall must be turned on in the production environment and the relevant rules must be configured)
[root@bogon zabbix-3.2.4] # systemctl stop firewalld.service
[root@bogon ~] # tar xf zabbix-3.2.4.tar.gz
[root@bogon ~] # cd zabbix-3.2.4
[root@bogon zabbix-3.2.4] # / configure-- enable-server-- enable-agent-- with-mysql-- with-net-snmp-- with-libcurl-- with-libxml2-- with-openipmi-- with-unixodbc
[root@bogon zabbix-3.2.4] # make install
Start the database
[root@bogon zabbix-3.2.4] # systemctl start mariadb.service
Set the password to the database (this experiment is a newly installed database, so set the password to linux.com123)
[root@bogon zabbix-3.2.4] # mysqladmin-u root-p password linux.com123
Enter password: ← can directly hit enter (the newly installed database has no password by default)
[root@bogon zabbix-3.2.4] # mysql-u root-p
Enter password: ← enter the password you just set
Create a new user with the user name "zabbix" password "zabbix" and authorize the zabbix database to the zabbix user
MariaDB [(none)] > create database zabbix character set utf8 collate utf8_bin
MariaDB [(none)] > insert into mysql.user (Host,User,Password) values ('localhost','zabbix',password (' zabbix'))
MariaDB [(none)] > flush privileges
MariaDB [(none)] > grant all on zabbix.* to 'zabbix'@'localhost' identified by' zabbix' with grant option
MariaDB [(none)] > flush privileges
MariaDB [(none)] > quit
Import Sql statement
[root@bogon zabbix-3.2.4] # mysql-uzabbix-pzabbix zabbix
< database/mysql/schema.sql [root@bogon zabbix-3.2.4]# mysql -uzabbix -pzabbix zabbix < database/mysql/p_w_picpaths.sql [root@bogon zabbix-3.2.4]# mysql -uzabbix -pzabbix zabbix < database/mysql/data.sql 在/etc/php.ini中添加或修改如下内容 [root@bogon zabbix-3.2.4]# vim /etc/php.ini 878 date.timezone= Asia/Shanghai 384 max_execution_time = 300 672 post_max_size = 32M 407 memory_limit = 128M 1707 mbstring.func_overload = 1 将httpd、mariadb添加到系统启动 [root@bogon ~]# systemctl enable httpd.service [root@bogon ~]# systemctl enable mariadb.service [root@bogon zabbix-3.2.4]#cp misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_server [root@bogon zabbix-3.2.4]#cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/zabbix_agentd [root@bogon zabbix-3.2.4]# chkconfig --add zabbix_server [root@bogon zabbix-3.2.4]# chkconfig zabbix_server on [root@bogon zabbix-3.2.4]# chkconfig --add zabbix_agentd [root@bogon zabbix-3.2.4]# chkconfig zabbix_agentd on [root@bogon zabbix-3.2.4]# cp -r ./frontends/php/ /var/www/html/zabbix [root@bogon zabbix-3.2.4]# chown -R apache.apache /var/www/html/zabbix 启动httpd服务 [root@bogon ~]# systemctl start httpd.service Zabbix Agent配置(被监控端) [root@bogon ~]# yum -y install gcc* make vim [root@bogon ~]# setenforce 0 [root@bogon ~]# vim /etc/sysconfig/selinux [root@bogon ~]# systemctl stop firewalld.service [root@bogon ~]# setenforce 0 [root@bogon ~]# vim /etc/sysconfig/selinux [root@bogon ~]# systemctl stop firewalld.service 编译安装Zabbix Agent [root@bogon zabbix-3.2.4]# ./configure --enable-agent [root@bogon zabbix-3.2.4]# make install [root@bogon zabbix-3.2.4]#cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/zabbix_agentd [root@bogon zabbix-3.2.4]# chkconfig --add zabbix_agentd [root@bogon zabbix-3.2.4]# chkconfig zabbix_agentd on [root@bogon zabbix-3.2.4]# chkconfig --list zabbix_agentd [root@bogon zabbix-3.2.4]# useradd zabbix 更改如下三项 [root@bogon zabbix-3.2.4]# vim /usr/local/etc/zabbix_agentd.conf Server=192.168.1.104 ServerActive=192.168.1.104 Hostname=Linux ←需要和下文Web中添加的主机名一致 [root@bogon ~]# systemctl start zabbix_agentd.service Web端配置 通过浏览器访问"http://192.168.0.104/zabbix" 点击"next step"(如果出现红色选项需要在/etc/php.ini中将相应的值修改为与required相等) 输入数据库名、用户名以及密码 输入主机名 确认信息是否正确 zabbix对网页目录权限不足,所以需要我们手动下载配置文件,并放到网页中提示的位置(1、点击Download the configuration file。 2、将该文件存放到"/var/www/html/zabbix/conf/zabbix.conf.php") 刷新网页发现已经找到该配置文件 默认用户名"Admin"、密码"zabbix"Go to the zabbix home page and find that the zabbix service has not been started, but the status discovery service has been started by checking the status of the service through shell
[root@bogon ~] # systemctl status zabbix_server.service
● zabbix_server.service-SYSV: Starts and stops Zabbix Server using chkconfig
Loaded: loaded (/ etc/rc.d/init.d/zabbix_server; bad; vendor preset: disabled)
Active: active (running) since three 2017-03-15 09:20:20 CST; 30min ago
This is due to the limitation of the selinux mechanism. Just turn off the selinux mechanism.
[root@bogon ~] # setenforce 0
Change SELINUX entry to disabled
[root@bogon ~] # vim / etc/sysconfig/selinux
SELINUX=disabled
Just refresh the page.
Click "configuration → Host groups" and click "create host group" in the upper right corner to create a new host group
Create the name of the new host group for the data, and select the template to be used (hosts added to the group will use to add the template by default)
2. Add a host
Click "configuration → hosts" and then click create host in the upper right corner to create a new host.
Enter the host name, select the host group, and fill in the IP address of the monitored host
Click templates and add the appropriate template
Waiting for the ZBX in the Availability to turn green means that it can communicate with the monitored host normally.
Click "Monitoring → graphs to select the host in the upper right corner to view the data of the monitored host."
Add network card to monitor project
Go to "configuration → templates → Select the template → itmes that needs to add network card monitoring" this time the author chooses Template OS Linux template to add network card monitoring
To add network card monitoring, you need to add two Item (because the network card traffic is one in and one out)
Add In Direction item
1. Fill in the name of In direction in Name. "Incoming network traffic on Networkinterfacecard" is used in this experiment.
2. Select "Zabbix_agent" in type
3. Enter "Net_incoming" in key
4. Select "Numeric (float)" in Type of information
5. Units Select Bps
6. Others can be changed according to the figure below.
Add Out Direction item
1. Fill in the name of In direction in Name. "Net_Outgoing network traffic on Networkinterfacecard" is used in this experiment.
2. Select "Zabbix_agent" in type
3. Enter "Net_Outgoing" in key
4. Select "Numeric (float)" in Type of information
5. Units Select Bps
6. Others can be changed according to the figure below.
After adding item in the direction of In and Out, you need to go back to "configuration → templates → Select the template → graphs that needs to be monitored by network card".
Click "Create graph" in the upper right corner and add the two item you just added to items
View in "monitoring → graphs"
Add Windows Monitoring
Download the Zabbix Agent windows version of http://www.zabbix.com/download on the official website
Unzip the file and put it under disk c of windows
Edit conf/zabbix_agentd.win.conf (notepad++ editing is recommended)
Modify the following items: (similar to on linux)
Hostname=WindowsServer2008R2
ServerActive=192.168.1.104
Server=192.168.1.104
Open cmd and enter the following information (add zabbix_agent to the service)
C:\ bin\ win64\ zabbix_agentd.exe-c:\ conf\ zabbix_agentd.win.conf-I
Start the service
C:\ bin\ win64\ zabbix_agentd.exe-c:\ conf\ zabbix_agentd.win.conf-s
Use netstat-an | find "10050" to see if the port is enabled
You can also see it in the service console.
Add hosts to the Zabbix Server web interface
Enter "configuration → hosts" and click "create host" to enter the host name, host IP and other information.
Click templates to select the windows template
Add completed
Click "monitoring → graph" and select the windows host you just added in the upper right corner to view the image
3. Add email alarm
[root@bogon ~] # yum-y install mailx
Add the following lines
[root@bogon ~] # vim / etc/mail.rc
The email address where set from=1861097xxxx@163.com ← sent the mail
Set smtp=smtp.163.com
Set smtp-auth-user=1861097xxxx@163.com ← is the same as above, the email address from which the mail was sent
The author of set smtp-auth-password=lx3768150 ← uses 163e-mail and needs to log in using the authorization code.
Set smtp-auth=login
[root@bogon ~] # systemctl start mailx.service
Send mail test
[root@bogon ~] # echo "zabbix test" | mail-s "zabbix" 1247718627@qq.com
Write a send script
[root@bogon ~] # vim / usr/local/share/zabbix/alertscripts/sendmail.sh
#! / bin/sh
#
# echo "$3" | mail-s "$2" $1
Echo "$3" | sed sqqqa'\ rnsqqplash g | mail-s "$2" $1
[root@bogon ~] # chmod + x / usr/local/share/zabbix/alertscripts/sendmail.sh
Next, you need to configure the alarm in Web.
Open "Administrator → media type → create media type"
Open "Administrator → user", click admin, select "media" and click "add"
Click update to update
Close the Windows Server 2008 R2 mailbox to receive an alarm message
Summary of questions:
The image is garbled after changing zabbix to Chinese
Solution:
This problem is due to the fact that there is no Chinese font on the web side of zabbix, so we need to add the Chinese font most.
1. Select C:\ Windows\ Fonts\ Select a Chinese font such as "simplified characters". Right click to copy
Upload fonts to the zabbix library of "Zabbix Server"
Change the name of the file you just uploaded to lowercase
[root@bogon fonts] # mv SIMFANG.TTF simfang.ttf
Change the default "DejaVuSans" to the "simfang" you just uploaded in the following two lines
[root@bogon ~] # vim / var/www/html/zabbix/include/defines.inc.php
/ / define ('ZBX_FONT_NAME',' DejaVuSans')
Define ('ZBX_FONT_NAME',' simfang')
/ / define ('ZBX_GRAPH_FONT_NAME',' DejaVuSans')
Define ('ZBX_GRAPH_FONT_NAME',' simfang')
Refresh the web page
Related information:
Baidu knows zabbix
Zabbix Chinese garbled code
"Zabbix Monitoring depth practice"
The author has just started to use Zabbix recently, and I am not particularly familiar with it. If there are any mistakes or forgetting to write, please point out, thank you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.