设为首页 收藏本站
查看: 1121|回复: 0

[经验分享] 监控平台,zabbix安装

[复制链接]

尚未签到

发表于 2019-1-20 14:17:31 | 显示全部楼层 |阅读模式
监控平台及zabbix监控介绍




安装zabbix
  1.下载安装包:

[root@weixing01 ~]# 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) [application/x-redhat-package-manager]
正在保存至: “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” [13392/13392])

  2.安装:

[root@weixing01 ~]# 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
准备中...                          ################################# [100%]
正在升级/安装...
1:zabbix-release-3.2-1.el7         ################################# [100%]

  3.安装服务端需要包:

yum install -y zabbix-agent zabbix-get zabbix-server-mysql zabbix-web zabbix-web-mysql


  4.编辑配置文件:

[root@weixing01 ~]# vim /etc/my.cnf

[mysqld]
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
[mysqld_safe]
#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.重启服务:

[root@weixing01 ~]# 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.导入数据:

[root@weixing01 ~]# cd /usr/share/doc/zabbix-server-mysql-3.2.11/
[root@weixing01 zabbix-server-mysql-3.2.11]# ls
AUTHORS  ChangeLog  COPYING  create.sql.gz  NEWS  README
[root@weixing01 zabbix-server-mysql-3.2.11]# gzip -d create.sql.gz
[root@weixing01 zabbix-server-mysql-3.2.11]# ls
AUTHORS  ChangeLog  COPYING  create.sql  NEWS  README
[root@weixing01 zabbix-server-mysql-3.2.11]# mysql -uroot -pwei914 zabbix < create.sql
Warning: Using a password on the command line interface can be insecure.

  8.启动服务:

[root@weixing01 ~]# systemctl start zabbix-server
[root@weixing01 ~]# ps aux |grep nginx
root        924  0.0  0.1  45988  1168 ?        Ss   08:36   0:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
nobody      927  0.0  0.4  48476  4016 ?        S    08:36   0:00 nginx: worker process
nobody      928  0.0  0.3  48476  3784 ?        S    08:36   0:00 nginx: worker process
root       1925  0.0  0.0 112676   984 pts/0    R+   09:08   0:00 grep --color=auto nginx
[root@weixing01 ~]# /etc/init.d/nginx stop
Stopping nginx (via systemctl):                            [  确定  ]
[root@weixing01 ~]# !ps
ps aux |grep nginx
root       1947  0.0  0.0 112676   984 pts/0    S+   09:08   0:00 grep --color=auto nginx
[root@weixing01 ~]# !netst
netstat -lntp |grep java
[root@weixing01 ~]# 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         
[root@weixing01 ~]# systemctl start httpd

  9.设置开机启动:

[root@weixing01 ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@weixing01 ~]# 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.
[root@weixing01 ~]# systemctl disable nginx
nginx.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig nginx off

  10.发现问题,未监听端口:修改配置文件

[root@weixing01 ~]# vim /etc/zabbix/zabbix_server.conf

DBHost=127.0.0.1 //在DBName=zabbix上面增加
DBPassword=aming-zabbix //在DBuser下面增加

  11.设置时区

[root@weixing01 ~]# vi /etc/php.ini

date.timezone = Asia/Shanghai
  12.重启服务:

[root@weixing01 ~]# systemctl  restart 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

[root@weixing-03 ~]# yum install -y zabbix-agent
已加载插件:fastestmirror
base                                                                                    | 3.6 kB  00: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.启动服务:

[root@weixing-03 ~]# systemctl start zabbix-agent.service
[root@weixing-03 ~]# ps aux |grep zabbix
zabbix     1788  0.0  0.1  80664  1268 ?        S    09:47   0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbi_agentd.conf
zabbix     1789  0.0  0.1  80664  1304 ?        S    09:47   0:00 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
zabbix     1790  0.0  0.1  80664  1848 ?        S    09:47   0:00 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
zabbix     1791  0.0  0.1  80664  1848 ?        S    09:47   0:00 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
zabbix     1792  0.0  0.1  80664  1848 ?        S    09:47   0:00 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
zabbix     1793  0.0  0.2  80796  2212 ?        S    09:47   0:00 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
root       1797  0.0  0.0 112676   980 pts/1    R+   09:47   0:00 grep --color=auto zabbix
[root@weixing-03 ~]# 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、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-665661-1-1.html 上篇帖子: 一键安装zabbix 下篇帖子: zabbix 2.4 自定义key实例
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表