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

Practical Network Monitoring Zabbix (1)-- remote Monitoring Host Service

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

Share

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

1. Brief introduction to Zabbix

Zabbix is a highly integrated network monitoring solution, which can provide enterprise-level open source distributed monitoring solution. A foreign team continuously maintains updates, the software can be downloaded and used freely, and the operation team makes a profit by providing technical support for a fee.

Official website: http://www.zabbix.com

1.1 zabbix mode

Zabbix collects data through the Cramp S mode, and displays and configures it on the web side through the Bamp S mode.

Monitored side: the host collects data by installing agent, and the network equipment collects data by SNMP.

Server side: collect the data sent by SNMP and agent, write it to the database (MySQL,ORACLE, etc.), and then display it in the front end of web through php+apache.

1.2 Zabbix operating conditions:

Server:Zabbix Server requires the operator to be in the LAMP (Linux+Apache+Mysql+PHP) ring (or LNMP) with low hardware requirements.

Agent: existing agent basically supports common OS in the market, including Linux, HPUX, Solaris, Sun and windows

SNMP: supports all kinds of common network devices

two。 Advantages and disadvantages

Advantages:

Open source, no software cost input

Server has low requirements for equipment performance.

Supports many devices and comes with a variety of monitoring templates

Support distributed centralized management, have automatic discovery function, and realize automatic monitoring.

Open interface, strong expansibility, easy to write plug-ins

When the monitored item is relatively large, the server queue can be passive. The monitored client actively downloads the item to be monitored from the server side and then takes the data to upload to the server side. This method puts less load on the server.

Api support for easy integration with other systems

Disadvantages:

Need to install agent on the monitored host, all the data are stored in the database, the resulting data is very large, the bottleneck is mainly in the database.

Experimental environment:

Physical host redhat7.0 kernel version 3.10.0-123.el7.x86_64

Virtual machine redhat6.5 kernel version 2.6.32-431.el6.x86_64

Server side: server1.example.com 172.25.254.1

Client: server2.example.com 172.25.254.2

Required software packages:

Zabbix-2.4.5-1.el6.x86_64.rpm

Zabbix-server-2.4.5-1.el6.x86_64.rpm

Zabbix-server-mysql-2.4.5-1.el6.x86_64.rpm

Zabbix-web-2.4.5-1.el6.noarch.rpm

Zabbix-web-mysql-2.4.5-1.el6.noarch.rpm

Zabbix-agent-2.4.5-1.el6.x86_64.rpm

Fping-2.4b2-16.el6.x86_64.rpm

Iksemel-1.4-2.el6.x86_64.rpm

Iksemel-utils-1.4-2.el6.x86_64.rpm

Php-mbstring-5.3.3-26.el6.x86_64.rpm

Php-bcmath-5.3.3-26.el6.x86_64.rpm

one。 Server-side configuration

Zabbix requires a lamp environment:

1. Install the required software packages for zabbix

Zabbix-2.4.5-1.el6.x86_64.rpm

Zabbix-server-2.4.5-1.el6.x86_64.rpm

Zabbix-server-mysql-2.4.5-1.el6.x86_64.rpm

Zabbix-web-2.4.5-1.el6.noarch.rpm

Zabbix-web-mysql-2.4.5-1.el6.noarch.rpm

Zabbix-agent-2.4.5-1.el6.x86_64.rpm

Fping-2.4b2-16.el6.x86_64.rpm

Iksemel-1.4-2.el6.x86_64.rpm

Iksemel-utils-1.4-2.el6.x86_64.rpm

Php-mbstring-5.3.3-26.el6.x86_64.rpm

Php-bcmath-5.3.3-26.el6.x86_64.rpm

two。 Configure the mysql database

# service mysqld start

# mysql

Mysql > create database zabbix character set utf8 collate utf8_bin

Mysql > grant all privileges on zabbix.* to zabbix@localhost identified by 'willis'

Mysql > quit

# cd / usr/share/doc/zabbix-server-mysql-2.4.5/create

# mysql-uzabbix-pwestos zabbix

< schema.sql ## stop here if you are creating database for Zabbix proxy ## # mysql -uzabbix -pwestos zabbix < p_w_picpaths.sql # mysql -uzabbix -pwestos zabbix < data.sql 3. 配置 zabbix server [root@server1 create]# vim /etc/zabbix/zabbix_server.conf 72 DBHost=localhost 82 DBName=zabbix 106 DBPassword=willis 163 StartTrappers=10 4. 配置 php [root@server1 conf.d]# vim /etc/php.ini 946 date.timezone = Asia/Shanghai [root@server1 conf.d]# pwd /etc/httpd/conf.d [root@server1 conf.d]# vim zabbix.conf 13 php_value max_execution_time 300 14 php_value memory_limit 128M 15 php_value post_max_size 16M 16 php_value upload_max_filesize 2M 17 php_value max_input_time 300 18 php_value date.timezone Asia/Shanghai 5. 启动 zabbix server、zabbix agent、httpd # service httpd start # service zabbix-server start # service zabbix-agent start 6. 登陆 zabbix web http://172.25.254.1/zabbix 按照提示完成安装并登陆: Username: Admin Password: zabbix 可以看到 Zabbix server is running 状态值为Yes.服务端部署完成。 二.被监控端配置(server2) 7. 添加 agent 主机 7.1在被监控端安装软件包: zabbix-2.4.5-1.el6.x86_64.rpm zabbix-agent-2.4.5-1.el6.x86_64.rpm 7.2配置 zabbix agent # vim /etc/zabbix/zabbix_agentd.conf 85 Server=172.25.254.1 126 ServerActive=172.25.254.1 137 Hostname=server2.example.com #主机名需要有解析 7.3启动 zabbix agent [root@server2 zabbix]# /etc/init.d/zabbix-agent restart 网页端配置: Configuration ->

Discovery

8. Activate zabbix agent auto-registration on zabbix server

Click Configuration-> Actions-> Auto registration-> Create action to set up as shown in the following figure:

Name of the custom Action.

The Conditions tab can be kept by default.

The Operations tab is added as follows:

Add host: auto-registered hosts are added to the hosts list

Add to host groups: automatically registered hosts join the linux servers group (group name can be customized)

Link to templates: auto-register host application template Template OS linux

Click Configuration-> Hosts to see the newly added hosts:

three。 Add http service monitoring

More features of Zabbix are worth studying and sharing.

Let's take a look at how zabbix adds service monitoring items, using the monitoring template that comes with zabbix, and take http service as an example:

Click Configuration-> Templates to select the template that needs to be linked

You can also select the template you want in Configuration-> Hosts-> server2.example.com-> Templates

In this way, the HTTP service appears in the monitoring item of the host server2.example.com

four。 Monitor remote host Mysql service

In the / etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf file, specify how zabbix agent gets all kinds of information about mysql services, and create a new ".my.cnf" file in the / var/lib/zabbix directory to specify how zabbix agent logs into the database. The default is the zabbix user, and the password can be found in the zabbix_server.conf file.

[root@server2 zabbix] # yum install mysql-server-y

[root@server2 zabbix] # / etc/init.d/mysqld start

[root@server2 zabbix] # mysql_secure_installation

# initialize the database. I changed the database password to willis

[root@server2 zabbix] # mkdir / var/lib/zabbix

[root@server2 zabbix] # cp / etc/my.cnf / var/lib/zabbix/.my.cnf

[root@server2 zabbix] # vim / var/lib/zabbix/.my.cnf

[mysql]

Host = localhost

User = zabbix

Password = willis

Socket = / var/lib/mysql/mysql.sock

[mysqladmin]

Host = localhost

User = zabbix

Password = willis

Socket = / var/lib/mysql/mysql.sock

The mysql service for monitoring remote hosts requires the creation and authorization of zabbix users, while native monitoring is not required.

Mysql > grant select on *. * to 'zabbix'@'localhost' identified by' willis'

[root@server2 zabbix] # mysql-uzabbix-pwillis

[root@server2 zabbix] # / etc/init.d/zabbix-agent restart

Shutting down Zabbix agent: [OK]

Starting Zabbix agent: [OK]

Link to the mysql monitoring template:

Click Configuration-> Hosts-> server2.example.com- > Graphs to see two new monitoring graphs.

You can see the graphic changes of the monitoring after a while.

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

Wechat

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

12
Report