Zabbix 3.4 configure monitoring items and monitor Linux and Windows clients

This blog is no longer so verbose. Please visit the previous blog about Zabbix's working principle and overview:
Centos 7 builds Zabbix 4.0 monitoring system

1, Installing Zabbix3.4

2, Visit the Web interface of zabbix

3, zabbix monitoring Linux client

4, Custom monitor

5, Custom monitoring graphics

6, Create template

7, ZABBIX agent passing parameters to add monitoring items

8, Zabbix monitoring Windows client

9, Backup template to local

1, Installing Zabbix3.4

To install the required image and software package, please visit the network disk: https://pan.baidu.com/s/1vHhbpPMyVidsHdCBED5JPQ
Extraction code: 5nof

1. Installing the Mariadb database

[root@centos01 ~]# Yum - y install MariaDB MariaDB server <! -- install MySQL server -- >
[root@centos01 ~]# Systemctl start MariaDB <! -- start MariaDB -- >
[root@centos01 ~]# Systemctl enable MariaDB <! -- set boot auto start -- >
[root@centos01 ~]# Mysqladmin - uroot password <! -- initialize MySQL login password -- >   

2. Install Zabbix dependencies

[root@centos01 ~]# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent 
                      <!--install Zabbix-->
[root@centos01 ~]# MySQL - uroot - ppwd @ 123 <! -- create the database used by Zabbix system -- >
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;   
<!--establish zabbix Database default character set utf8-->
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'pwd@123';     
<!--to grant authorization zabbix Log in locally to zabbix Database full control authority, create account zabbix password pwd@123-->
[root@centos01 ~]# Zcat / usr / share / Doc / zabbix server MySQL * / create.sql.gz | MySQL - uzabix - ppwd @ 123 zabbix <! -- import zabbix data to database -- >

3. Configure zabbix server

[root@centos01 ~]# CP / etc / ZABBIX / zabbix_server.conf / etc / ZABBIX / zabbix_server.conf.bak <! -- backup ZABBIX main configuration file -- >
[root@centos01 ~]# VIM / etc / ZABBIX / zabbix_server.conf <! -- edit ZABBIX main configuration file -- >
13 ListenPort=10051   <!--#zabbix server listening port number -- >
92 DBHost=localhost     <!--visit mysql use localhost-->
102 DBName=Zabbix     <!--Access database name zabbix-->
118 DBUser=Zabbix    <!--Access database authorized account zabbix-->
127 DBPassword=pwd@123  <!--Authorization password pwd@123-->
143 DBPort=3306  <!--mysql Port number of the database -->
[root@centos01 ~]# cp /etc/httpd/conf.d/zabbix.conf /etc/httpd/conf.d/zabbix.conf.bak 
                            <!--Backup profile-->
[root@centos01 ~]# VIM / etc / httpd / conf.d/zabbix.conf <! -- edit time zone configuration file -- >
 19         php_value date.timezone Asia/Shanghai    <!--Change time zone to Shanghai-->
[root@centos01 ~]# RZ <! -- upload Chinese package -- >
simkai.ttf
[root@centos01 ~]# CP simkai.ttf / usr / share / ZABBIX / fonts / <! -- copy to specified directory -- >
[root@centos01 ~]# VIM / usr / share / ZABBIX / include / definitions. Inc.php <! -- edit profile -- >
  47 define('ZBX_GRAPH_FONT_NAME',           'simkai'); // font file name  
                                           <!--Change the name to the name of the Chinese package just uploaded-->
[root@centos01 ~]# Systemctl start zabbix server zabbix agent httpd <! -- start zabbix Service -- >
[root@centos01 ~]# Systemctl enable ZABBIX server ZABBIX agent httpd <! -- set power on auto start -- >
[root@centos01 ~]# Netstat - anptu | grep 10051 <! -- monitoring server-side slogans 10051 port -- >
tcp        0      0 0.0.0.0:10051           0.0.0.0:*               LISTEN      2322/zabbix_server  
tcp6       0      0 :::10051                :::*                    LISTEN     

2, Visit the Web interface of zabbix

1)http://192.168.100.10/zabbix To access the zabbix front-end installation wizard, click Next step

2) Environment check interface, make sure all software is OK before continuing

3) In the database connection configuration interface, fill in the authorization information according to the zabbix database just created

4) Database connection configuration completed, fill in zabbix service information

5) Return to configuration summary information, default to next step

6) Installation complete

7) In the login interface, enter the default user name Admin and password zabbix to log in to the zabbix server

8) Set the interface language to Chinese

3, zabbix monitoring Linux client

1. Install ZABBIX agent

[root@centos02 ~]# Yum - y install zabbix agent <! -- install zabbix client -- >
[root@centos02 ~]# cp /etc/zabbix/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf.bak
<!--Backup master profile-->
[root@centos02 ~]# VIM / etc / ZABBIX / ZABBIX [agentd. Conf <! -- edit the main configuration file -- >
97 Server=192.168.100.10        <!--Zabbix The server IP address-->
138 ServerActive=192.168.100.10       <!--zabbix The server IP address-->
149 Hostname=192.168.100.20            <!--Monitored end IP address-->
[root@centos02 ~]# Systemctl start zabbix-agent.service <! -- start ZABBIX client -- >
[root@centos02 ~]# Systemctl enable zabbix-agent.service <! -- set automatic startup after power on -- >
[root@centos02 ~]# Netstat - anptu|grep 10050 <! -- listen to zabbix client port number -- >
tcp        0      0 0.0.0.0:10050           0.0.0.0:*               LISTEN      2196/zabbix_agentd
tcp6       0      0 :::10050                :::*                    LISTEN      2196/zabbix_agentd

2. Create host

3. Add client IP address

4, Custom monitor

1. CPU usage

1) Add monitoring items for 100.20 clients

2) To add CPU utilization monitoring items, please refer to the official document of zabbix

https://www.zabbix.com/documentation/3.4/zh/manual/config/items/itemtypes/zabbix_agent
Name: CPU utilization
Type: zabbix client
Key value: system.cpu.util [,,]
Information type: floating point
Unit: [
New application set: CPU

3) Refresh the latest data, monitor the data and continue the configuration

2. CPU idle rate

1) Add CPU idle rate monitoring item

Name: CPU idle rate
Type: zabbix client
Key value: system.cpu.util[,idle,]
Information type: floating point
Unit: [
Application set: CPU

2) Monitoring the latest data

3. Memory usage

1) Create memory usage monitor

Name: Memory usage
Type: zabbix client
Key value: VM. Memory. Size [pushed]
Information type: floating point
Unit: [
New application set: Memory

2) Monitoring the latest data

4. Memory free

1) Add free memory monitor

Name: Memory free
Type: zabbix client
Key value: vm.memory.size[free]
Information type: number (no plus or minus)
Unit: B
Application set: Memory

2) Monitoring the latest data

5. Memory total memory

1) Add total memory monitor entry

Name: total Memory
Type: zabbix client
Key value: vm.memory.size[total]
Information type: number (no plus or minus)
Unit: B
Application set: Memory

2) Monitoring the latest data

6. Memory free rate

1) Add memory free rate monitoring item

*Name: Memory idle rate
Type: computable
Key value: vm.memory.size[freepercent]
Formula: 100(last("vm.memory.size[free]")/last("vm.memory.size[total]"))
Information type: number (no plus or minus)
Unit: [
Application set: Memory**

2) Monitoring the latest data

7. Root partition usage

1) Add root partition usage monitoring item

Name: Root partition usage
Type: zabbix client
Key value: VFS. FS. Size [/, pushed]
Information type: floating point
Unit: [
New application set: Disk

2) Monitoring the latest data

8. Root partition free rate

1) Add Root partition idle rate monitoring item

Name: Root partition free rate
Type: zabbix client
Key value: vfs.fs.size[/,pfree]
Information type: floating point
Unit: [
Application set: Disk

2) Monitoring the latest data

9. Ens32 network card entry traffic

1) Add network card entry traffic monitoring item

Name: ens32 inlet flow
Type: zabbix client
Key value: net.if.in[ens32]
Information type: number (no plus or minus)
Unit: bps
New application set: Network

2) Configuration process

3) Monitoring the latest data

10. Ens32 network card outlet flow

1) Add ens32 network card outlet flow monitoring item

Name: ens32 outlet flow
Type: zabbix client
Key value: net.if.out[ens32]
Information type: number (no plus or minus)
Unit: bps
Application set: Network

2) Modification process

3) Monitoring the latest data

5, Custom monitoring graphics

1. CPU monitoring graph

1) Custom CPU monitoring graphics

2) View CPU monitoring graph

2. Memory monitoring graph

1) Custom Memory monitoring graphics

2) View Memory monitoring graph

3. Disk monitoring graphics

1) Custom zone monitoring graphics

2) View Disk monitoring graphics

4. Network monitoring graphics

1) Custom Network monitoring graphics

2) View Network monitoring graphics

5. Create aggregate graphics

1) Create aggregate graphics

2) Edit aggregate drawing name

3) Edit aggregate drawing

4) Edit complete view aggregate graph

6, Create template

1. Create a new template

1) Create template

2) Edit template name, add group

3) Click configuration → host → 192.168.100.20 → monitoring items, then select all monitoring items and click Copy

4) Copy monitoring items to the newly created template

5) Copy drawing to new template

6) Select Copy to Linux template

7) So far, there are 10 monitoring items and 4 graphs in the template

2. Host add new template

1) Create host

2) New host adds the Linux template just created

3) Refresh many times, wait for a moment

4) View by monitoring graphics

7, ZABBIX agent passing parameters to add monitoring items

1. Monitoring the number of client login users

1) Count the number of client login users

[root@centos02 ~]# who
root     pts/0        2020-05-08 18:08 (192.168.100.252)
root     pts/1        2020-05-08 21:53 (192.168.100.252)
[root@centos02 ~]# who |wc -l
2

2) Modify client profile

[root@centos02 ~]# vim /etc/zabbix/zabbix_agentd.conf
296 UserParameter=login_user,who | wc -l

3) Restart zabbix client

[root@centos02 ~]# !sys
systemctl restart zabbix-agent.service

4) zabbix service needs to install zabbix get

[root@centos01 ~]# cd /etc/yum.repos.d/
[root@centos01 yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirro                                                  rs.aliyun.com/repo/Centos-7.repo
[root@centos01 yum.repos.d]# rpm -Uvh https://repo.zabbix.com/zabbix/3.0/rhel/7/x86_                                                  64/zabbix-release-3.0-1.el7.noarch.rpm
[root@centos01 ~]# yum -y install zabbix-get

5) zabbix server test

[root@centos01 ~]# zabbix_get -s 192.168.100.20 -p 10050 -k 'login_user'
2

6) zabbix server adds monitoring items for 100.20 host and monitors the number of login users of client system

7) Monitoring the latest data

2. Monitoring client free memory

1) View client free memory

[root@centos02 ~]# cat /proc/meminfo |grep MemFree
MemFree:          471760 kB

2) Filter through awk

[root@centos02 ~]# cat /proc/meminfo |grep MemFree | awk '{print $2}'
471516

3) Modify the client zabbix configuration file

[root@centos02 ~]# vim /etc/zabbix/zabbix_agentd.conf
297 UserParameter=MemFree,/usr/bin/cat /proc/meminfo |grep MemFree | awk '{print $2}'

4) Or use parameters to implement

[root@centos02 ~]# vim /etc/zabbix/zabbix_agentd.conf
297 UserParameter=MemFree,/usr/bin/cat /proc/meminfo |grep MemFree | awk '{print $2    }'
298 UserParameter=Memory[*],/usr/bin/cat /proc/meminfo |grep $1 | awk '{print $$2}'

5) Restart zabbix client

[root@centos02 ~]# !sys
systemctl restart zabbix-agent.service

6) zabbix server authentication

[root@centos01 ~]# zabbix_get -s 192.168.100.20 -p 10050 -k 'MemFree'
471432
//perhaps
[root@centos01 ~]# zabbix_get -s 192.168.100.20 -p 10050 -k 'Memory[MemFree]'
470612

7) zabbix server adds monitoring items for 100.20

Key value: MemFree or Memory[MemFree]

8) Monitoring the latest data

8, Zabbix monitoring Windows client

1. Configure Windows client

1) Client set IP address

2) Upload the ZABBIX? Agents? 3.2.0.win folder to the C disk of the Windows client

3) Cut out the configuration files in the conf directory, then copy the corresponding configuration files according to the bin directory of the 32-bit or 64 bit operating system area of the client, and then delete the conf and bin directories

4) Modify the monitoring configuration file ZABBIX? Agent.win

Server=192.168.100.10       #zabbix server
ServerActive=192.168.100.10 #zabbix server
Hostname=192.168.100.30     #Client IP address

5) Configure loading and running zabbix configuration files

2. Configure Zabbix monitoring Windows client

1) Zabbix creates a new host and sets agent agent interface IP as client IP

2) New add host create template

3) Monitoring graphic interface to check whether it is under monitoring

9, Backup template to local

1) Select the template to back up and click export

2) View locally

3) zabbix server deletes the template and uploads the local template

4) Browse the backup to local template path and click Import

5) Verify import succeeded

————————Thank you for reading————————

Tags: Zabbix Database network MySQL

Posted on Mon, 11 May 2020 00:12:14 -0700 by The.Pr0fess0r