zabbix-----1-----安装
更新yum源为阿里云的,方便安装
安装所需要的安装包:
1
2
|
yum install zabbix-server-mysql zabbix-web-mysql
yum install mariadb-server
|
关闭 NetworkManager 和防火墙
1
2
|
systemctl disable firewalld && systemctl stop firewalld systemctl disable NetworkManager && systemctl stop NetworkManager |
关闭并确认 SELinux 处于关闭状态
1
2
3
4
5
|
快速修改的方法: sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config && grep
'SELINUX=disabled' /etc/selinux/config
setenforce 0 getenforce |
启动数据库
1
2
|
systemctl enable mariadb
systemctl start mariadb |
#检查数据库
1
2
3
4
5
6
7
8
|
[[email protected] yum.repos.d] # netstat -lntup
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:3306 0.0.0.0:* LISTEN 4396 /mysqld tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1274 /sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1857 /master tcp6 0 0 :::22 :::* LISTEN 1274 /sshd tcp6 0 0 ::1:25 :::* LISTEN 1857 /master
|
执行数据库安全初始化
1
|
mysql_securt_initallion |
登录数据库,并创建数据库
1
2
3
|
create database zabbix character set utf8 collate utf8_bin;
flush privileges; |
导入初始化数据到数据库中
1
2
|
rpm -ql zabbix-server-mysql zcat /usr/share/doc/zabbix-server-mysql-3 .2.3 /create .sql.gz|mysql -uzabbix -pmysql123456 zabbix
|
#启动web界面
1
2
3
|
vim /etc/httpd/http .conf
95hang 的servername 127.0.0.1:80 systemctl enable start httpd.service
|
设置时区
系统时区设置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
[[email protected] conf] # timedatectl set-timezone Asia/Shanghai
[[email protected] conf] # timedatectl list-timezones|grep Shanghai
Asia /Shanghai
[[email protected] conf] # ntpdate time1.aliyun.com
8 Mar 16:35:54 ntpdate[4748]: step time server 115.28.122.198 offset -28801.022509 sec
[[email protected] conf] # date
Wed Mar 8 16:36:00 CST 2017 [[email protected] conf] # timedatectl
Local time : Wed 2017-03-08 16:36:05 CST
Universal time : Wed 2017-03-08 08:36:05 UTC
RTC time : Wed 2017-03-08 16:36:07
Time zone: Asia /Shanghai (CST, +0800)
NTP enabled: n /a
NTP synchronized: no RTC in local TZ: no
DST active: n /a
|
设置zabbix时区
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
[[email protected] conf.d] # vim zabbix.conf
# # Zabbix monitoring system php web frontend # Alias /zabbix /usr/share/zabbix
<Directory "/usr/share/zabbix" >
Options FollowSymLinks
AllowOverride None
Require all granted
<IfModule mod_php5.c>
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
php_value date .timezone Asia /Shanghai #这里改成中国的
|
web界面登录
看到zabbix server的状态是no
Zabbix server is running | No | localhost:10051 |
配置/etc/zabbix/zabbix-server.conf 中的数据库密码
重新启动
安装zabbix-agent
1
2
3
4
5
|
1 zabbix-agent-3.0.5-1.el7.x86_64.rpm [[email protected] ~] # rpm -ivh zabbix-agent-3.0.5-1.el7.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing... 1:zabbix-agent-3.0.5-1.el7 ################################# [100%]
|
1
2
3
|
[[email protected] zabbix] # vim zabbix_agentd.conf
Server=127.0.0.1 # 允许那台机器过来那数据
ServerActive=127.0.0.1 #主动模式
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
[[email protected] zabbix] # systemctl enable zabbix-agent.service
Created symlink from /etc/systemd/system/multi-user .target.wants /zabbix-agent .service to /usr/lib/systemd/system/zabbix-agent .service.
[[email protected] zabbix] # systemctl satart zabbix-agent.service
Unknown operation 'satart' .
[[email protected] zabbix] # systemctl start zabbix-agent.service
[[email protected] zabbix] # netstat -lntup
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:3306 0.0.0.0:* LISTEN 5506 /mysqld tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1274 /sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1857 /master tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 6643 /zabbix_agentd tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 6081 /zabbix_server
|
本文转自 kesungang 51CTO博客,原文链接:http://blog.51cto.com/sgk2011/1904528,如需转载请自行联系原作者