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

Zabbix monitoring combined with Grafana drawing

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Zabbix monitoring combined with Grafana drawing

one。 Experimental topology diagram of the project (drawn by experts using hundreds of millions of maps)

two。 Experimental ideas and key contents of the project (steps and weight are difficult to know)

Know something)

Implementation steps:

Step description

The first step 1. Install the zabbix server server

Step 2. Configure the web page of the zabbix service and make simple optimizations

Step 3. Realize monitoring OS, mysql and httpd on the server.zabbix.com side

Step 4. Install and configure agent.zabbix.com monitored side (FTP server)

Step 5. Log in to the web interface of zabbix to add agent hosts to verify the monitoring effect

Step 6. Configure and monitor Win2k8dc1 hosts to verify the effect

Step 7. Customize monitoring items, create projects, triggers, graphics, and verify the monitoring effect

Step 8. 8. Realize email alarm

Step 9. 9. Install and configure Grafana

Step 10. Configure the web interface of Grafana to present the effect

Key points and difficulties:

Point 1. Introduction to Zabbix

Zabbix is an enterprise-level open source distributed monitoring solution, which is written in C language.

Architecture (server and agent), which is continuously maintained and updated by a foreign team, and the software is free to download.

For use, the operation team makes a profit by providing technical support for a fee.

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

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.

data

Server side: collect the data sent by SNMP and agent, write it to the MySQL database, and then use the

Php+apache is displayed at the front end of web.

Zabbix operating conditions:

Server:

Zabbix Server needs to run in LAMP (Linux+Apache+Mysql+PHP) environment, for hardware

Low requirements

Agent:

At present, the existing agent basically supports common OS in the market, including Linux, HPUX, Solaris, Sun,

Windows et al.

SNMP:

Support all kinds of common network equipment Zabbix functions

Have the functions of common commercial monitoring software (host performance monitoring, network equipment performance monitoring,

Database performance monitoring, FTP and other common protocols monitoring, multiple alarm methods, detailed report chart drawing)

Support automatic discovery of network devices and servers, support distributed, centralized display and management of distributed monitoring

Point, strong expansibility, server provides a general interface, you can develop and improve all kinds of monitoring.

Point two: 1. Advantages and disadvantages

Advantages:

Open source, no software cost input

Server requires low device performance (actual test environment: virtual machine Redhat EL AS5,2GCPU 1G

Memory, monitoring 5 devices, CPU utilization is basically kept below 10%, memory remaining is more than 400m)

Support for multiple Devic

Support for distributed centralized management

Open interface with strong expansibility

When the monitored item is more than one server queue is large, the passive state can be adopted, and the monitored client

Actively download the item to be monitored from the server side and then take the data and upload it to the server side. In this way

The load on the server is relatively small.

Disadvantages:

Without the support of the manufacturer, it is troublesome to solve the problems.

Agent needs to be installed on the monitored host. All the data is stored in the database, and the resulting data is very large.

The bottleneck is mainly in the database.

Focus 3. The monitoring principle of 1.zabbix:

Component description:

1) zabbix server: the core component responsible for receiving report information sent by agent, all configurations and statistics

The data and operation data are organized by it.

2) database storage: dedicated to storing all configuration information, as well as data collected by zabbix

3) GUI interface of web interface:zabbix

4) proxy: optional component, often used in a distributed environment with a large number of monitoring nodes, acting as a server collector

Forwarding the data to server can reduce the pressure on server.

5) agent: deployed on the monitored host, responsible for collecting host local data such as cpu, memory, and data

Database and other data are sent to server or proxy.

Monitoring process:

Agentd needs to be installed on the monitored host and is responsible for collecting data on a regular basis and sending it to the

On the zabbix server side, zabbix server stores the data in the database, and zabbix web stores the data first according to the data

The end carries on the display and drawing. Here, agentd collects data in two modes: active and passive:

Initiative: agent requests server to obtain a list of active monitoring items, and takes the initiative to detect the monitoring items.

Submit the data to server/proxy

Passive: server requests agent to obtain data of monitoring items, and agent returns data.

Client daemon:

This process collects client data, such as cpu load, memory, hard disk usage, and so on.

Zabbix_get

Zabbix tool, a separate command, usually executed on the server or proxy side to get a remote customer

The command of the end information. Usually the user troubleshoots. For example, if I can't get the memory data of the client on the server side, I

You can use zabbix_get to get the content of the client to do troubleshooting.

Zabbix_sender

The zabbix tool, used to send data to server or proxy, is usually used for time-consuming checks.

Many checks are time-consuming, causing zabbix to time out. So after the script has been executed, we use the

Sender actively submits data.

Zabbix_server

The zabbix server keeps the guard process. Zabbix_agentd 、 zabbix_get 、 zabbix_sender 、

The data of zabbix_proxy and zabbix_java_gateway are finally submitted to server.

Remarks: of course, not all data is actively submitted to zabbix_server, and some server takes the initiative to fetch data.

According to.

Zabbix_proxy

Zabbix proxy daemon. The function is similar to server, except that it is just a transit station.

The collected data needs to be submitted / submitted to server. Why use an agent? What does an agent do?

Donovan? As a matter of fact, please continue to follow the zabbix tutorial series of operation and maintenance survival time.

Zabbix_java_gateway

A feature introduced after zabbix2.0. As the name implies: Java gateway, similar to agentd, but only

Used in Java. What needs special attention is that it can only obtain data actively, not passively.

data. Its data will eventually be given to server or proxy.

Focus 4 extension: monitoring architecture of zabbix

In the actual monitoring architecture, zabbix is divided into three architectures according to network environment and monitoring scale:

There are three kinds of server-client, master-node-client and server-proxy-client.

1. Server-client architecture

It is also the simplest structure of zabbix. There is no agent between the monitor computer and the monitored computer.

Data exchange is carried out between zabbix server and zabbix agentd. Suitable for the network is relatively simple, equipment

Less monitoring environment.

2. Server-proxy-client architecture

Proxy is a bridge between server and client, proxy itself does not have a front end, and

It does not store the data itself, but temporarily stores the data sent by agentd, and then submits it to

Server . This architecture is often compared with the master-node-client architecture and is generally applicable across the

Computer room, cross-network medium-sized network architecture monitoring.

3. Master-node-client architecture

This architecture is the most complex monitoring architecture of zabbix, and is suitable for large-scale computers with more equipment and across networks and computer rooms.

Environment. Each node is also a server terminal. Proxy can be connected to the node, or directly.

Get me client. Node has its own configuration file and database, and what it needs to do is to put the configuration information and the number of monitors

According to synchronization to master, master failure or damage to the integrity of the underlying architecture of node.

Focus 5 introduction to Grafana:

Grafana is a visual panel (Dashboard) with beautiful diagrams and layouts.

Full-featured measurement dashboards and graphical editors that support Graphite, zabbix, InfluxDB,

Prometheus and OpenTSDB are used as data sources. In InfluxDB (written in go language, it is an open

Source, distributed, time series, event, measurable and non-externally dependent database) as the underlying database

Grafana main features: flexible and rich graphics options; can mix multiple styles; support for daytime and

Night mode; multiple data sources. three。 Project experiment steps (operation screenshot or operation command) 1. Install the zabbix server server [root@server ~] # ip a # # configure the network Make sure you have access to the Internet 1: lo: mtu 65536 qdisc noqueue state UNKNOWN qlen 1 link/loopback 00 brd 00 brd 00 00 brd 00 00 inet 127.0.0.1 eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:4f:c9:00 brd ff:ff:ff:ff:ff:ff inet 192.168.100.101 .100.255 scope global eth0 valid_lft forever preferred_lft forever [root@server ~] # vi / etc/hosts 192.168.100.101 server.zabbix.com 192.168.100.152 agent.zabbix.com 192.168.100.153 win2k8dc1:wq [root@server ~] # wget-O / etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo[root@server ~] # yum-y install net-snmp net-snmp- Devel libxml2 libxml2-devel libcurl-devel libevent libevent libevent-devel curl curl-devel mysql-devel snmp perl-DBI php-xml php-bcmath php-mbstring php-ldap php-xmlrpc httpd php php-mysql php-common php-gd php-odbcphp-pear gcc* net-snmp libssh3 libssh3-devel mariadb-server mariadb mariadb-devel ntpdate## installs lamp and dependency packages Use the default yun source in centos 7 [root@server ~] # ntpdate ntp1.aliyun.com10 Sep 09:08:09 ntpdate [1225]: adjust time server 120.25.115.20 offset-0.000095 sec [root@server ~] # echo "ntpdate ntp1.aliyun.com" > > / etc/rc.local [root@server ~] # chmod + x / etc/rc.local [root@server ~] # systemctl start mariadb [root@server ~] # systemctl enable mariadbCreated symlink from / etc/systemd/system/ Multi-user.target.wants/mariadb.service to / usr/lib/systemd/system/mariadb.service. [root@server ~] # systemctl start httpd [root@server ~] # systemctl enable httpdCreated symlink from / etc/systemd/system/multi-user.target.wants/httpd.service to / usr/lib/systemd/system/httpd.service. [root@server ~] # mysqladmin-u root password123123123123 [root@server ~] # wget-O zabbix-3.4.2.tar.gz http://sourceforge.net/ Projects/zabbix/files/ZABBIX%20Latest%20Stable/3.4.2/zabbix-3.4.2.tar.gz/download # # download software package Upload can also be [root@server ~] # tar zxvf zabbix-3.4.2.tar.gz [root@server ~] # cd zabbix-3.4.2 [root@server ~] #. / configure-- prefix=/usr/local/zabbix-- enable-server-- enable-agent-- with-mysql-- enable-ipv6-- with-net-snmp-- with-libcurl-- with-libxml2 [root@server ~] # make & & make install [root@server ~] # mysql-uroot-p123123 # # Log in to the database to create a database that holds the monitoring template And import data templates, and authorize zabbix users to connect to the database Create database if not exists zabbix default character set utf8 collate utf8_general_ci;use zabbix;source / root/zabbix-3.4.2/database/mysql/schema.sql;source / root/zabbix-3.4.2/database/mysql/images.sql;source / root/zabbix-3.4.2/database/mysql/data.sql;grant all on zabbix.* to zabbix@'192.168.100.101' identified by 'zabbix';flush privileges;show grants for zabbix@'192.168.100.101' Exit [root@server ~] # groupadd zabbix [root@server ~] # useradd-r-g zabbix zabbix [root@server ~] # mkdir / usr/local/zabbix/logs [root@server ~] # chown zabbix:zabbix / usr/local/zabbix/-R [root@server ~] # vi / usr/local/zabbix/etc/zabbix_server.conf:%g/ ^ # / d:%g/ ^ $/ d LogFile=/usr/local/zabbix/logs/zabbix_server.log PidFile=/tmp/zabbix_server .pid DBHost=192.168.100.101 DBName=zabbix DBUser=zabbix DBPassword=zabbix DBSocket=/var/lib/mysql/mysql.sock Include=/usr/local/zabbix/etc/zabbix_server.conf.d/*.conf: WQ [root @ server ~] # vi / usr/local/zabbix/etc/zabbix_agentd.conf:%g/ ^ # / d:%g/ ^ $/ d PidFile=/tmp/zabbix_agentd.pid Server=127.0.0.1192.168.100.101 ServerActive=192.168.100.101 Hostname=server.zabbix.com LogFile=/usr / local/zabbix/logs/zabbix_agentd.log Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/*.conf:wq explanation: PidFile=/tmp/zabbix_agentd.pid # # run PID file Server=127.0.0.1192.168.100.101 # # enter the ip address of the zabbix_server host ServerActive=192.168.100.101 # # enter the agent host to collect and send the data to the server side Hostname=server.zabbix.com # # input the host of the machine Name LogFile=/usr/local/zabbix/logs/zabbix_agentd.log # # specify log file Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/*.conf # # Open the additional configuration file directory [root@server ~] # / usr/local/zabbix/sbin/zabbix_ server [root @ server ~] # netstat-utpln | grep 10051tcp 00 0.0.0.0 root@server 10051 0.0.0.0 root@server * LISTEN 29079 Zabix _ server [root @ server ~ ] # / usr/local/zabbix/sbin/zabbix_ agentd [root @ server ~] # root-utpln | grep 10050tcp 00 0.0.0.0 netstat 10050 0.0.0.0 grep 10050tcp * LISTEN 29148 Zabixagentd [root @ root ~] # mv / root/zabbix-3.4.2/frontends/php/ / var/www/html/zabbix [root] # root-R apache:apache / var/www/html/zabbix/ [root@server ~] # vi / etc/php. Ini 878 date.timezone = Asia/Shanghai 384 max_execution_time = 300394 max_input_time = 300672 post_max_size = 32m 405 memory_limit = 128m 854 extension=bcmath.so:wq explain: 878 date.timezone = Asia/Shanghai # # time zone 384 max_execution_time = 300 # # unit second Limit the time of receiving data through POST, GET and PUT max_input_time = 300 # # time limit when uploading file parsing data by php program 672 post_max_size = 32m # POST the maximum size allowed for data request is 405 memory_limit = 128m # # set the memory limit of php program 854 extension=bcmath.so # # load the extension module bcmath.so [root@server ~] # systemctl restart httpd2 that the zabbix program needs to load. Configure the web page of the zabbix service and make simple optimizations

Access to install http://192.168.100.101/zabbix/, default username admin password zabbix

Installation completed, set the display font to Chinese

Solve the garbled text below the zabbix display image:

Upload character set files to this directory

3. Realize monitoring OS, mysql and httpd on the server.zabbix.com side

four

Check the following three monitoring templates and click the Select button

The monitoring items of this host are displayed in the previous interface, and the graphics of this host can be created according to the monitoring items.

Select the monitoring item, click Select

View the graphics of the monitoring host

But unexpectedly, all the monitoring items about the Mysql database have no graphics, as shown in the figure

After inspection, the problem is shown in the following figure. The key value of the monitoring Mysql server is not used.

The solution is as follows

Set the key value of monitoring failure and open the zabbix_server server, which is also the monitored end.

[root@server ~] # vi / usr/local/zabbix/etc/zabbix_agentd.confPidFile=/tmp/zabbix_agentd.pidServer=127.0.0.1192.168.100.101ServerActive=192.168.100.101Hostname=server.zabbix.comLogFile=/usr/local/zabbix/logs/zabbix_agentd.logInclude=/usr/local/zabbix/etc/zabbix_agentd.conf.d/*.confUnsafeUserParameters=1UserParameter=mysql.version,mysql-VUserParameter=mysql.status [*], / usr/local/zabbix/etc/chk_mysql.sh $1UserParameter=mysql.ping Mysqladmin-uroot-p123123-P3306-h292.168.100.101 ping | grep-c alive:wq content interpretation: Server=192.168.100.151127.0.0.1 / / specify the address of the zabbix server ServerActive=192.168.100.101 / / specify the agent to collect the data and send it to the server side Hostname=server.zabbix.com / / specify the hostname of the agent side, and the server side must be parsed Note: this host name must be written when adding a monitored host in the web interface. UnsafeUserParameters=1 / / allows parameters of all characters to be passed to user-defined parameters. UserParameter=mysql.version,mysql-V / / defines the key value mysql.version, and the key value mysql-VUserParameter=mysql.status [*], / usr/local/zabbix/etc/chk_mysql.sh $1 / / defines the key value mysql.status [*] UserParameter=mysql.ping,mysqladmin-uroot-p123123-P3306-h292.168.100.101 ping | grep-c alive / / defines the key value mysql.ping, specifies the chk_mysql.sh script, and uses this script to check the running status of mysql Use the mysqladmin command to specify the database connection user password ip address on the agent side, and be careful to ensure the link of the mysqladmin command [root@server ~] # vi / usr/local/zabbix/etc/chk_mysql.sh # # write a script to check the mysql status, and specify the ip address of the mysql on the agent side in the script User name and password of the connection, etc. #! / bin/bash#----#FileName: check_mysql.sh#Revision: 1.0#Date: 2015/06/09#Author: DengYun#Email: dengyun@ttlsa.com#Website: www.ttlsa.com#Description: # Notes: ~ #-# Copyright: 2015 (c) DengYun#License: GPL# user Name MYSQL_USER='root'# password MYSQL_PWD='123123'# host address / IPMYSQL_HOST='192.168.100.101'# port MYSQL_PORT='3306'# data connection MYSQL_CONN= "/ usr/bin/mysqladmin-u$ {MYSQL_USER}-p$ {MYSQL_PWD}-h$ {MYSQL_HOST}-P$ {MYSQL_PORT}" # parameter is correct if [$#-ne "1] Then echo "arg error!" Fi # get data case $1 in Uptime) result= `${MYSQL_CONN} status | cut-f2-d ":" | cut-F1-d "T" `echo $result;; Com_update) result= `$ {MYSQL_CONN} extended-status | grep-w "Com_update" | cut-d "|"-f3` echo $result;; Slow_queries) result= `$ {MYSQL_CONN} status | cut-f5-d ":" | cut-F1-d "O" `echo $result " Com_select) result= `$ {MYSQL_CONN} extended-status | grep-w "Com_select" | cut-d "|"-f3` echo $result;; Com_rollback) result= `$ {MYSQL_CONN} extended-status | grep-w "Com_rollback" | cut-d "|"-f3` echo $result;; Questions) result= `$ {MYSQL_CONN} status | cut-f4-d ":" | cut-F1-d "S" `echo $result " Com_insert) result= `$ {MYSQL_CONN} extended-status | grep-w "Com_insert" | cut-d "|"-f3` echo $result;; Com_delete) result= `$ {MYSQL_CONN} extended-status | grep-w "Com_delete" | cut-d "|"-f3` echo $result;; Com_commit) result= `$ {MYSQL_CONN} extended-status | grep-w "Com_commit" | cut-d "|"-f3` echo $result " Bytes_sent) result= `$ {MYSQL_CONN} extended-status | grep-w "Bytes_sent" | cut-d "|"-f3` echo $result;; Bytes_received) result= `$ {MYSQL_CONN} extended-status | grep-w "Bytes_received" | cut-d "|"-f3` echo $result;; Com_begin) result= `$ {MYSQL_CONN} extended-status | grep-w "Com_begin" | cut-d "|"-f3` echo $result " *) echo "Usage:$0 (Uptime | Com_update | Slow_queries | Com_select | Com_rollback | Questions | Com_insert | Com_delete | Com_commit | Bytes_sent | Bytes_received | Com_begin)";; esac:wq [root@server ~] # chmod 777 / usr/local/zabbix/etc/chk_ mysql.sh [root @ server ~] # mysql-uroot-p123123 grant all on *. * to 'root'@'192.168.100.101' identified by' 123123 grant all on; flush privileges; show grants for root@'192.168.100.101' Exit [root@server ~] # ln-s / usr/local/zabbix/bin/* / usr/local/bin/ soft link for zabbix command When checking the mysql status, use the zabbix_get command [root@server ~] # yum-y install psmisc [root@server ~] # killall-9 zabbix_ server [root @ server ~] # killall-9 zabbix_ agentd [root @ server ~] # / usr/local/zabbix/sbin/zabbix_server [root@server ~] # / usr/local/zabbix/sbin/zabbix_ agentd [root @ server ~] # netstat-utpln | grep 100tcp 00 0.0.0.0purl 10050 0.0.0 .0: * LISTEN 29800/zabbix_agentd tcp 00 0.0.0.0root@server 10051 0.0.0.0root@server * LISTEN 29733/zabbix_server [root@server ~] # vi / etc/my.cnf # # prohibit reverse parsing of [mysqld] skip-name-resolve [root@server ~] # systemctl restart mariadb [root@server ~] # zabbix_get-s 192.168.100.101-k mysql.ping # # here you can obtain the specific key values of server monitoring items through the zabbix_get command Mysql.ping is the name of the key value in the zabbix_agentd.conf configuration file. You can check the key value through this name, and you can usually get the key value. It is no problem to get the monitoring data. 1 [root@server ~] # zabbix_get-s 192.168.100.101-k mysql.status [Com _ update] 143 [root@server ~] # zabbix_get-s 192.168.100.101-k mysql.versionmysql Ver 15.1 Distrib 5.5.56-MariaDB, for Linux (x86x64) using readline 5.1

Open the web interface of zabbix again and verify the monitoring interface of mysql server

Add the status of server.linuxfan.cn 's httpd service to the zabbix graph as shown above

4. Install and configure the zabbix_agentd agent (FTP server); first install the test service (ftp) on the zabbix_agentd side and ensure network communication [root@agent ~] # ip A1: lo: mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00100 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:a0:76:46 brd ff:ff:ff:ff:ff:ff inet 192.168.100 inet 127.0.0.1 inet 127.0.0.1 scope host lo inet6:: 1 eth0 .152 go 24 brd 192.168.100.255 scope global eth0 inet6 fe80::20c:29ff:fea0:7646/64 scope link valid_lft forever preferred_lft forever [root@agent ~] # vi / etc/sysconfig/network NETWORKING=yes HOSTNAME=agent.zabbix.com:wq [root@agent ~] # vi / etc/hosts 192.168.100.101 server.zabbix.com 192.168.100.152 agent.zabbix.com 192.168.100.153 win2k8dc1:wq [root@agent ~] # reboot [root@agent ~] # ping server.zabbix.com-c 4 [root@agent ~] # yum-y install vsftpd [root@agent ~] # / etc/init.d/vsftpd start then begins to configure the agent proxy of the zabbix of the host being monitored by agent.zabbix.com [root@agent ~] # wget-O / etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo[root@agent ~] # yum-y install libxml2-devel libcurl-devel pcre-devel ntpdate [root@agent ~] # ntpdate ntp1.aliyun.com [root@agent ~] # wget-O zabbix-3.4.2.tar.gz http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.4. 2/zabbix-3.4.2.tar.gz/download [root@agent] # tar zxvf zabbix-3.4.2.tar.gz [root@agent] # cd zabbix-3.4.2 [root@agent zabbix-3.4.2] #. / configure-- prefix=/usr/local/zabbix-- enable-agent-- enable-ipv6-- with-net-snmp-- with-libcurl-- with-libxml2 [root@agent zabbix-3.4.2] # make & & make Install [root@agent zabbix-3.4.2] # cp misc/init.d/tru64/zabbix_agentd / etc/init.d/ [root@agent zabbix-3.4.2] # vi / etc/init.d/zabbix_agentd 24 DAEMON=/usr/local/zabbix/sbin/zabbix_agentd: wq [root @ agent zabbix-3.4.2] # chmod + x / etc/init.d/zabbix_agentd [root@agent zabbix-3.4.2] # cd [root@agent ~] # groupadd Zabbix [root@agent ~] # useradd-r-g zabbix zabbix [root@agent ~] # chown-R zabbix:zabbix / usr/local/zabbix/ [root@agent ~] # vi / usr/local/zabbix/etc/zabbix_agentd.conf:%g/ ^ $/ d:%g/ ^ # / d LogFile=/tmp/zabbix_agentd.log Server=192.168.100.101 ServerActive=192.168.100.101 Hostname=agent.zabbix.com:wq [root@agent ~] # / etc/init.d/zabbix_agentd StartZabbix agent started. [root@agent ~] # netstat-utpln | grep zabbixtcp 00 0.0.0.0 netstat 10050 0.0.0.0 grep zabbixtcp 00: 10050:: * LISTEN 12481/zabbix_agentd 5. Log in to the web interface of zabbix to add agent hosts and verify monitoring

Control effect

Add agent.zabbix.com hosts, five after the default graphics, no ftp service graphics, then manually add

Ftp service graphic display

6. Configure and monitor Win2k8dc1 hosts to verify the effect

First configure the network of the windows2008 host

Secondly, use the host to visit the zabbix official website to download the plug-in for monitoring windows2008.

When the download is complete, copy the downloaded plug-in to the test host win2k8dc1 for configuration

C:\ zabbix\ bin\ win64\ zabbix_agentd.exe-c C:\ zabbix\ conf\ zabbix_agentd.win.conf-I # # installation

C:\ zabbix\ bin\ win64\ zabbix_agentd.exe-c C:\ zabbix\ conf\ zabbix_agentd.win.conf-s # # launch

C:\ zabbix\ bin\ win64\ zabbix_agentd.exe-c C:\ zabbix\ conf\ zabbix_agentd.win.conf-d # # Delete

Windows host configuration is complete. Add host win2k8dc1 in the web interface below.

Add is completed. The default figure is 2, which can be added manually. Without too much explanation here, verify that the current drawing is as follows

7. Customize monitoring items, create projects, triggers, graphics, and verify the monitoring effect

The above associated Template OS Linux templates basically cover all system-level monitoring, including the ones we are most concerned about.

Several items: ping, load, cpu utilization, memory, disk, network card traffic, etc. Of course, some triggers have thresholds that can

Can need to be modified according to the situation of the server.

The following is to add a custom server memory usage test item, where a monitoring item is configured as follows: memory usage 70m for warning

Reminder:

1. Modify the client zabbix_agentd.conf configuration file and add the following on the last line:

UserParameter=memory_userd,free-m | grep Mem | awk'{print $3}'

Syntax: UserParameter=key,shell command

Monitoring key value: the memory_userd,key value can be written at will, but when you need to create a monitoring item on the web page later

Specify key value

Shell command or script: free-m | grep Mem | awk'{print $3}'

Note: you can use the zabbix_get-s agent ip address-p 10050-k key name on the zabbix_server side.

You can view the monitoring values of key on the agent side through this command

The specific implementation is as follows: change the configuration file of the agent.zabbix.com host to customize the monitoring items.

[root@agent ~] # vi / usr/local/zabbix/etc/zabbix_agentd.conf

UserParameter=memory_userd,free-m | grep Mem | awk'{print $3}'

: wq

[root@agent ~] # / etc/init.d/zabbix_agentd restart

Use the server.agent.com host to view the key values of its monitoring items

[root@server] # zabbix_get-s 192.168.100.152-k memory_userd

three hundred and thirty eight

Use the web interface to add this monitoring item

After the monitoring item is added, create a trigger (trigger an alarm action according to the condition)

After the trigger is created, create the graph displayed by the monitor

Open the home page and give an obvious hint

8. Realize email alarm

First configure mail on the server.zabbix.com side

[root@server ~] # yum-y install postfix mailx dos2unix

[root@server] # mailx-V

[root@server ~] # vi / etc/mail.rc / / add at the end of this file, specify email address for receiving mail, specify mail

Box server address, specify the authorization code to receive mail mailbox address, not the password of 163 mailbox, but the authorization code, login

After NetEase email address,-- set-- enable smtp and pop3--, click the client to generate the authorization code-- use this authorization code to enter

The line is assigned to this profile

Set from=li__wenhu@163.com smtp=smtp.163.comset smtp-auth-user=li__wenhu@163.com smtp-auth-password=...set smtp-auth=login:wq [root@server ~] # echo "Test content" | mail-s "Test title" li__wenhu@163.com / / Test Mail receiving [root@server ~] # vi / usr/local/zabbix/etc/zabbix_server.conf / / Open the foot of the main configuration file on the server side This storage location AlertScriptsPath=/usr/local/zabbix/share/zabbix/alertscripts:wq [root@server ~] # vi / usr/local/zabbix/share/zabbix/alertscripts/2.sh / / write an alarm email script Adjust the syntax position of the mail command and use the dos2unix command to convert characters to avoid the error of ATT00001.bin due to the receipt of mail that does not display normal email content. #! / bin/bash#export.UTF-8bt=$2sjr=$1FILE=/tmp/mailtmp.txtecho "$3" > $FILE/usr/bin/dos2unix-k $FILE/bin/mail-s "$bt"$sjr"

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

Servers

Wechat

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

12
Report