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

Simple entry-level application of Zabbix

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

Share

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

Zabbix:

Is a WEB-based interface to provide distributed system monitoring and network monitoring functions of the enterprise-level open source solution, a very powerful tool. Generally speaking, zabbix chooses mysql to store data, so when more and more hosts are monitored by zabbix, the amount of data will become larger and larger, which makes mysql become a bottleneck.

Version of zabbix:

Long-term maintenance versions are 2.2 and 3.0, and 2.0 and 2.4

Functions of zabbix:

1. Data acquisition: according to the built-in key of zabbix, you can also use custom UserParameter

2. Real-time drawing: display the collected results by graph and screen

3. Alarm: alarm when the value of the defined trigger is exceeded. It can be notified by email, SMS, QQ or Wechat.

4. Data storage: the collected data is stored in the database

5. Support the use of modules:

6. Automatic network discovery: as long as the ip and port are defined on the host, zabbix automatically adds monitoring through the scanning mechanism

7. Distributed monitoring: you can collect information from the host in the area through the agent, and then send it to zabbix to ease the pressure on zabbix.

The composition of zabbix program:

Zabbix_server: server daemon, listening port is 10050

Zabbix_agentd: daemon on agent. The listening port is 10051.

Zabbix_proxy: proxy server, optional component

Zabbix_get: command line tool, manual test data acquisition

Zabbix_sender: a command line tool that runs on the agent side and manually sends data to the server side

Zabbix_java_gateway: java gateway, which is only used to monitor jvm virtual machines

1. Install zabbix. Take 3.0 as an example:

~] # yum-y install zabbix-server-mysql zabbix-web zabbix-web-mysql zabbix-get mariadb-server

Edit the configuration file: / etc/zabbix/zabbix_server.conf:

ListenPort=10051 / / listening port SourceIP= / / server IP LogType=file / / log format Self-independent format (file), System (system record) LogFile=/var/log/zabbix/zabbix_server.log / / log file LogFileSize=0 | 1 / / whether the log needs to be scrolled PidFile=/var/run/zabbix/zabbix_server.pid DBHost=localhost / / database server address DBName=zabbix / / database name DBUser=zabbix / / login database name DBPassword=zabbix / / database password DBSocket=/var/lib/mysql/ Mysql.sock / / indicates the sock path to the database

Edit the zabbix-web file:

Vim / etc/httpd/conf.d/zabbix.conf

Php_value date.timezone Asia/Shanghai / / modify time zone

Edit the php.ini file:

Vim / etc/php.ini [Date]; Defines the default timezone used by the date functions; http://php.net/date.timezonedate.timezone = Asia/Shanghai / / modify the time zone

Authorize zabbix to log in to the database and create a database stored by zabbix:

> grant all on zabbix.* to 'zabbix'@'localhost' identified by' zabbix'; > create database zabbix charset 'utf8'

Initialization of zabbix_server database:

~] # cd / usr/share/doc/zabbix-server-mysql-3.0.2/~] # gzip-d create.sql.gz~] # mysql- uzabbix-h227.0.0.1-p zabbix N 1 zabbix@localhost.loc Fri May 20 19:37 23amp 1047 "PROBLEM: zabbix.node.port" & 1Message 1:

5. Multiple monitoring items can be integrated into one graph, such as monitoring network card traffic:

Define the ingress and egress traffic of the network card. Click Graphs in the node1 host in Hosts to create an image.

View the graphical interface after adding:

If multiple hosts monitor the traffic, you can aggregate it on one page for easy viewing:

4. Configure the template and allow the CVM to apply the template directly instead of adding monitoring items one by one:

You can directly use the template that comes with the system, or you can customize a template:

After generating a template, you only need to add various monitoring items, triggers, and application sets, and then apply them directly to the host:

Configuration macro definition (macro, default text replacement mode)

Two kinds:

No additional $is required for the built-in {MACRO} call

Custom {$MACRO} calls and definitions need to be added $

Level:

Overall situation

Template

Mainframe

Priority: host-> template-- > global

Define the port global macro:

Define a template macro:

Define a host macro:

Directly modify the value of node1's listening port:

Check to see if it works:

Six: configure key

Key is also divided into built-in and customized. Sometimes the key that is not available in the system can only be defined by itself. The custom key is implemented on the agent side:

Syntax format:

UserParameter=

~] # vim / etc/zabbix/zabbix_agentd.confUserParameter=menory.info,awk'/ ^ MemFree/ {print $2}'/ proc/meminfo UserParameter=memory.usage [*], awk'/ ^ $1 / {print $$2}'/ proc/meminfo / / pass parameters

Restart the zabbix-agent service:

~] # service zabbix-agent restart~] # zabbix_get-s 172.18.250.75-p 10050-k "memory.info" / / Test 693772 on zabbix-server ~] # zabbix_get-s 172.18.250.75-p 10050-k "memory.usage [MemTotal]" 1012352

Test whether key can be applied on the host:

7: configure distributed monitoring of zabbix:

When there are too many hosts monitored by zabbix-server, each item needs the server side to establish the tcp connection, so the server can not handle it, so you can set up the item connection according to the distributed agent, then collect the data and send it to the server side.

~] # yum-y install zabbix-proxy-mysql mariadb-server

Authorize zabbix to log in to the database and create a database stored by proxy:

> grant all on proxy.* to 'proxy'@'localhost' identified by' proxy'; > create database proy charset 'utf8'

Initialization of zabbix_server database:

~] # cd / usr/share/doc/zabbix-proxy-mysql-3.0.2/~] # gzip-d scheam.sql.gz~] # mysql- uproxy-h227.0.0.1-p proxy grant all on zabbix.* to 'zabbix'@'localhost' identified by' zabbix'; > create database zabbix charset 'utf8'

Initialization of zabbix_server database:

~] # cd / usr/share/doc/zabbix-server-mysql-3.0.2/~] # gzip-d create.sql.gz~] # mysql- uzabbix-h227.0.0.1-p zabbix

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