zabbix-----1-----安装

本文详细介绍了如何在Linux环境下部署Zabbix监控系统,包括更新yum源、安装必要组件、配置数据库、设置时区等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

更新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
[root@zabbix-node1 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;
grant all on zabbix.* to zabbix@ 'localhost'  identified by  'mysql123456' ;
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
[root@zabbix-node1 conf] # timedatectl set-timezone Asia/Shanghai
[root@zabbix-node1 conf] # timedatectl list-timezones|grep Shanghai
Asia /Shanghai
[root@zabbix-node1 conf] # ntpdate time1.aliyun.com
  8 Mar 16:35:54 ntpdate[4748]: step  time  server 115.28.122.198 offset -28801.022509 sec
[root@zabbix-node1 conf] # date 
Wed Mar  8 16:36:00 CST 2017
[root@zabbix-node1 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
[root@zabbix-node1 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界面登录

wKiom1i_w1TB2C84AADoalZPgvU444.png执行下一步开始安装,完成安装

wKioL1i_w-SSy8KsAAEkGNnV0BE412.png

wKiom1i_xDqh8VBxAAAqPuuL9Ys825.png-wh_50

看到zabbix server的状态是no

Zabbix server is runningNolocalhost:10051

配置/etc/zabbix/zabbix-server.conf 中的数据库密码

重新启动


安装zabbix-agent

1
2
3
4
5
1 zabbix-agent-3.0.5-1.el7.x86_64.rpm
[root@zabbix-node1 ~] # 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
[root@zabbix-node1 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
[root@zabbix-node1 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.
[root@zabbix-node1 zabbix] # systemctl satart zabbix-agent.service
Unknown operation  'satart' .
[root@zabbix-node1 zabbix] # systemctl start zabbix-agent.service
[root@zabbix-node1 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,如需转载请自行联系原作者
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值