zabbix安装及简单配置监控httpd服务

安装zabbix

  1. 官网下载所需安装包(这里我已经下载好了),安装
[[email protected] ~]# cd 4.0/
[[email protected] 4.0]# ls
fping-3.10-1.el7.x86_64.rpm
iksemel-1.4-2.el7.centos.x86_64.rpm
php-bcmath-5.4.16-42.el7.x86_64.rpm
php-mbstring-5.4.16-42.el7.x86_64.rpm
zabbix-agent-4.0.5-1.el7.x86_64.rpm
zabbix-get-4.0.5-1.el7.x86_64.rpm
zabbix-java-gateway-4.0.5-1.el7.x86_64.rpm
zabbix-proxy-mysql-4.0.5-1.el7.x86_64.rpm
zabbix-sender-4.0.5-1.el7.x86_64.rpm
zabbix-server-mysql-4.0.5-1.el7.x86_64.rpm
zabbix-web-4.0.5-1.el7.noarch.rpm
zabbix-web-mysql-4.0.5-1.el7.noarch.rpm
[[email protected] 4.0]# yum install -y *
  1. 安装并配置数据库
[[email protected] 4.0]# yum install mariadb-server
[[email protected] 4.0]# systemctl start mariadb
[[email protected] 4.0]# mysql_secure_installation 

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

##进入到数据库中使用utf-8编码并对用户授权
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all privileges on zabbix.* to [email protected] identified by 'redhat'; 

##导入zabbix数据库
[[email protected] 4.0]# zcat /usr/share/doc/zabbix-server-mysql-4.0.5/create.sql.gz | mysql -uzabbix -p zabbix

#登陆数据库查看导入的数据库
  1. 编辑zabbix的配置文件,修改数据库密码,修改时区
[[email protected] local]# vim /etc/zabbix/zabbix_server.conf
116 DBUser=zabbix
124 DBPassword=redhat		##这里的密码是zabbix用户的密码,不是数据库的登陆密码

[[email protected] local]# vim /etc/httpd/conf.d/zabbix.conf
        php_value date.timezone Asia/Shanghai
  1. 启动 zabbix server、zabbix agent、httpd
[[email protected] local]# systemctl start zabbix-server zabbix-agent httpd
  1. 浏览器输入172.25.19.1/zabbix/,进行zabbix的web界面配置
    在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

  • 这里的用户名是Admin 密码zabbix
    在这里插入图片描述
  • 登录成功之后看到的web页面

在这里插入图片描述

  • 进入zabbix平台后,可以修改监控语言和登陆密码(点击右上方的人头标志,开始修改密码和语言)
    在这里插入图片描述
    在这里插入图片描述

添加 http 服务监控项

http是zabbix自带的监控模板
点击 配置->主机-> zabbix server ->模版 ->选择 -> Template App HTTP Service
在这里插入图片描述
再点击 添加 -> 更新
在这里插入图片描述
这样主机 监控项中就出现了 HTTP 服务
在这里插入图片描述