当前位置:网站首页>ZABBIX foundation details

ZABBIX foundation details

2022-06-25 21:05:00 Zhuge iron and steel cloud

Zabbix It is an enterprise level distributed open source monitoring scheme .

Zabbix It is a software that can monitor various network parameters and server health and integrity .Zabbix Use flexible notification mechanisms , Allows users to configure mail based alerts for almost any event . In this way, we can quickly feed back the problems of the server .
Zabbix Support active polling and passive capture .Zabbix All reports 、 Both statistics and configuration parameters can be obtained by Web Access the front page of . be based on Web The front-end page ensures that you can evaluate your network status and server health from any aspect .

zabbix Components
Zabbix server As a whole Zabbix The core program of software .
Server By polling and capturing data , Calculate whether the trigger condition is met , Send notification to users . yes agent Program reports system availability 、 Core components of system integrity and Statistics , It's all configuration information 、 Core memory for statistics and operational data .

Database storage : All configuration information and Zabbix The collected data is stored in the database ;

web Interface : For easy access from anywhere and on any platform Zabbix, Offer based on Web Of Zabbix Interface . The interface is Zabbix Server Part of , Usually ( But not necessarily ) Follow Zabbix Server Running on the same physical machine .

Zabbix proxy: Can replace Zabbix Server Collect performance and availability data .

Proxy proxy server : yes Zabbix Software can be selected as part of the deployment , It can also help a single Zabbix Server Share the load pressure .

Zabbix agents Monitoring agent : Deployed on monitoring targets , Ability to proactively monitor local resources and Applications , And report the collected data to Zabbix Server.

zabbix A common term for
host( host ): A network device that you want to monitor , use ip And domain name means .
host group ( Host group ): Logical group of hosts ; It contains hosts and templates . There is no direct association between hosts and templates in a host group . Host groups are usually used when assigning permissions to hosts of different user groups .
item( Monitoring item ): Host specific data received , A metric data .
trigger( trigger ): One is used to define problem thresholds and “ assessment ” The logical expression of the data received by the monitoring item ; When the received data is above the threshold , Trigger from “OK” become “Problem” state . When the received data is below the threshold , The trigger is reserved / Return to one “OK” The state of .
event( event ): Things that need to be noticed in a single occurrence , For example, trigger state changes or monitoring agent is found to register automatically .
problem( abnormal ): One is in “ abnormal ” State triggers .
action( action ): A predefined action to respond to an event . An action is operated by ( For example, give notice ) And conditions ( The operation was taking place ) form .
escalation( upgrade ): A custom scenario that performs operations within an action ; Sending notice / A sequence of remote command execution .
media( medium ): Means of sending alarm notification ; The way of warning notification .
notification( notice ): Use the selected media channel to send the information related to the event to the user .
remote command( Remote command ): A predefined , When some conditions are met , Commands that can be automatically executed on the monitored host .
template( Templates ): A set of entities that can be applied to one or more hosts ( Monitoring item , trigger , graphics , Aggregate graphics , application ,LLD,Web scene ) Set ; The task of the template is to speed up the implementation of host monitoring tasks ; It can also make batch modification of monitoring tasks easier . Templates are directly related to each individual host .
application( application ): A logical grouping of monitored items .
web scenario(web scene ): Use one or more HTTP Request to check the usability of the site .
frontend( front end ): Zabbix Provided web Interface .
zabbix API: Zabbix API Allow you to use JSON RPC Protocol to create 、 Update and get Zabbix object ( Such as mainframe 、 Monitoring item 、 Graphics and other ) Information or perform any other custom tasks .
zabbix server: Zabbix The core program of software monitoring , The main function is to communicate with Zabbix proxies and Agents Interact 、 Trigger calculation 、 Send alert notification ; And save the data in a centralized way .
zabbix agent: One deployed on the monitoring object , Programs that can actively monitor local resources and Applications .
zabbix proxy: A help Zabbix Server collecting data , Share responsibility Zabbix Server The load of the program .

zabbix working principle

zabbix-server,mysql database ,zabbix-web gui It can be installed on different servers ,zabbix-server Read the configuration file at startup
zabbix_server.conf To run the zabbix-server Service and output the log to zabbix-server.log file ;zabbix-serevr Obtain data through active mode or passive mode ,zabbix-agent The configuration file will be read when the server starts zabbix-agent.conf Output log to configuration file zabbix-agent.log;zabbix-server Service pass zabbix-web gui Extract data from the database, draw graphics and display them in the browser ;

zabbix Data collection can be divided into active and passive modes :

Passive mode :zabbix-server Active service request zabbix-agent service ,zabbix-service adopt zabbix-get How to get zabbix-agent End data ;

Active mode :zabbix-agent Take the initiative to pass the collected data regularly zabbix-sender The process sends data to zabbix-server Services and stored in a local database ;

zabbix Installation method
zabbix The official source code library installation method

Official source library address :http://repo.zabbix.com/

1. Install the source library configuration deployment package . Contains yum The configuration file :

[[email protected] ~]# cat /etc/redhat-release 
CentOS Linux release 7.5.1804 (Core)
[[email protected] ~]# wget http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
[[email protected] ~]# rpm -ivh zabbix-release-3.4-1.el7.centos.noarch.rpm
1
2
3
4
2. Install deployment package :

[[email protected] ~]# yum install zabbix-server-mysql zabbix-web-mysql
1
3. Install initialization database :

stay MySQL Installation on Zabbix Databases and users :
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix.* to [email protected] identified by 'zabbix';
Initial architecture (Schema) And data
[[email protected] ~]# cd /usr/share/doc/zabbix-server-mysql-3.4.14/
[[email protected] zabbix-server-mysql-3.4.14]# zcat create.sql.gz | mysql -uroot -predhat zabbix
1
2
3
4
5
6
4. start-up Zabbix Server process
zabbix-server The default open port is 10051

stay zabbix_server.conf Edit database configuration in
[[email protected] ~]# vim /etc/zabbix/zabbix_server.conf
91 DBHost=localhost
101 DBName=zabbix
117 DBUser=zabbix
127 DBPassword=zabbix
[[email protected] ~]# systemctl start zabbix-server
[[email protected] ~]# systemctl enable zabbix-server
[[email protected] ~]# ps -aux | grep zabbix-server
root       1879  0.0  0.0 112704   976 pts/2    R+   20:57   0:00 grep --color=auto zabbix-server
1
2
3
4
5
6
7
8
9
10
5. edit Zabbix Front-end PHP To configure

[[email protected] ~]# vim /etc/httpd/conf.d/zabbix.conf 
<IfModule mod_php5.c>
        php_value max_execution_time 300
        php_value memory_limit 128M
        php_value post_max_size 16M
        php_value upload_max_filesize 2M
        php_value max_input_time 300
        php_value max_input_vars 10000
        php_value always_populate_raw_post_data -1
        php_value date.timezone Asia/Shanghai
    </IfModule>
    Reboot after configuration modification httpd service :
   [[email protected] ~]# systemctl restart httpd
1
2
3
4
5
6
7
8
9
10
11
12
13
6. Enter the browser to access :http:// host ip/zabbix
Default user name / The password for Admin/zabbix;
Click to go to the next step to check whether there is any error ; Report errors and solve them
Enter the user name and password of the database , The database to be used and the port number to be added , Default here
Please enter Zabbix The host name or host of the server IP Address and port number , And the name of the installation ( Optional ).
Enter the user name and password to enter the page


zabbix Use
1 . take zabbix Set to Chinese
Click the villain in the upper right corner
Set the language to Chinese

2 . Create a new monitoring host
zabbix-agent Default open port 10050

[[email protected] ~]# rpm -ivh zabbix-release-3.4-1.el7.centos.noarch.rpm
[[email protected] ~]# yum install -y zabbix-agent
[[email protected] ~]# vim /etc/zabbix/zabbix_agentd.conf
 97 Server=192.168.88.177   # add to zabbix-server The host ip
138 ServerActive=192.168.88.177   # add to zabbix-server The host ip
149 Hostname=server176  # add to zabbix-agent The host name ·
[[email protected] ~]# systemctl start zabbix-agent
[[email protected] ~]# systemctl enable zabbix-agent
1
2
3
4
5
6
7
8
To configure (Configuration)— host (Hosts) menu , Click Create host (Create host) To add a new host
Fill in the host name , Visible host name , Add groups , Set up agent agent , Add to complete . The newly created monitoring host can be seen in the host ;

zabbix_agent.conf File configuration details

# PidFile=/var/run/zabbix/zabbix_agentd.pid
PID file name

# LogType=file 
Log file path ; If not configured , The log will record syslog in ; Default configuration path :LogFile=/var/log/zabbix/zabbix_agentd.log

# LogFileSize=0
0 - Turn off auto roll . Log file size , Unit is MB

# DebugLevel=3
Specify the log level
0 - Zabbix Basic information about process start and stop
1 - critical Level
2 - error Level
3 - warnings Level
4 - debug Level
5 - extended debugging ( With the level of 4 equally . Only use runtime control To set up .)

# SourceIP=
The source of the output connection IP Address

# EnableRemoteCommands=0
Whether to run zabbix server Execute remote commands on this server ;0 To prohibit ;1 Is allowed

# LogRemoteCommands=0
Record the execution of the prototype shell Command log , The level of warrning;0 To prohibit ;1 Is allowed

# Server=192.168.88.177
zabbix server Of ip Address , Multiple ip Separated by commas

# ListenPort=10050
Listening port , The default is 10050

# ListenIP=0.0.0.0
monitor IP Address , Default to all interfaces , Multiple ip Separated by commas

# StartAgents=3
For handling passive checks zabbix_agentd The default number of listeners . If set to 0, Passive checking will be disabled , The agent will not listen for any TCP port .

# ServerActive=192.168.88.177
zabbix Active monitoring server Of ip Address , Use commas to separate many IP, If you annotate this option , Then the active monitoring of the current server is disabled

# Hostname=server176
Host name , Must be unique , Case sensitive .Hostname It has to be with zabbix web It's always been configured on , otherwise zabbix Active monitoring doesn't work properly .

# HostnameItem=system.hostname
Set host name , Only when HostMetadata It takes effect only when it is not set .

# HostMetadata=
Only for host auto registration function , If the current value is defined , So its default value is HostMetadataItem Value

# HostMetadataItem=
The function is the same as above , If HostMetadata Value not set , This configuration works .

# RefreshActiveChecks=120
How long does it take? ( second ) Refresh the active monitoring configuration information once , If the refresh fails , that 60 I'll try again in seconds ;

# BufferSend=5
Value range :1-3600; The data is stored in buffer How many seconds is the longest in the game

# BufferSize=100
Value range :2-65535;buffer Maximum , If buffer Full of ,zabbix The retrieved data will be sent to zabbix server perhaps proxy

# MaxLinesPerSecond=20
Alias:key Another name for

# Timeout=3
Timeout time

# AllowRoot=0
Is it allowed to use root Identity running zabbix, If the value is 0, And in root In the environment ,zabbix Will try to use zabbix User run , If it doesn't exist, it will tell zabbix The user doesn't exist .
0 - Don't allow
1 - allow

# User=zabbix
function zabbix Users of the program , If AllowRoot Disabled , It works

# Include=/etc/zabbix/zabbix_agentd.d/*.conf
Contains self configuration files , Different configurations are written to different files , then include, The configuration file will appear standard .

# UnsafeUserParameters=0
All user-defined parameters that are allowed to pass .

# UserParameter=
User customization key,

# LoadModule=
Load module file , Can write multiple ; You have to configure LoadModulePath, Specify the module Directory ;

# LoadModulePath=${libdir}/modules
The module path , Absolute path ,

# TLSConnect=unencrypted
How the proxy should connect to the server or proxy . For active inspection . Only one value can be specified :
unencrypted - No encrypted connection (unencrypted)
Use TLS And pre shared key connection (psk)
Use TLS Connect with certificate (cert)

# TLSAccept=unencrypted
# TLSCAFile=
# TLSCRLFile=
# TLSServerCertIssuer=
# TLSServerCertSubject=
# TLSCertFile=
# TLSKeyFile=
# TLSPSKIdentity=
# TLSPSKFile=

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
3 . Add monitoring items for the monitoring host

To configure — host ---- New host ---- Monitoring item ---- Create a new monitor item

Monitoring item key value
Monitoring item key The format of , Include key parameters , Grammar rules must be followed . To build an effective monitor Key, First specify Key The name of , Then choose whether to have parameters , If both are satisfied, it is executed .

key Parameters
key Parameters can be used , Number to separate multiple parameters ; It can be quoted 、 An unquoted string or array ; If key Parameters are quoted , Any Unicode character , If it contains double quotation marks, it needs to be escaped by backslash ; If key The parameter is an unquoted string , Except for commas and right square brackets (]) outside , Allow any Unicode character ; If key The argument is an array , It needs to be enclosed in square brackets , Each parameter must conform to the rules and syntax of multiple parameters .

Custom interval

You can create custom time rules about the selected monitoring items . Allows you to redefine the default update interval and schedule , Thus, the inspection of monitored items can be performed at a specific time or in a specific order .
One is flexible interval and period :
interval – Specify the update interval for the time period ; cycle , period – Flexible intervals, effective time periods ;
If the flexible interval is set to “0”, Do not poll monitoring items during flexible intervals , That is, no inspection is performed within the defined time period
One is the scheduling interval
The scheduling interval is used to check the monitoring items at a specific time . Although the flexible interval is designed to redefine the update interval of the default monitoring items , However, the scheduling interval is used to specify the inspection plan to be executed independently .

Flexible intervals and periods :
Scheduling interval : Format and examples


zabbix User forgot password
Enter the database to view zabbix Database user Table change user password

[[email protected] zabbix]# mysql -uroot -p
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
| zabbix             |
+--------------------+
5 rows in set (0.01 sec)

MariaDB [(none)]> use zabbix;

MariaDB [zabbix]> select * from users;
+--------+-------+--------+---------------+----------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+------------+---------------+---------------+
| userid | alias | name   | surname       | passwd                           | url | autologin | autologout | lang  | refresh | type | theme   | attempt_failed | attempt_ip | attempt_clock | rows_per_page |
+--------+-------+--------+---------------+----------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+------------+---------------+---------------+
|      1 | Admin | Zabbix | Administrator | 5fce1b3e34b520afeffb37ce08c7cd66 |     |         1 | 0          | zh_CN | 30s     |    3 | default |              0 |            |             0 |            50 |
|      2 | guest |        |               | d41d8cd98f00b204e9800998ecf8427e |     |         0 | 15m        | en_GB | 30s     |    1 | default |              0 |            |             0 |            50 |
+--------+-------+--------+---------------+----------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+------------+---------------+---------------+
2 rows in set (0.00 sec)
## Password usage md5 To encrypt , Therefore, you need to encrypt your own password when changing your password :
[[email protected] ~]# echo -n redhat | openssl md5
(stdin)= e2798af12a7a0f4f70b4d69efbc25f4d
MariaDB [zabbix]> update users set passwd="e2798af12a7a0f4f70b4d69efbc25f4d" where userid="1";
MariaDB [zabbix]> select * from users;
+--------+-------+--------+---------------+----------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+------------+---------------+---------------+
| userid | alias | name   | surname       | passwd                           | url | autologin | autologout | lang  | refresh | type | theme   | attempt_failed | attempt_ip | attempt_clock | rows_per_page |
+--------+-------+--------+---------------+----------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+------------+---------------+---------------+
|      1 | Admin | Zabbix | Administrator | e2798af12a7a0f4f70b4d69efbc25f4d |     |         1 | 0          | zh_CN | 30s     |    3 | default |              0 |            |             0 |            50 |
|      2 | guest |        |               | d41d8cd98f00b204e9800998ecf8427e |     |         0 | 15m        | en_GB | 30s     |    1 | default |              0 |            |             0 |            50 |
+--------+-------+--------+---------------+----------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+------------+---------------+---------------+
2 rows in set (0.00 sec)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Zabbix discoverer processes more than 75% busy
zabbix The following alarms appear during use :

Cause of occurrence
Each configured discovery The task takes up a certain amount of time 1 individual discovery process , and zabbix_server.conf The default configuration in is only 1 individual discovery( Annotated , Default effective );
At the same time, in order to quickly verify the automatic discovery effect , take discovery Mission "Delay" The time is set by default 3600s Set to 60s.
summary : There are two reasons for the average time discovery processes Alarm due to high temperature .

The solutions are as follows : Change the discovery process of the profile to multiple , It's usually 0-250 individual ;

[[email protected] ~]# vim /etc/zabbix/zabbix_server.conf 
StartDiscoverers=3
[[email protected] ~]# systemctl restart zabbix-server
1
2
3

————————————————
Copyright notice : This paper is about CSDN Blogger 「 Give yourself a wish 」 The original article of , follow CC 4.0 BY-SA Copyright agreement , For reprint, please attach the original source link and this statement .
Link to the original text :https://blog.csdn.net/weixin_39249306/article/details/82966325

原网站

版权声明
本文为[Zhuge iron and steel cloud]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202181334257958.html