19.1 Linux监控平台介绍

我们不能指望每次都通过用户反馈来监控我们的服务,我们必须要有自己的监控平台来监控我们的服务。

常见开源监控软件:

  1.  cacti、smokeping偏向于基础监控,成图非常漂亮
  2.  cacti、nagios、zabbix服务端监控中心,需要php环境支持,其中zabbix和cacti都需要mysql作为数据存储,nagios不用存储历史数据,注重服务或者监控项的状态,zabbix会获取服务或者监控项目的数据,会把数据记录到数据库里,从而可以成图
  3.  open-falcon为小米公司开发,他们最早使用的zabbix,但是zabbix不能非常个性化的支持他们的业务,因此借鉴了zabbix开发了open-falcon,开源后受到诸多大公司和运维工程师的追捧,适合大企业,滴滴、360、新浪微博、京东等大公司在使用这款监控软件,值得研究。

后续以介绍zabbix为主,因为它的监控思想非常优秀。
zabbix不仅仅关心状态,还会把数据记录到数据库里,还可以在浏览器上便捷操作。



19.2 zabbix监控介绍

C/S架构,基于C++开发,速度很快,监控中心支持web界面配置和管理。
单server节点可以支持上万台客户端。当然,如果客户端上要监控的东西太多,还是可以增加很多proxy。
最新版本3.4,官方文档https://www.zabbix.com/manuals,这是最好的学习手册。
一共5个组件:

  1.  zabbix-server 监控中心,接收客户端上报信息,负责配置、统计、操作数据
  2.  数据存储 存放数据,比如mysql
  3.  web界面 也叫web UI,在web界面下操作配置是zabbix简单易用的主要原因
  4.  zabbix-proxy 可选组件,它可以代替zabbix-server的功能,减轻server的压力,适用于监控小局域网内的内容在汇聚给server
  5.  zabbix-agent 客户端软件,负责采集各个监控服务或项目的数据,并上报

流程图:

类似于zabbix的东西_数据库

想要监控一个服务器,肯定要添加这个主机到监控中心,添加监控的项目,这时候zabbix就会采集数据,存入数据库。zabbix可以主动或者被动接受数据,然后对告警trigger分析,然后决定是否告警。web界面可以显示告警,显示正在交互的数据。



19.3/4/6 安装zabbix

之后的实验我们要准备两台机器,一台作为服务端,另一台作为客户端。

官网下载页面选择自己需求的版本。

[root@localhost: ~]# rpm -i https://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
warning: /var/tmp/rpm-tmp.aoCwYW: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
[root@localhost: ~]# cat /etc/yum.repos.d/zabbix.repo 
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=http://repo.zabbix.com/zabbix/3.4/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch 
baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1

安装之后它会自动给你添加一个yum的源,然后用yum安装以下插件。

[root@localhost: ~]# yum install -y zabbix-agent zabbix-get zabbix-server-mysql zabbix-web zabbix-web-mysql

客户端只需要安装agent就可以

[root@clone2: ~]#  yum install -y zabbix-agent

这期间会自动安装httpd和php。

如果没有mysql的话,需要按照LAMP那一章的方法安装mysql。

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

character_set_server = utf8

添加一行默认字符集,否则如果你的界面是中文的话显示可能不正确。

[root@localhost: ~]# /etc/init.d/mysqld restart 
Shutting down MySQL.. SUCCESS! 
Starting MySQL. SUCCESS! 
[root@localhost: ~]# mysql -uroot -p123r
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.41-log Source distribution

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
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 'zabbix';
Query OK, 0 rows affected (0.01 sec)

重启mysqld服务,创建zabbix库。

[root@localhost: ~]# cd /usr/share/doc/z
zabbix-agent-3.4.13/        zabbix-release-3.4/         zabbix-web-3.4.13/          zlib-1.2.7/                 zsh-5.0.2/                  
zabbix-get-3.4.13/          zabbix-server-mysql-3.4.13/ zip-3.0/                    zlib-devel-1.2.7/           
[root@localhost: ~]# cd /usr/share/doc/zabbix-server-mysql-3.4.13/
[root@localhost: zabbix-server-mysql-3.4.13]# ls
AUTHORS  ChangeLog  COPYING  create.sql.gz  NEWS  README
[root@localhost: zabbix-server-mysql-3.4.13]#

进入zabbix的默认数据,解压导入数据库。

[root@localhost: zabbix-server-mysql-3.4.13]# gzip -d create.sql.gz 
[root@localhost: zabbix-server-mysql-3.4.13]# ls
AUTHORS  ChangeLog  COPYING  create.sql  NEWS  README
[root@localhost: zabbix-server-mysql-3.4.13]# mysql -uroot -p123r zabbix < create.sql 
Warning: Using a password on the command line interface can be insecure.

启动zabbix-server服务和httpd服务。

[root@localhost: zabbix-server-mysql-3.4.13]# systemctl start httpd
[root@localhost: zabbix-server-mysql-3.4.13]# systemctl start zabbix-server.service 
[root@localhost: zabbix-server-mysql-3.4.13]# ps aux | grep zabbix
zabbix    2181  0.0  0.0 259472  3396 ?        S    17:41   0:00 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf
root      2184  0.0  0.0 112708   980 pts/0    S+   17:41   0:00 grep --color=auto zabbix
[root@localhost: zabbix-server-mysql-3.4.13]# 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:2049            0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:48942           0.0.0.0:*               LISTEN      1039/rpc.statd      
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      639/rpcbind         
tcp        0      0 0.0.0.0:20048           0.0.0.0:*               LISTEN      1040/rpc.mountd     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1030/sshd           
tcp        0      0 0.0.0.0:40791           0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1455/master         
tcp6       0      0 :::2049                 :::*                    LISTEN      -                   
tcp6       0      0 :::42056                :::*                    LISTEN      1039/rpc.statd      
tcp6       0      0 :::3306                 :::*                    LISTEN      2017/mysqld         
tcp6       0      0 :::111                  :::*                    LISTEN      639/rpcbind         
tcp6       0      0 :::80                   :::*                    LISTEN      2115/httpd          
tcp6       0      0 :::20048                :::*                    LISTEN      1040/rpc.mountd     
tcp6       0      0 :::37810                :::*                    LISTEN      -                   
tcp6       0      0 :::22                   :::*                    LISTEN      1030/sshd           
tcp6       0      0 ::1:25                  :::*                    LISTEN      1455/master

发现端口并没有被监听,问题排查:

[root@localhost: zabbix-server-mysql-3.4.13]# vim /var/log/zabbix/zabbix_server.log 


 2181:20180912:174310.045 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
  2181:20180912:174310.045 database is down: reconnecting in 10 seconds

发现zabbix没有找到sock文件,无法与mysql通信。

[root@localhost: zabbix-server-mysql-3.4.13]# vim /etc/zabbix/zabbix_server.conf

DBHost=localhost #创建mysql用户授权时候一定要授权给web应用的ip,和DBHost不一样
DBPassword=zabbix
DBSocket=/tmp/mysql.sock
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';

重启服务

[root@localhost: zabbix-server-mysql-3.4.13]# !ps
ps aux | grep zabbix
zabbix    3717  1.3  0.1 259576  4212 ?        S    20:06   0:00 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf
zabbix    3719  0.0  0.0 259576  2536 ?        S    20:06   0:00 /usr/sbin/zabbix_server: configuration syncer [waiting 60 sec for processes]
zabbix    3720  0.0  0.0 259576  2536 ?        S    20:06   0:00 /usr/sbin/zabbix_server: alerter #1 started
zabbix    3721  0.0  0.0 259576  2536 ?        S    20:06   0:00 /usr/sbin/zabbix_server: alerter #2 started
zabbix    3722  0.0  0.0 259576  2536 ?        S    20:06   0:00 /usr/sbin/zabbix_server: alerter #3 started
zabbix    3723  0.0  0.0 259576  2536 ?        S    20:06   0:00 /usr/sbin/zabbix_server: housekeeper [startup idle for 30 minutes]
zabbix    3724  0.0  0.0 259656  2948 ?        S    20:06   0:00 /usr/sbin/zabbix_server: timer #1 [processed 0 triggers, 0 events in 0.000067 sec, 0 maintenances in 0.000000 sec, idle 30 sec]
zabbix    3725  0.0  0.0 259576  2756 ?        S    20:06   0:00 /usr/sbin/zabbix_server: http poller #1 [got 0 values in 0.000260 sec, idle 5 sec]
zabbix    3726  0.6  0.1 363936  5132 ?        S    20:06   0:00 /usr/sbin/zabbix_server: discoverer #1 [processed 0 rules in 0.000257 sec, idle 60 sec]
zabbix    3727  0.0  0.0 259576  2876 ?        S    20:06   0:00 /usr/sbin/zabbix_server: history syncer #1 [synced 0 items in 0.000000 sec, idle 1 sec]
zabbix    3728  0.0  0.0 259576  2876 ?        S    20:06   0:00 /usr/sbin/zabbix_server: history syncer #2 [synced 0 items in 0.000001 sec, idle 1 sec]
zabbix    3729  0.0  0.0 259576  2876 ?        S    20:06   0:00 /usr/sbin/zabbix_server: history syncer #3 [synced 0 items in 0.000001 sec, idle 1 sec]
zabbix    3730  0.0  0.0 259576  2876 ?        S    20:06   0:00 /usr/sbin/zabbix_server: history syncer #4 [synced 0 items in 0.000000 sec, idle 1 sec]
zabbix    3731  0.0  0.0 259576  3640 ?        S    20:06   0:00 /usr/sbin/zabbix_server: escalator #1 [processed 0 escalations in 0.000354 sec, idle 3 sec]
zabbix    3732  0.0  0.0 259576  3640 ?        S    20:06   0:00 /usr/sbin/zabbix_server: proxy poller #1 [exchanged data with 0 proxies in 0.000019 sec, idle 5 sec]
zabbix    3733  0.0  0.0 259576  2692 ?        S    20:06   0:00 /usr/sbin/zabbix_server: self-monitoring [processed data in 0.000005 sec, idle 1 sec]
zabbix    3734  0.0  0.0 259576  2872 ?        S    20:06   0:00 /usr/sbin/zabbix_server: task manager [processed 0 task(s) in 0.000834 sec, idle 5 sec]
zabbix    3735  0.3  0.1 366556  5132 ?        S    20:06   0:00 /usr/sbin/zabbix_server: poller #1 [got 0 values in 0.000036 sec, idle 5 sec]
zabbix    3736  1.0  0.1 366556  5132 ?        S    20:06   0:00 /usr/sbin/zabbix_server: poller #2 [got 0 values in 0.000020 sec, idle 5 sec]
zabbix    3737  0.3  0.1 366556  5132 ?        S    20:06   0:00 /usr/sbin/zabbix_server: poller #3 [got 0 values in 0.000036 sec, idle 5 sec]
zabbix    3738  0.3  0.1 366556  5132 ?        S    20:06   0:00 /usr/sbin/zabbix_server: poller #4 [got 0 values in 0.000019 sec, idle 5 sec]
zabbix    3739  0.0  0.1 366556  5132 ?        S    20:06   0:00 /usr/sbin/zabbix_server: poller #5 [got 0 values in 0.000020 sec, idle 5 sec]
zabbix    3740  0.3  0.1 366556  5132 ?        S    20:06   0:00 /usr/sbin/zabbix_server: unreachable poller #1 [got 0 values in 0.000019 sec, idle 5 sec]
zabbix    3741  0.0  0.0 259576  3640 ?        S    20:06   0:00 /usr/sbin/zabbix_server: trapper #1 [processed data in 0.000000 sec, waiting for connection]
zabbix    3742  0.0  0.0 259576  3640 ?        S    20:06   0:00 /usr/sbin/zabbix_server: trapper #2 [processed data in 0.000000 sec, waiting for connection]
zabbix    3743  0.0  0.0 259576  3640 ?        S    20:06   0:00 /usr/sbin/zabbix_server: trapper #3 [processed data in 0.000000 sec, waiting for connection]
zabbix    3744  0.0  0.0 259576  3640 ?        S    20:06   0:00 /usr/sbin/zabbix_server: trapper #4 [processed data in 0.000000 sec, waiting for connection]
zabbix    3745  0.0  0.0 259576  3640 ?        S    20:06   0:00 /usr/sbin/zabbix_server: trapper #5 [processed data in 0.000000 sec, waiting for connection]
zabbix    3746  0.0  0.0 262188  2536 ?        S    20:06   0:00 /usr/sbin/zabbix_server: icmp pinger #1 [got 0 values in 0.000096 sec, idle 5 sec]
zabbix    3747  0.0  0.0 259576  3288 ?        S    20:06   0:00 /usr/sbin/zabbix_server: alert manager #1 started
zabbix    3748  0.0  0.0 259576  3092 ?        S    20:06   0:00 /usr/sbin/zabbix_server: preprocessing manager #1 started
zabbix    3749  0.0  0.0 259576  2596 ?        S    20:06   0:00 /usr/sbin/zabbix_server: preprocessing worker #1 started
zabbix    3759  0.0  0.0 259576  2596 ?        S    20:06   0:00 /usr/sbin/zabbix_server: preprocessing worker #2 started
zabbix    3760  0.0  0.0 259576  2596 ?        S    20:06   0:00 /usr/sbin/zabbix_server: preprocessing worker #3 started
root      3766  0.0  0.0 112712   980 pts/0    S+   20:06   0:00 grep --color=auto zabbix
[root@localhost: zabbix-server-mysql-3.4.13]# !net
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:2049            0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:10051           0.0.0.0:*               LISTEN      3717/zabbix_server  
tcp        0      0 0.0.0.0:48942           0.0.0.0:*               LISTEN      1039/rpc.statd      
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      639/rpcbind         
tcp        0      0 0.0.0.0:20048           0.0.0.0:*               LISTEN      1040/rpc.mountd     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1030/sshd           
tcp        0      0 0.0.0.0:40791           0.0.0.0:*               LISTEN      -                   
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1455/master         
tcp6       0      0 :::2049                 :::*                    LISTEN      -                   
tcp6       0      0 :::10051                :::*                    LISTEN      3717/zabbix_server  
tcp6       0      0 :::42056                :::*                    LISTEN      1039/rpc.statd      
tcp6       0      0 :::3306                 :::*                    LISTEN      3518/mysqld         
tcp6       0      0 :::111                  :::*                    LISTEN      639/rpcbind         
tcp6       0      0 :::80                   :::*                    LISTEN      2115/httpd          
tcp6       0      0 :::20048                :::*                    LISTEN      1040/rpc.mountd     
tcp6       0      0 :::37810                :::*                    LISTEN      -                   
tcp6       0      0 :::22                   :::*                    LISTEN      1030/sshd           
tcp6       0      0 ::1:25                  :::*                    LISTEN      1455/master

这时候10051端口监听出现。

类似于zabbix的东西_类似于zabbix的东西_02

浏览器访问ip/zabbix/就可以直接进web安装界面了。

类似于zabbix的东西_mysql_03

第二步要检查fail项。

[root@localhost: zabbix-server-mysql-3.4.13]# vim /etc/php.ini 
[root@localhost: zabbix-server-mysql-3.4.13]# systemctl restart httpd

刷新网页,全部OK.

类似于zabbix的东西_数据库_04

填写数据库相关信息,

类似于zabbix的东西_数据库_05

类似于zabbix的东西_开发工具_06

安装完成后,默认用户名是admin,密码是zabbix。

类似于zabbix的东西_mysql_07

更改密码

类似于zabbix的东西_类似于zabbix的东西_08

主界面如下

类似于zabbix的东西_mysql_09

因为没有加入监控主机,暂时没有数据。

下面介绍客户端配置文件:

首先要设置server的白名单,否则任何ip都能监控就不安全了。

[root@clone2: ~]# vim /etc/zabbix/zabbix_agentd.conf 

Server=192.168.127.101 ##被动模式

ServerActive=192.168.127.101  ##主动模式

Hostname=zabbix-clone2 ##这个名字会在web客户端显示名字

启动服务之后,agent监听的端口是10050

[root@clone2: ~]# systemctl start zabbix-agent.service 
[root@clone2: ~]# ps aux | grep zabbix
zabbix    2255  0.0  0.0  83024  1284 ?        S    00:33   0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
zabbix    2256  0.0  0.0  83024  1448 ?        S    00:33   0:00 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
zabbix    2257  0.0  0.0  83024  1844 ?        S    00:33   0:00 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
zabbix    2258  0.0  0.0  83024  1844 ?        S    00:33   0:00 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
zabbix    2259  0.0  0.0  83024  1844 ?        S    00:33   0:00 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
zabbix    2260  0.0  0.0  83156  2228 ?        S    00:33   0:00 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
root      2262  0.0  0.0 112708   976 pts/0    S+   00:33   0:00 grep --color=auto zabbix
[root@clone2: ~]# 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:10050           0.0.0.0:*               LISTEN      2255/zabbix_agentd  
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      616/rpcbind         
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      953/sshd            
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1314/master         
tcp6       0      0 :::10050                :::*                    LISTEN      2255/zabbix_agentd  
tcp6       0      0 :::3306                 :::*                    LISTEN      1270/mysqld         
tcp6       0      0 :::111                  :::*                    LISTEN      616/rpcbind         
tcp6       0      0 :::22                   :::*                    LISTEN      953/sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      1314/master

做到这里所有的准备工作就完成了。



19.5 忘记Admin密码如何做

浏览器记录的密码被清空,而又忘记了管理员密码,我们可以登录数据库更改密码。

[root@localhost: zabbix-server-mysql-3.4.13]# mysql -uroot -p123r
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 202
Server version: 5.6.41-log Source distribution

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

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\G
*************************** 1. row ***************************
Tables_in_zabbix: acknowledges
*************************** 2. row ***************************
Tables_in_zabbix: actions
*************************** 3. row ***************************
Tables_in_zabbix: alerts
*************************** 4. row ***************************
Tables_in_zabbix: application_discovery
*************************** 5. row ***************************
Tables_in_zabbix: application_prototype
*************************** 6. row ***************************
Tables_in_zabbix: application_template
*************************** 7. row ***************************
Tables_in_zabbix: applications
*************************** 8. row ***************************
Tables_in_zabbix: auditlog
*************************** 9. row ***************************
Tables_in_zabbix: auditlog_details
*************************** 10. row ***************************
Tables_in_zabbix: autoreg_host
*************************** 11. row ***************************
Tables_in_zabbix: conditions
*************************** 12. row ***************************
Tables_in_zabbix: config
*************************** 13. row ***************************
Tables_in_zabbix: corr_condition
*************************** 14. row ***************************
Tables_in_zabbix: corr_condition_group
*************************** 15. row ***************************
Tables_in_zabbix: corr_condition_tag
*************************** 16. row ***************************
Tables_in_zabbix: corr_condition_tagpair
*************************** 17. row ***************************
Tables_in_zabbix: corr_condition_tagvalue
*************************** 18. row ***************************
Tables_in_zabbix: corr_operation
*************************** 19. row ***************************
Tables_in_zabbix: correlation
*************************** 20. row ***************************
Tables_in_zabbix: dashboard
*************************** 21. row ***************************
Tables_in_zabbix: dashboard_user
*************************** 22. row ***************************
Tables_in_zabbix: dashboard_usrgrp
*************************** 23. row ***************************
Tables_in_zabbix: dbversion
*************************** 24. row ***************************
Tables_in_zabbix: dchecks
*************************** 25. row ***************************
Tables_in_zabbix: dhosts
*************************** 26. row ***************************
Tables_in_zabbix: drules
*************************** 27. row ***************************
Tables_in_zabbix: dservices
*************************** 28. row ***************************
Tables_in_zabbix: escalations
*************************** 29. row ***************************
Tables_in_zabbix: event_recovery
*************************** 30. row ***************************
Tables_in_zabbix: event_tag
*************************** 31. row ***************************
Tables_in_zabbix: events
*************************** 32. row ***************************
Tables_in_zabbix: expressions
*************************** 33. row ***************************
Tables_in_zabbix: functions
*************************** 34. row ***************************
Tables_in_zabbix: globalmacro
*************************** 35. row ***************************
Tables_in_zabbix: globalvars
*************************** 36. row ***************************
Tables_in_zabbix: graph_discovery
*************************** 37. row ***************************
Tables_in_zabbix: graph_theme
*************************** 38. row ***************************
Tables_in_zabbix: graphs
*************************** 39. row ***************************
Tables_in_zabbix: graphs_items
*************************** 40. row ***************************
Tables_in_zabbix: group_discovery
*************************** 41. row ***************************
Tables_in_zabbix: group_prototype
*************************** 42. row ***************************
Tables_in_zabbix: groups
*************************** 43. row ***************************
Tables_in_zabbix: history
*************************** 44. row ***************************
Tables_in_zabbix: history_log
*************************** 45. row ***************************
Tables_in_zabbix: history_str
*************************** 46. row ***************************
Tables_in_zabbix: history_text
*************************** 47. row ***************************
Tables_in_zabbix: history_uint
*************************** 48. row ***************************
Tables_in_zabbix: host_discovery
*************************** 49. row ***************************
Tables_in_zabbix: host_inventory
*************************** 50. row ***************************
Tables_in_zabbix: hostmacro
*************************** 51. row ***************************
Tables_in_zabbix: hosts
*************************** 52. row ***************************
Tables_in_zabbix: hosts_groups
*************************** 53. row ***************************
Tables_in_zabbix: hosts_templates
*************************** 54. row ***************************
Tables_in_zabbix: housekeeper
*************************** 55. row ***************************
Tables_in_zabbix: httpstep
*************************** 56. row ***************************
Tables_in_zabbix: httpstep_field
*************************** 57. row ***************************
Tables_in_zabbix: httpstepitem
*************************** 58. row ***************************
Tables_in_zabbix: httptest
*************************** 59. row ***************************
Tables_in_zabbix: httptest_field
*************************** 60. row ***************************
Tables_in_zabbix: httptestitem
*************************** 61. row ***************************
Tables_in_zabbix: icon_map
*************************** 62. row ***************************
Tables_in_zabbix: icon_mapping
*************************** 63. row ***************************
Tables_in_zabbix: ids
*************************** 64. row ***************************
Tables_in_zabbix: images
*************************** 65. row ***************************
Tables_in_zabbix: interface
*************************** 66. row ***************************
Tables_in_zabbix: interface_discovery
*************************** 67. row ***************************
Tables_in_zabbix: item_application_prototype
*************************** 68. row ***************************
Tables_in_zabbix: item_condition
*************************** 69. row ***************************
Tables_in_zabbix: item_discovery
*************************** 70. row ***************************
Tables_in_zabbix: item_preproc
*************************** 71. row ***************************
Tables_in_zabbix: items
*************************** 72. row ***************************
Tables_in_zabbix: items_applications
*************************** 73. row ***************************
Tables_in_zabbix: maintenances
*************************** 74. row ***************************
Tables_in_zabbix: maintenances_groups
*************************** 75. row ***************************
Tables_in_zabbix: maintenances_hosts
*************************** 76. row ***************************
Tables_in_zabbix: maintenances_windows
*************************** 77. row ***************************
Tables_in_zabbix: mappings
*************************** 78. row ***************************
Tables_in_zabbix: media
*************************** 79. row ***************************
Tables_in_zabbix: media_type
*************************** 80. row ***************************
Tables_in_zabbix: opcommand
*************************** 81. row ***************************
Tables_in_zabbix: opcommand_grp
*************************** 82. row ***************************
Tables_in_zabbix: opcommand_hst
*************************** 83. row ***************************
Tables_in_zabbix: opconditions
*************************** 84. row ***************************
Tables_in_zabbix: operations
*************************** 85. row ***************************
Tables_in_zabbix: opgroup
*************************** 86. row ***************************
Tables_in_zabbix: opinventory
*************************** 87. row ***************************
Tables_in_zabbix: opmessage
*************************** 88. row ***************************
Tables_in_zabbix: opmessage_grp
*************************** 89. row ***************************
Tables_in_zabbix: opmessage_usr
*************************** 90. row ***************************
Tables_in_zabbix: optemplate
*************************** 91. row ***************************
Tables_in_zabbix: problem
*************************** 92. row ***************************
Tables_in_zabbix: problem_tag
*************************** 93. row ***************************
Tables_in_zabbix: profiles
*************************** 94. row ***************************
Tables_in_zabbix: proxy_autoreg_host
*************************** 95. row ***************************
Tables_in_zabbix: proxy_dhistory
*************************** 96. row ***************************
Tables_in_zabbix: proxy_history
*************************** 97. row ***************************
Tables_in_zabbix: regexps
*************************** 98. row ***************************
Tables_in_zabbix: rights
*************************** 99. row ***************************
Tables_in_zabbix: screen_user
*************************** 100. row ***************************
Tables_in_zabbix: screen_usrgrp
*************************** 101. row ***************************
Tables_in_zabbix: screens
*************************** 102. row ***************************
Tables_in_zabbix: screens_items
*************************** 103. row ***************************
Tables_in_zabbix: scripts
*************************** 104. row ***************************
Tables_in_zabbix: service_alarms
*************************** 105. row ***************************
Tables_in_zabbix: services
*************************** 106. row ***************************
Tables_in_zabbix: services_links
*************************** 107. row ***************************
Tables_in_zabbix: services_times
*************************** 108. row ***************************
Tables_in_zabbix: sessions
*************************** 109. row ***************************
Tables_in_zabbix: slides
*************************** 110. row ***************************
Tables_in_zabbix: slideshow_user
*************************** 111. row ***************************
Tables_in_zabbix: slideshow_usrgrp
*************************** 112. row ***************************
Tables_in_zabbix: slideshows
*************************** 113. row ***************************
Tables_in_zabbix: sysmap_element_trigger
*************************** 114. row ***************************
Tables_in_zabbix: sysmap_element_url
*************************** 115. row ***************************
Tables_in_zabbix: sysmap_shape
*************************** 116. row ***************************
Tables_in_zabbix: sysmap_url
*************************** 117. row ***************************
Tables_in_zabbix: sysmap_user
*************************** 118. row ***************************
Tables_in_zabbix: sysmap_usrgrp
*************************** 119. row ***************************
Tables_in_zabbix: sysmaps
*************************** 120. row ***************************
Tables_in_zabbix: sysmaps_elements
*************************** 121. row ***************************
Tables_in_zabbix: sysmaps_link_triggers
*************************** 122. row ***************************
Tables_in_zabbix: sysmaps_links
*************************** 123. row ***************************
Tables_in_zabbix: task
*************************** 124. row ***************************
Tables_in_zabbix: task_acknowledge
*************************** 125. row ***************************
Tables_in_zabbix: task_close_problem
*************************** 126. row ***************************
Tables_in_zabbix: task_remote_command
*************************** 127. row ***************************
Tables_in_zabbix: task_remote_command_result
*************************** 128. row ***************************
Tables_in_zabbix: timeperiods
*************************** 129. row ***************************
Tables_in_zabbix: trends
*************************** 130. row ***************************
Tables_in_zabbix: trends_uint
*************************** 131. row ***************************
Tables_in_zabbix: trigger_depends
*************************** 132. row ***************************
Tables_in_zabbix: trigger_discovery
*************************** 133. row ***************************
Tables_in_zabbix: trigger_tag
*************************** 134. row ***************************
Tables_in_zabbix: triggers
*************************** 135. row ***************************
Tables_in_zabbix: users
*************************** 136. row ***************************
Tables_in_zabbix: users_groups
*************************** 137. row ***************************
Tables_in_zabbix: usrgrp
*************************** 138. row ***************************
Tables_in_zabbix: valuemaps
*************************** 139. row ***************************
Tables_in_zabbix: widget
*************************** 140. row ***************************
Tables_in_zabbix: widget_field
140 rows in set (0.00 sec)

它的密码存放在users表里,

mysql> update users set passwd=md5('zabbix') where alias='admin'
    -> ;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from users;
+--------+-------+--------+---------------+----------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+------------+---------------+---------------+
| userid | alias | name   | surname       | passwd                           | url | autologin | autologout | lang  | refresh | type | theme   | attempt_failed | attempt_ip | attempt_clock | rows_per_page |
+--------+-------+--------+---------------+----------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+------------+---------------+---------------+
|      1 | Admin | Zabbix | Administrator | 5fce1b3e34b520afeffb37ce08c7cd66 |     |         1 | 0          | en_GB | 30s     |    3 | default |              0 |            |             0 |            50 |
|      2 | guest |        |               | d41d8cd98f00b204e9800998ecf8427e |     |         0 | 15m        | en_GB | 30s     |    1 | default |              0 |            |             0 |            50 |
+--------+-------+--------+---------------+----------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+------------+---------------+---------------+
2 rows in set (0.00 sec)

这样就可以了。