标签:压缩 名称 var unsigned nis enable proc blog inf
19.1 Linux监控平台介绍安装zabbix
[root@qingyun-01 ~]# rpm -i http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm 警告:/var/tmp/rpm-tmp.8EUWZ1: 头V4 RSA/SHA512 Signature, 密钥 ID a14fe591: NOKEY
#官网有附带教程
[root@qingyun-01 ~]# yum install -y zabbix-agent zabbix-get zabbix-server-mysql zabbix-web zabbix-web-mysql
#启动mysql
[root@qingyun-01 mysql]# /etc/init.d/mysqld start
vim /etc/my.cnf //需要增加配置
character_set_server = utf8
[root@qingyun-01 mysql]# systemctl restart 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 ‘qingyunzabbix‘;
Query OK, 0 rows affected (0.02 sec)
#让zabbix web 服务可以连接数据库
#进入该目录
[root@qingyun-01 mysql]# cd /usr/share/doc/zabbix-server-mysql-3.2.11/
#压缩包需要解压一下
[root@qingyun-01 zabbix-server-mysql-3.2.11]# ls
AUTHORS ChangeLog COPYING create.sql.gz NEWS README
[root@qingyun-01 zabbix-server-mysql-3.2.11]# gzip -d create.sql.gz
[root@qingyun-01 zabbix-server-mysql-3.2.11]# ls
AUTHORS ChangeLog COPYING create.sql NEWS README
#导入库里面
[root@qingyun-01 zabbix-server-mysql-3.2.11]# mysql -uroot zabbix < create.sql
[root@qingyun-01 zabbix-server-mysql-3.2.11]# systemctl start zabbix-server
#检查zabbix服务
[root@qingyun-01 zabbix-server-mysql-3.2.11]# ps aux |grep zabbix
zabbix 2267 0.0 0.3 254580 3496 ? S 16:41 0:00 /usr/sbin/zabbix_server -c /etc/zabbix/zabbi_server.conf
root 2270 0.0 0.0 112676 984 pts/0 R+ 16:41 0:00 grep --color=auto zabbix
#如果之前安装过Nginx,需要先检查是否启动
[root@qingyun-01 zabbix-server-mysql-3.2.11]# ps aux | grep nginx
root 2272 0.0 0.0 112676 980 pts/0 R+ 16:41 0:00 grep --color=auto nginx
#启动httpd 并 ps
[root@qingyun-01 zabbix-server-mysql-3.2.11]# systemctl start httpd
[root@qingyun-01 zabbix-server-mysql-3.2.11]# ps aux |grep httpd
root 2279 0.3 1.5 394412 15456 ? Ss 16:42 0:00 /usr/sbin/httpd -DFOREGROUND
apache 2287 0.0 0.7 394544 7692 ? S 16:42 0:00 /usr/sbin/httpd -DFOREGROUND
apache 2288 0.0 0.7 394544 7692 ? S 16:42 0:00 /usr/sbin/httpd -DFOREGROUND
apache 2289 0.0 0.7 394544 7692 ? S 16:42 0:00 /usr/sbin/httpd -DFOREGROUND
apache 2290 0.0 0.7 394544 7692 ? S 16:42 0:00 /usr/sbin/httpd -DFOREGROUND
apache 2291 0.0 0.7 394544 7692 ? S 16:42 0:00 /usr/sbin/httpd -DFOREGROUND
root 2293 0.0 0.0 112676 984 pts/0 R+ 16:42 0:00 grep --color=auto httpd
#查看是否监听80端口
[root@qingyun-01 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 934/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1018/master
tcp6 0 0 :::80 :::* LISTEN 2279/httpd
tcp6 0 0 :::22 :::* LISTEN 934/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1018/master
tcp6 0 0 :::3306 :::* LISTEN 1845/mysqld
[root@qingyun-01 zabbix-server-mysql-3.2.11]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@qingyun-01 zabbix-server-mysql-3.2.11]# systemctl enable zabbix-server
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
#如果安装过Nginx 需要停掉
[root@qingyun-01 zabbix-server-mysql-3.2.11]# systemctl disable nginx
#通过查看监听端口,发现没有监听端口
#需要查看日志排查问题
[root@qingyun-01 ~]# less /var/log/zabbix/zabbix_server.log
#编辑配置文件之后,需要重启服务,加载配置文件
[root@qingyun-01 ~]# systemctl restart zabbix-server
[root@qingyun-01 ~]# ps aux |grep zabbix
[root@qingyun-01 ~]# netstat -lntp |grep zabbix
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 2375/zabbix_server
tcp6 0 0 :::10051 :::* LISTEN 2375/zabbix_server
#设置时区
[root@qingyun-01 ~]# vim /etc/php.ini
#编辑好配置文件后,重启httpd
[root@qingyun-01 ~]# systemctl restart httpd
#重启完成后,刷新将不报错
用户名admin 密码zabbix
备注:修改完密码后,可以设置成中文显示。
zabbix客户端安装
#下载yum源
[root@qingyun-02 ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
获取http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
警告:/var/tmp/rpm-tmp.JZlW14: 头V4 RSA/SHA512 Signature, 密钥 ID a14fe591: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:zabbix-release-3.2-1.el7 ################################# [100%]
#安装
[root@qingyun-02 ~]# yum install -y zabbix-agent
#编辑配置文件
[root@qingyun-02 ~]# vim /etc/zabbix/zabbix_agentd.conf
内容如下
Server 配置被动模式
配置监控中心的ip
ServerActive 配置主动模式
设置客户端名称
[root@qingyun-02 ~]# systemctl start zabbix-agent
[root@qingyun-02 ~]# ps aux |grep zabbix
zabbix 1180 0.0 0.1 80664 1264 ? S 17:54 0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbi_agentd.conf
zabbix 1181 0.0 0.1 80664 1300 ? S 17:54 0:00 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
zabbix 1182 0.0 0.1 80664 1848 ? S 17:54 0:00 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
zabbix 1183 0.0 0.1 80664 1848 ? S 17:54 0:00 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
zabbix 1184 0.0 0.1 80664 1848 ? S 17:54 0:00 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
zabbix 1185 0.0 0.2 80796 2196 ? S 17:54 0:00 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
root 1187 0.0 0.0 112676 984 pts/0 R+ 17:54 0:00 grep --color=auto zabbix
[root@qingyun-02 ~]# 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:80 0.0.0.0:* LISTEN 932/nginx: master p
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 917/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1010/master
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 1180/zabbix_agentd
tcp6 0 0 :::22 :::* LISTEN 917/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1010/master
tcp6 0 0 :::10050 :::* LISTEN 1180/zabbix_agentd
#登录数据库
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> 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.03 sec)
#修改密码的命令
mysql> update users set passwd=md5(‘qingyun1‘) 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 | 4e5a9284849f3af9ece4a2892b97dabb | | 1 | 0 | en_GB | 30 | 3 | default | 6 | 192.168.21.1 | 1517391222 | 50 |
| 2 | guest | | | d41d8cd98f00b204e9800998ecf8427e | | 0 | 900 | en_GB | 30 | 1 | default | 0 | | 0 | 50 |
+--------+-------+--------+---------------+----------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+--------------+---------------+---------------+
2 rows in set (0.00 sec)
* 这样子就更改了Admin用户密码
![](http://i2.51cto.com/images/blog/201801/31/34271b7457735c8a46af12ad355d8923.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
Linux监控平台介绍、zabbix监控介绍、安装zabbix、忘记Admin密码如何做
标签:压缩 名称 var unsigned nis enable proc blog inf
原文地址:http://blog.51cto.com/3622288/2067431