监控平台,zabbix安装
监控平台及zabbix监控介绍http://i2.运维网.com/images/blog/201804/13/cc404fdb835016e1b24ddd799f6951bd.png
http://i2.运维网.com/images/blog/201804/13/852841e66c49fcf164cc480135c1d45f.png
http://i2.运维网.com/images/blog/201804/13/35f70076cb5008ccb8cb6021f5ba7a31.png
安装zabbix
1.下载安装包:
# wget repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm--2018-04-13 01:44:59--http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
正在解析主机 repo.zabbix.com (repo.zabbix.com)... 162.243.159.138
正在连接 repo.zabbix.com (repo.zabbix.com)|162.243.159.138|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:13392 (13K)
正在保存至: “zabbix-release-3.2-1.el7.noarch.rpm”
100%[===========================================================>] 13,392 --.-K/s 用时 0.001s
2018-04-13 01:45:04 (11.9 MB/s) - 已保存 “zabbix-release-3.2-1.el7.noarch.rpm” )
2.安装:
# rpm -ivh zabbix-release-3.2-1.el7.noarch.rpm
警告:zabbix-release-3.2-1.el7.noarch.rpm: 头V4 RSA/SHA512 Signature, 密钥 ID a14fe591: NOKEY
准备中... #################################
正在升级/安装...
1:zabbix-release-3.2-1.el7 #################################
3.安装服务端需要包:
yum install -y zabbix-agent zabbix-get zabbix-server-mysql zabbix-web zabbix-web-mysql
http://i2.运维网.com/images/blog/201804/13/9ed2503022ec894b0469002ed6174b1e.png
4.编辑配置文件:
# vim /etc/my.cnf
character_set_server = utf8
datadir=/data/mysql
socket=/tmp/mysql.sock
server-id=130
log_bin=weixing11
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
#log-error=/var/log/mariadb/mariadb.log
#pid-file=/var/run/mariadb/mariadb.pid
#
# include all files from the config directory
#
#!includedir /etc/my.cnf.d
~
5.重启服务:
# systemctl restart mysqld.service
6.创建库:创建用户
mysql> create database zabbix character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> grant all on zabbix.* to 'zabbix'@'127.0.0.1' identified by 'aming-zabbix';
Query OK, 0 rows affected (1.71 sec)
7.导入数据:
# cd /usr/share/doc/zabbix-server-mysql-3.2.11/
# ls
AUTHORSChangeLogCOPYINGcreate.sql.gzNEWSREADME
# gzip -d create.sql.gz
# ls
AUTHORSChangeLogCOPYINGcreate.sqlNEWSREADME
# mysql -uroot -pwei914 zabbix < create.sql
Warning: Using a password on the command line interface can be insecure.
8.启动服务:
# systemctl start zabbix-server
# ps aux |grep nginx
root 9240.00.1459881168 ? Ss 08:36 0:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
nobody 9270.00.4484764016 ? S 08:36 0:00 nginx: worker process
nobody 9280.00.3484763784 ? S 08:36 0:00 nginx: worker process
root 19250.00.0 112676 984 pts/0 R+ 09:08 0:00 grep --color=auto nginx
# /etc/init.d/nginx stop
Stopping nginx (via systemctl): [确定]
# !ps
ps aux |grep nginx
root 19470.00.0 112676 984 pts/0 S+ 09:08 0:00 grep --color=auto nginx
# !netst
netstat -lntp |grep java
# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:53611 0.0.0.0:* LISTEN 900/rpc.statd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd
tcp 0 0 0.0.0.0:20048 0.0.0.0:* LISTEN 920/rpc.mountd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 887/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1168/master
tcp 0 0 0.0.0.0:45754 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN -
tcp6 0 0 :::111 :::* LISTEN 1/systemd
tcp6 0 0 :::20048 :::* LISTEN 920/rpc.mountd
tcp6 0 0 :::37970 :::* LISTEN -
tcp6 0 0 :::22 :::* LISTEN 887/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1168/master
tcp6 0 0 :::2049 :::* LISTEN -
tcp6 0 0 :::50248 :::* LISTEN 900/rpc.statd
tcp6 0 0 :::3306 :::* LISTEN 1705/mysqld
# systemctl start httpd
9.设置开机启动:
# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
# systemctl enable zabbix-server.service
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
# systemctl disable nginx
nginx.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig nginx off
10.发现问题,未监听端口:修改配置文件
# vim /etc/zabbix/zabbix_server.conf
DBHost=127.0.0.1 //在DBName=zabbix上面增加
DBPassword=aming-zabbix //在DBuser下面增加
11.设置时区
# vi /etc/php.ini
date.timezone = Asia/Shanghai
12.重启服务:
# systemctlrestart httpd
13.在网页按步骤配置密码:
14.客户端安装:
在客户端上也需要下载zabbix的yum源
wget repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
rpm -ivh zabbix-release-3.2-1.el7.noarch.rpm
# yum install -y zabbix-agent
已加载插件:fastestmirror
base | 3.6 kB00:00:00
epel/x86_64/metalink
15.编辑配置文件:
vim/etc/zabbix/zabbix_agentd.conf
Server=127.0.0.1修改为Server=192.168.133.130 //定义服务端的ip(被动模式)
ServerActive=127.0.0.1修改为ServerActive=192.168.133.130 //定义服务端的ip(主动模式)
Hostname=Zabbix server修改为Hostname=aming-123 //这是自定义的主机名,一会还需要在web界面下设置同样的主机名
16.启动服务:
# systemctl start zabbix-agent.service
# ps aux |grep zabbix
zabbix 17880.00.1806641268 ? S 09:47 0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbi_agentd.conf
zabbix 17890.00.1806641304 ? S 09:47 0:00 /usr/sbin/zabbix_agentd: collector
zabbix 17900.00.1806641848 ? S 09:47 0:00 /usr/sbin/zabbix_agentd: listener #1
zabbix 17910.00.1806641848 ? S 09:47 0:00 /usr/sbin/zabbix_agentd: listener #2
zabbix 17920.00.1806641848 ? S 09:47 0:00 /usr/sbin/zabbix_agentd: listener #3
zabbix 17930.00.2807962212 ? S 09:47 0:00 /usr/sbin/zabbix_agentd: active checks #1
root 17970.00.0 112676 980 pts/1 R+ 09:47 0:00 grep --color=auto zabbix
# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 834/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1110/master
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 1788/zabbix_agentd
tcp6 0 0 :::111 :::* LISTEN 1/systemd
tcp6 0 0 :::22 :::* LISTEN 834/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1110/master
tcp6 0 0 :::10050 :::* LISTEN 1788/zabbix_agentd
tcp6 0 0 :::3306 :::* LISTEN 1047/mysqld
页:
[1]