zabbix

Basic introduction to Zabbix:

Zabbix is ​​an enterprise-level open source solution that provides distributed system monitoring and network monitoring functions based on a WEB interface. It can monitor various network parameters to ensure the safe operation of the server system; and provides a soft notification mechanism to allow system administrators to quickly locate/solve various problems.

Zabbix consists of 2 parts, zabbix server and optional component zabbix agent.
zabbix server: It can provide monitoring of remote server/network status, data collection and other functions through SNMP, zabbix agent, ping, port monitoring, etc. It can run on Linux, Solaris, HP-UX, AIX, Free BSD, Open BSD , OS X and other platforms.

zabbix agent: It needs to be installed on the monitored target server. It mainly completes the collection of hardware information or operating system-related memory, CPU and other information. zabbix agent can run on Linux, Solaris, HP-UX, AIX, Free BSD, Open BSD, OS X, Tru64/OSF1, Windows NT4.0, Windows 2000/2003/XP/Vista and other systems.

Server: refers to the server where the zabbix service is installed (hereinafter referred to as the server side), which is the most important part. It is mainly installed on the linux system (supporting multiple operating systems), using mysql to store monitoring data and using apache+php. render.

  Agent: refers to the zabbix agent (hereinafter referred to as the agent) installed on the monitored device. The data on the monitored device is collected by the agent and then uploaded to the server for collection, arrangement and presentation by the server.

  SNMP: It is also a kind of agent, which refers to a device (or a server) that supports the SNMP protocol. By setting the parameters of SNMP, the relevant monitoring data is transmitted to the server (most network devices such as switches and firewalls support it). SNMP protocol).

  IPMI: Another method of Agent, which is mainly used for monitoring the physical performance of devices, such as device temperature and fan speed.

1. Experimental environment:

server11:172.25.66.11 rhel7.3
server1:172.25.66.1 rhel6.5

2. Installation

##安装相关依赖
[root@server11 ~]#  yum install -y zabbix-agent-3.4.6-1.el7.x86_64.rpm zabbix-web-3.4.6-1.el7.noarch.rpm zabbix-web-mysql-3.4.6-1.el7.noarch.rpm zabbix-server-mysql-3.4.6-1.el7.x86_64.rpm php-mbstring-5.4.16-42.el7.x86_64.rpm php-bcmath-5.4.16-42.el7.x86_64.rpm fping-3.10-1.el7.x86_64.rpm iksemel-1.4-2.el7.centos.x86_64.rpm

##安装数据库
[root@seerver11 ~]# yum install mariadb mariadb-server -y

##启动数据库并配置
[root@seerver11 ~]# systemctl start mariadb
[root@server11 ~]# mysql
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;       ##建库
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'westos';      ##授权
Query OK, 0 rows affected (0.00 sec)

[root@server11 zabbix-server-mysql-3.4.6]# pwd
/usr/share/doc/zabbix-server-mysql-3.4.6
[root@server11 zabbix-server-mysql-3.4.6]# zcat create.sql.gz | mysql -uzabbix -p zabbix        ##文件导入数据库
Enter password: 

[root@server11 zabbix-server-mysql-3.4.6]# cd /etc/zabbix/
[root@server11 zabbix]# vim zabbix_server.conf ##编辑zabbix-server配置文件
write picture description here

Add password DBPassword=westos

[root@server11 zabbix]# cd /etc/httpd/conf.d/
[root@server11 conf.d]# vim zabbix.conf
write picture description here

Configure timezone php_value date.timezone Asia/Shanghai

[root@server11 conf.d]# systemctl restart zabbix-server zabbix-agent httpd
[root@server11 conf.d]# systemctl enable zabbix-server zabbix-agent httpd

Browser access test:
http://172.25.66.11/zabbix
write picture description here
account Admin
password zabbix

write picture description here

write picture description here

write picture description here

write picture description here

3. WeChat reminder

build client

[root@server1 ~]# yum install zabbix-agent-3.4.6-1.el6.x86_64.rpm -y
[root@server1 ~]# cd /etc/zabbix/
[root@server1 zabbix]# vim zabbix_agentd.conf
Server=172.25.66.11 ##Monitoring host (zabbix server) ip
ServerActive=172.25.66.11 ##Monitoring host's ip
Hostname=server1 ##own hostname

Add local parsing (both sides)

[root@server1 zabbix]# vim /etc/hosts
172.25.66.11 server11
[root@server11 conf.d]# vim /etc/hosts
172.25.66.1 server1
[root@server1 zabbix]# /etc/init.d/zabbix-agent start

browser settings

1. Add action

write picture description here
write picture description here

2. Add discovery

1. Manual

Configure - "Host -" Create a host. . . . .

2. Automatic

Configuration - "Auto Discovery"
write picture description here
write picture description here

wait + refresh
write picture description here

nginx monitoring

nginx was installed in server1 before

[root@server1 nginx-1.12.0]# vim /usr/local/nginx/conf/nginx.conf
location /status {
stub_status on;
access_log off;
}

Browser access
http://172.25.66.1/status
write picture description here

[root@server1 zabbix_agentd.d]# pwd
/etc/zabbix/zabbix_agentd.d
[root@server1 zabbix_agentd.d]# vim userparameter_mysql.conf
write picture description here

Zabbix server download data acquisition tool zabbix-get
[root@server11 ~]# yum install zabbix-get-3.4.6-1.el7.x86_64.rpm
zabbix_get -s 172.25.66.1 -p 10050 -k nginx.status|accept |active ##Test results as shown below
write picture description here

Click on the hostname server1 in the zabbix browser and
click on the upper right corner to create a monitoring item
write picture description here
write picture description here

can find this
write picture description here

Create monitoring graphs
write picture description here

write picture description here

write picture description here

write picture description here

WeChat cloud alarm, first ensure that the zabbix server can access the Internet, configure iptables rules on the
real machine
[root@foundation66 Desktop]# iptables -t nat -I POSTROUTING -s 172.25.66.0/24 -j MASQUERADE
Zabbix monitoring server add routing settings dns
[root@server11 ~]# route add default gw 172.25.66.100
[root@server11 ~]# vim /etc/resolv.conf
write picture description here
Test whether China Unicom is connected
write picture description here

Log on to http://www.onealert.com/

[root@server11 ~]# cd /usr/lib/zabbix/alertscripts/
[root@server11 alertscripts]# wget http://www.onealert.com/agent/release/oneitsm_zabbix_release-1.2.0.tar.gz
[root@server11 alertscripts]# tar zxf oneitsm_zabbix_release-1.2.0.tar.gz
[root@server11 alertscripts]# cd oneitsm/bin/
[root@server11 bin]# bash install.sh 0079671b-3575-3a2c-9959-ad26887158ac

The key is generated in the web application
write picture description here

write picture description here

Start alarm settings
write picture description here

Next, set
[Management - Alarm Media Type] on the zabbix side to enable the third oneitsm media
write picture description here

[Administration – User – oneitsm media – Alarm Media] View has been added
write picture description here

Closing zabbix-server on the server
[detection-problem] will display the problem, zabbix tries to fix it, and fails after
a period of time, WeChat will receive a notification

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326041383&siteId=291194637