通常大公司都会使用一些监控平台软件监控服务器运行状态,不然服务器发生问题了,须要等到用户的反馈就会不及时,产生很大的损失了。php
常见的开源监控软件有:cacti、nagios、zabbix、smokeping、open-falcon等。mysql
nagios和zabbix流行度很高,cacti和smokeping偏向于基础的监控,例如cacti监控网络设备等(IDC机房用),成图很是漂亮。ios
前几年nagios不少公司在用,后来zabbix异军突起开始流行起来,他比nagios有更多优点,配置也更简单。nginx
cacti、nagios和zabbix服务端的监控中心须要php环境的支持,zabbix和cacti用mysql记录,nagios不记录历史数据而注重服务的当前状态。web
open-falcon是小米公司开发的,早起小米公司用zabbix监控,后来为了知足个性化需求,本身开发了open-falcon,借鉴了zabbix的监控思想。sql
不少大公司:滴滴、360、微博、京东等都在用open-falcon。数据库
zabbix会把数据记录到mysql,再造成图表。 nagios注重关注状态不关心历史数据。 zabbix能够直接在浏览器里方便配置。express
zabbix是基于C/S架构使用C++语言开发的,监控中心支持web配置管理,主流有3.2版本,最新的是3.4版本。apache
zabbix须要有一个服务端,在客户端上也要安装一个agent服务,而后agent采集客户端机器的数据,主动上报给服务端,也能够服务端主动去agent上抓数据。vim
agent有两种模式:主动、被动。
监控中心开启php环境,一台server中心支持上万台的agent,瓶颈在于采集数据的量。
若是数据量大可使用zabbix-proxy代理,充当server的角色,减轻server端的压力,代理获得分析结果后再汇报。
zabbix-agent主要负责收集监控服务项目的数据
zabbix包含有五个组件:
一、Server 二、Web UI 三、数据存储 Mysql 四、proxy:能够一个局域网配置一个proxy代理 五、agent:每台被监控的机器上都要安装
zabbix的监控流程图:
准备两台机器:A为Server、B为客户端 一、A上到zabbix官网下载rpm的yum源,而后使用yum安装的相关组件:直接yum epel源也能够,可是版本为2.2太旧了,不建议
[root@nginx src]# wget https://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm --2018-07-07 16:34:28-- https://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|:443... 已链接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:13392 (13K) [application/x-redhat-package-manager] 正在保存至: “zabbix-release-3.2-1.el7.noarch.rpm” 100%[=============================================================================================================>] 13,392 --.-K/s 用时 0s 2018-07-07 16:34:44 (307 MB/s) - 已保存 “zabbix-release-3.2-1.el7.noarch.rpm” [13392/13392]) [root@nginx src]# 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%]
二、yum安装zabbix相关的包:zabbix-agent、zabbix-get、zabbix-server-mysql、zabbix-web、zabbix-web-mysql(会自动安装httpd和php)
[root@nginx src]# yum install -y zabbix-agent zabbix-get zabbix-server-mysql zabbix-web zabbix-web-mysql 已安装: zabbix-agent.x86_64 0:3.2.11-1.el7 zabbix-get.x86_64 0:3.2.11-1.el7 zabbix-server-mysql.x86_64 0:3.2.11-1.el7 zabbix-web.noarch 0:3.2.11-1.el7 zabbix-web-mysql.noarch 0:3.2.11-1.el7 做为依赖被安装: OpenIPMI-libs.x86_64 0:2.0.23-2.el7 OpenIPMI-modalias.x86_64 0:2.0.23-2.el7 dejavu-fonts-common.noarch 0:2.33-6.el7 dejavu-sans-fonts.noarch 0:2.33-6.el7 fontpackages-filesystem.noarch 0:1.44-8.el7 fping.x86_64 0:3.10-4.el7 iksemel.x86_64 0:1.4-6.el7 libX11.x86_64 0:1.6.5-1.el7 libX11-common.noarch 0:1.6.5-1.el7 libXau.x86_64 0:1.0.8-2.1.el7 libXpm.x86_64 0:3.5.12-1.el7 libxcb.x86_64 0:1.12-1.el7 libzip.x86_64 0:0.10.1-8.el7 php.x86_64 0:5.4.16-45.el7 php-bcmath.x86_64 0:5.4.16-45.el7 php-cli.x86_64 0:5.4.16-45.el7 php-common.x86_64 0:5.4.16-45.el7 php-gd.x86_64 0:5.4.16-45.el7 php-ldap.x86_64 0:5.4.16-45.el7 php-mbstring.x86_64 0:5.4.16-45.el7 php-mysql.x86_64 0:5.4.16-45.el7 php-pdo.x86_64 0:5.4.16-45.el7 php-xml.x86_64 0:5.4.16-45.el7 t1lib.x86_64 0:5.1.2-14.el7 unixODBC.x86_64 0:2.3.1-11.el7
三、单独安装mysql:在my.cnf中修改mysql的字符集,使web界面支持中文不会乱码
[root@nginx ~]# vim /etc/my.cnf [mysqld] character_set_server=utf8 //加入这行配置 [root@nginx ~]# /etc/init.d/mysqld restart //重启mysql Shutting down MySQL.. SUCCESS! Starting MySQL. SUCCESS!
四、创建zabbix的mysql库和访问用户:
mysql> create database zabbix character set utf8; Query OK, 1 row affected (0.02 sec) mysql> grant all on zabbix.* to 'zabbix'@'127.0.0.1' identified by '7826078'; Query OK, 0 rows affected (0.02 sec)
五、导入原始数据到zabbix库:自带库数据在/usr/share/doc/zabbix-server-mysql-3.2.11/ 目录下
[root@nginx data]# cd /usr/share/doc/zabbix-server-mysql-3.2.11/ [root@nginx zabbix-server-mysql-3.2.11]# ls AUTHORS ChangeLog COPYING create.sql.gz NEWS README [root@nginx zabbix-server-mysql-3.2.11]# gzip -d create.sql.gz [root@nginx zabbix-server-mysql-3.2.11]# mysql -uroot -pxxxxxxx zabbix <create.sql Warning: Using a password on the command line interface can be insecure.
六、启动zabbix-server服务、httpd服务:停掉nginx服务以避免httpd80端口被nginx占用
[root@nginx zabbix-server-mysql-3.2.11]# systemctl stop nginx //停掉nginx服务 [root@nginx zabbix-server-mysql-3.2.11]# 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:22 0.0.0.0:* LISTEN 822/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1149/master tcp6 0 0 :::22 :::* LISTEN 822/sshd tcp6 0 0 ::1:25 :::* LISTEN 1149/master tcp6 0 0 :::3306 :::* LISTEN 1677/mysqld [root@nginx zabbix-server-mysql-3.2.11]# systemctl start zabbix-server //启动zabbix-server [root@nginx zabbix-server-mysql-3.2.11]# ps aux|grep zabbix zabbix 2034 0.0 0.1 254628 3496 ? S 17:01 0:00 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf root 2037 0.0 0.0 112720 972 pts/0 S+ 17:02 0:00 grep --color=auto zabbix [root@nginx zabbix-server-mysql-3.2.11]# systemctl start httpd //启动httpd [root@nginx zabbix-server-mysql-3.2.11]# 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:22 0.0.0.0:* LISTEN 822/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1149/master tcp6 0 0 :::80 :::* LISTEN 2046/httpd tcp6 0 0 :::22 :::* LISTEN 822/sshd tcp6 0 0 ::1:25 :::* LISTEN 1149/master tcp6 0 0 :::3306 :::* LISTEN 1677/mysqld [root@nginx zabbix-server-mysql-3.2.11]# ps aux|grep httpd root 2046 0.3 0.8 394440 15528 ? Ss 17:03 0:00 /usr/sbin/httpd -DFOREGROUND apache 2049 0.0 0.4 394572 7684 ? S 17:04 0:00 /usr/sbin/httpd -DFOREGROUND apache 2050 0.0 0.4 394572 7684 ? S 17:04 0:00 /usr/sbin/httpd -DFOREGROUND apache 2051 0.0 0.4 394572 7684 ? S 17:04 0:00 /usr/sbin/httpd -DFOREGROUND apache 2052 0.0 0.4 394572 7684 ? S 17:04 0:00 /usr/sbin/httpd -DFOREGROUND apache 2053 0.0 0.4 394572 7684 ? S 17:04 0:00 /usr/sbin/httpd -DFOREGROUND root 2056 0.0 0.0 112720 968 pts/0 R+ 17:04 0:00 grep --color=auto httpd [root@nginx zabbix-server-mysql-3.2.11]# systemctl enable zabbix-server //设置开机启动zabbix-server Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service. [root@nginx zabbix-server-mysql-3.2.11]# systemctl enable httpd //设置开机启动httpd Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service. [root@nginx zabbix-server-mysql-3.2.11]# chkconfig nginx off //nginx开机不启动
七、开启zabbix服务后,进程正常,可是没有监听端口:须要查看日志排查错误
[root@nginx ~]# ps aux|grep zabbix //有zabbix进程 zabbix 1112 0.0 0.1 254628 3504 ? S 19:53 0:00 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf root 1370 0.0 0.0 112720 972 pts/0 S+ 20:16 0:00 grep --color=auto zabbix [root@nginx ~]# netstat -lntp //可是没有zabbix端口监听 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:22 0.0.0.0:* LISTEN 837/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1193/master tcp6 0 0 :::80 :::* LISTEN 839/httpd tcp6 0 0 :::22 :::* LISTEN 837/sshd tcp6 0 0 ::1:25 :::* LISTEN 1193/master tcp6 0 0 :::3306 :::* LISTEN 1091/mysqld [root@nginx ~]# cat /var/log/zabbix/zabbix_server.log //查看zabbix日志,显示没法连接mysql 2034:20180707:170155.179 Starting Zabbix Server. Zabbix 3.2.11 (revision 76339). 2034:20180707:170155.179 ****** Enabled features ****** 2034:20180707:170155.179 SNMP monitoring: YES 2034:20180707:170155.179 IPMI monitoring: YES 2034:20180707:170155.179 Web monitoring: YES 2034:20180707:170155.179 VMware monitoring: YES 2034:20180707:170155.179 SMTP authentication: YES 2034:20180707:170155.179 Jabber notifications: YES 2034:20180707:170155.179 Ez Texting notifications: YES 2034:20180707:170155.179 ODBC: YES 2034:20180707:170155.179 SSH2 support: YES 2034:20180707:170155.179 IPv6 support: YES 2034:20180707:170155.179 TLS support: YES 2034:20180707:170155.179 ****************************** 2034:20180707:170155.179 using configuration file: /etc/zabbix/zabbix_server.conf 2034:20180707:170155.198 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
修改配置文件conf文件,链接mysql:增长DB相关的几行配置,重启zabbix-server就能够监听端口了
[root@nginx ~]# vim /etc/zabbix/zabbix_server.conf # Default: # PidFile=/tmp/zabbix_server.pid PidFile=/var/run/zabbix/zabbix_server.pid DBHost=127.0.0.1 DBName=zabbix DBUser=zabbix DBPassword=xxxxxx [root@nginx ~]# ps aux|grep zabbix zabbix 1401 1.1 0.2 254808 4184 ? S 20:25 0:00 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf zabbix 1405 0.0 0.1 254808 2512 ? S 20:25 0:00 /usr/sbin/zabbix_server: configuration syncer [waiting 60 sec for processes] zabbix 1406 0.0 0.1 254808 2724 ? S 20:25 0:00 /usr/sbin/zabbix_server: db watchdog [synced alerts config in 0.009305 sec, idle 60 sec] zabbix 1407 0.1 0.2 361748 5260 ? S 20:25 0:00 /usr/sbin/zabbix_server: poller #1 [got 0 values in 0.000007 sec, idle 5 sec] zabbix 1408 0.0 0.2 361748 5260 ? S 20:25 0:00 /usr/sbin/zabbix_server: poller #2 [got 0 values in 0.000006 sec, idle 5 sec] zabbix 1409 0.0 0.2 361748 5260 ? S 20:25 0:00 /usr/sbin/zabbix_server: poller #3 [got 0 values in 0.000007 sec, idle 5 sec] zabbix 1410 0.0 0.2 361748 5260 ? S 20:25 0:00 /usr/sbin/zabbix_server: poller #4 [got 0 values in 0.000005 sec, idle 5 sec] zabbix 1411 0.0 0.2 361748 5260 ? S 20:25 0:00 /usr/sbin/zabbix_server: poller #5 [got 0 values in 0.000007 sec, idle 5 sec] zabbix 1412 0.0 0.2 361748 5260 ? S 20:25 0:00 /usr/sbin/zabbix_server: unreachable poller #1 [got 0 values in 0.000007 sec, idle 5 sec] zabbix 1413 0.0 0.1 254808 3616 ? S 20:25 0:00 /usr/sbin/zabbix_server: trapper #1 [processed data in 0.000000 sec, waiting for connection] zabbix 1414 0.0 0.1 254808 3616 ? S 20:25 0:00 /usr/sbin/zabbix_server: trapper #2 [processed data in 0.000000 sec, waiting for connection] zabbix 1415 0.0 0.1 254808 3616 ? S 20:25 0:00 /usr/sbin/zabbix_server: trapper #3 [processed data in 0.000000 sec, waiting for connection] zabbix 1417 0.0 0.1 254808 3616 ? S 20:25 0:00 /usr/sbin/zabbix_server: trapper #4 [processed data in 0.000000 sec, waiting for connection] zabbix 1419 0.0 0.1 254808 3616 ? S 20:25 0:00 /usr/sbin/zabbix_server: trapper #5 [processed data in 0.000000 sec, waiting for connection] zabbix 1421 0.0 0.1 257380 2688 ? S 20:25 0:00 /usr/sbin/zabbix_server: icmp pinger #1 [got 0 values in 0.000006 sec, idle 5 sec] zabbix 1422 0.0 0.1 254808 2728 ? S 20:25 0:00 /usr/sbin/zabbix_server: alerter [sent alerts: 0 success, 0 fail in 0.005476 sec, idle 30 sec] zabbix 1424 0.0 0.1 254808 2508 ? S 20:25 0:00 /usr/sbin/zabbix_server: housekeeper [startup idle for 30 minutes] zabbix 1425 0.0 0.1 254880 2968 ? S 20:25 0:00 /usr/sbin/zabbix_server: timer #1 [processed 0 triggers, 0 events in 0.005906 sec, 0 maintenances in 0.000000 sec, idle 29 sec] zabbix 1427 0.0 0.1 254808 2904 ? S 20:25 0:00 /usr/sbin/zabbix_server: http poller #1 [got 0 values in 0.001905 sec, idle 5 sec] zabbix 1429 0.0 0.2 359168 5084 ? S 20:25 0:00 /usr/sbin/zabbix_server: discoverer #1 [processed 0 rules in 0.002436 sec, idle 60 sec] zabbix 1430 0.0 0.1 254808 2888 ? S 20:25 0:00 /usr/sbin/zabbix_server: history syncer #1 [synced 0 items in 0.000002 sec, idle 1 sec] zabbix 1431 0.0 0.1 254808 2888 ? S 20:25 0:00 /usr/sbin/zabbix_server: history syncer #2 [synced 0 items in 0.000002 sec, idle 1 sec] zabbix 1432 0.0 0.1 254808 2888 ? S 20:25 0:00 /usr/sbin/zabbix_server: history syncer #3 [synced 0 items in 0.000001 sec, idle 1 sec] zabbix 1433 0.0 0.1 254808 2888 ? S 20:25 0:00 /usr/sbin/zabbix_server: history syncer #4 [synced 0 items in 0.000002 sec, idle 1 sec] zabbix 1437 0.0 0.2 254808 3828 ? S 20:25 0:00 /usr/sbin/zabbix_server: escalator #1 [processed 0 escalations in 0.002680 sec, idle 3 sec] zabbix 1440 0.0 0.2 254808 3828 ? S 20:25 0:00 /usr/sbin/zabbix_server: proxy poller #1 [exchanged data with 0 proxies in 0.000005 sec, idle 5 sec] zabbix 1442 0.0 0.1 254808 2656 ? S 20:25 0:00 /usr/sbin/zabbix_server: self-monitoring [processed data in 0.000010 sec, idle 1 sec] zabbix 1446 0.0 0.1 254808 2876 ? S 20:25 0:00 /usr/sbin/zabbix_server: task manager [processed 0 task(s) in 0.002907 sec, idle 5 sec] root 1453 0.0 0.0 112724 972 pts/0 S+ 20:25 0:00 grep --color=auto zabbix [root@nginx ~]# netstat -lntp //zabbix-server监听端口是10051 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:22 0.0.0.0:* LISTEN 837/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1193/master tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 1401/zabbix_server tcp6 0 0 :::80 :::* LISTEN 839/httpd tcp6 0 0 :::22 :::* LISTEN 837/sshd tcp6 0 0 ::1:25 :::* LISTEN 1193/master tcp6 0 0 :::10051 :::* LISTEN 1401/zabbix_server tcp6 0 0 :::3306 :::* LISTEN 1091/mysqld
八、配置web界面:打开浏览器输入 192.168.87.128/zabbix,打开zabbix配置页面
点击下一步:检验运行环境,出现fail则须要修正
修改php时区:
[root@nginx ~]# vim /etc/php.ini date.timezone=Asia/Shanghai [root@nginx ~]# systemctl restart httpd //重启httpd便可
从新配置web界面:时区问题解决,继续下一步
配置数据库和zabbix-server的信息
成功完成配置
登陆zabbix服务中心:
登录后修改密码:Administration-->users-->Admin-->ChangePassword:选择中文语言
九、配置B机器,zabbix-agent端:
[root@lgs src]# wget https://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm //下载zabbix的yum源 --2018-07-07 20:57:06-- https://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|:443... 已链接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:13392 (13K) [application/x-redhat-package-manager] 正在保存至: “zabbix-release-3.2-1.el7.noarch.rpm” 100%[=============================================================================================================>] 13,392 --.-K/s 用时 0s 2018-07-07 20:57:08 (159 MB/s) - 已保存 “zabbix-release-3.2-1.el7.noarch.rpm” [13392/13392]) [root@lgs src]# rpm -ivh zabbix-release-3.2-1.el7.noarch.rpm //安装zabbix的yum源 警告:zabbix-release-3.2-1.el7.noarch.rpm: 头V4 RSA/SHA512 Signature, 密钥 ID a14fe591: NOKEY 准备中... ################################# [100%] 正在升级/安装... 1:zabbix-release-3.2-1.el7 ################################# [100%] [root@lgs src]# yum install -y zabbix-agent //安装zabbix-agent包 已加载插件:fastestmirror base | 3.6 kB 00:00:00 epel/x86_64/metalink | 6.7 kB 00:00:00 epel | 3.2 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 zabbix | 2.9 kB 00:00:00 zabbix-non-supported | 951 B 00:00:00 (1/6): extras/7/x86_64/primary_db | 150 kB 00:00:00 (2/6): epel/x86_64/group_gz | 88 kB 00:00:01 (3/6): zabbix/x86_64/primary_db | 87 kB 00:00:02 (4/6): updates/7/x86_64/primary_db | 3.6 MB 00:00:03 (5/6): epel/x86_64/updateinfo | 927 kB 00:00:06 (6/6): epel/x86_64/primary | 3.5 MB 00:00:12 zabbix-non-supported/x86_64/primary | 1.6 kB 00:00:00 Loading mirror speeds from cached hostfile * epel: mirrors.huaweicloud.com epel 12603/12603 zabbix-non-supported 4/4 正在解决依赖关系 --> 正在检查事务 ---> 软件包 zabbix-agent.x86_64.0.3.2.11-1.el7 将被 安装 --> 解决依赖关系完成 依赖关系解决 ======================================================================================================================================================= Package 架构 版本 源 大小 ======================================================================================================================================================= 正在安装: zabbix-agent x86_64 3.2.11-1.el7 zabbix 348 k 事务概要 ======================================================================================================================================================= 安装 1 软件包 总下载量:348 k 安装大小:1.3 M Downloading packages: 警告:/var/cache/yum/x86_64/7/zabbix/packages/zabbix-agent-3.2.11-1.el7.x86_64.rpm: 头V4 RSA/SHA512 Signature, 密钥 ID a14fe591: NOKEYkB 00:00:00 ETA zabbix-agent-3.2.11-1.el7.x86_64.rpm 的公钥还没有安装 zabbix-agent-3.2.11-1.el7.x86_64.rpm | 348 kB 00:00:04 从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 检索密钥 导入 GPG key 0xA14FE591: 用户ID : "Zabbix LLC <packager@zabbix.com>" 指纹 : a184 8f53 52d0 22b9 471d 83d0 082a b56b a14f e591 软件包 : zabbix-release-3.2-1.el7.noarch (installed) 来自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 Running transaction check Running transaction test Transaction test succeeded Running transaction 警告:RPM 数据库已被非 yum 程序修改。 正在安装 : zabbix-agent-3.2.11-1.el7.x86_64 1/1 验证中 : zabbix-agent-3.2.11-1.el7.x86_64 1/1 已安装: zabbix-agent.x86_64 0:3.2.11-1.el7 完毕!
十、配置B机器的zabbix-agent的配置文件:指定zabbix服务端的信息等
[root@lgs src]# vim /etc/zabbix/zabbix_agentd.conf Server=192.168.87.128 //服务端的ip,只开启这个选项, 表明是被动模式,服务端过来抓取数据 ServerActive=192.168.87.128 //服务端的ip,开启这个选项,表明是主动模式,agent主动上报agent的数据 Hostname=lgs-zabbix //zabbix服务定义的hostname [root@lgs src]# systemctl start zabbix-agent //启动zabbix-agent [root@lgs src]# systemctl enable zabbix-agent //打开开机启动zabbix-agent Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
进去mysql,直接修改zabbix库的users表的密码信息:
mysql> use zabbix Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> show tables -> ; +----------------------------+ | Tables_in_zabbix | +----------------------------+ | acknowledges | | actions | | alerts | | application_discovery | | application_prototype | | application_template | | applications | | auditlog | | auditlog_details | | autoreg_host | | conditions | | config | | corr_condition | | corr_condition_group | | corr_condition_tag | | corr_condition_tagpair | | corr_condition_tagvalue | | corr_operation | | correlation | | dbversion | | dchecks | | dhosts | | drules | | dservices | | escalations | | event_recovery | | event_tag | | events | | expressions | | functions | | globalmacro | | globalvars | | graph_discovery | | graph_theme | | graphs | | graphs_items | | group_discovery | | group_prototype | | groups | | history | | history_log | | history_str | | history_text | | history_uint | | host_discovery | | host_inventory | | hostmacro | | hosts | | hosts_groups | | hosts_templates | | housekeeper | | httpstep | | httpstepitem | | httptest | | httptestitem | | icon_map | | icon_mapping | | ids | | images | | interface | | interface_discovery | | item_application_prototype | | item_condition | | item_discovery | | items | | items_applications | | maintenances | | maintenances_groups | | maintenances_hosts | | maintenances_windows | | mappings | | media | | media_type | | opcommand | | opcommand_grp | | opcommand_hst | | opconditions | | operations | | opgroup | | opinventory | | opmessage | | opmessage_grp | | opmessage_usr | | optemplate | | problem | | problem_tag | | profiles | | proxy_autoreg_host | | proxy_dhistory | | proxy_history | | regexps | | rights | | screen_user | | screen_usrgrp | | screens | | screens_items | | scripts | | service_alarms | | services | | services_links | | services_times | | sessions | | slides | | slideshow_user | | slideshow_usrgrp | | slideshows | | sysmap_element_url | | sysmap_url | | sysmap_user | | sysmap_usrgrp | | sysmaps | | sysmaps_elements | | sysmaps_link_triggers | | sysmaps_links | | task | | task_close_problem | | timeperiods | | trends | | trends_uint | | trigger_depends | | trigger_discovery | | trigger_tag | | triggers | | users | | users_groups | | usrgrp | | valuemaps | +----------------------------+ 127 rows in set (0.00 sec) mysql> desc users; +----------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+---------------------+------+-----+---------+-------+ | userid | bigint(20) unsigned | NO | PRI | NULL | | | alias | varchar(100) | NO | UNI | | | | name | varchar(100) | NO | | | | | surname | varchar(100) | NO | | | | | passwd | char(32) | NO | | | | | url | varchar(255) | NO | | | | | autologin | int(11) | NO | | 0 | | | autologout | int(11) | NO | | 900 | | | lang | varchar(5) | NO | | en_GB | | | refresh | int(11) | NO | | 30 | | | type | int(11) | NO | | 1 | | | theme | varchar(128) | NO | | default | | | attempt_failed | int(11) | NO | | 0 | | | attempt_ip | varchar(39) | NO | | | | | attempt_clock | int(11) | NO | | 0 | | | rows_per_page | int(11) | NO | | 50 | | +----------------+---------------------+------+-----+---------+-------+ 16 rows in set (0.00 sec) mysql> update users set passwd=md5('961303') where alias='Admin'; //直接更新Admin用户的密码便可。 Query OK, 1 row affected (0.02 sec) Rows matched: 1 Changed: 1 Warnings: 0
修改后从新用新密码登陆。