美文网首页
Zabbix监控

Zabbix监控

作者: davisgao | 来源:发表于2019-09-26 10:29 被阅读0次
  • 1.创建Zabbix数据库
[root@hnxxzxfzjz006 conf]# mysql -uroot -pHnqx@admin123
mysql: [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 72
Server version: 5.7.27 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, 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> CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
Query OK, 1 row affected (0.03 sec)

mysql>
  • PHP安装
[root@hnxxzxfzjz006 conf]# rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm
[root@hnxxzxfzjz006 conf]# yum install php php-opcache \
php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit \
php-pecl-xdebug php-pecl-xhprof  php-fpm php-bcmath  php-gd php-ldap
#PHP配置
[root@hnxxzxfzjz006 conf]# 
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = Asia/Shanghai
always_populate_raw_post_data = -1
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Asia/Shanghai //时区配置
#启动php
[root@hnxxzxfzjz006 ~]#service php-fpm restart
Stopping php-fpm: [  OK  ]
Starting php-fpm: [  OK  ]
[root@hnxxzxfzjz006 ~]# chkcnfig php-fpm on

  • 安装zabbix
#注意清除老的yum源不然会有冲突
[root@hnxxzxfzjz006 ~]# rpm -Uvh https://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm
[root@hnxxzxfzjz006 ~]# yum clean all
[root@hnxxzxfzjz006 ~]# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
[root@hnxxzxfzjz006 ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uroot -pHnqx@admin123 -D zabbix
[root@hnxxzxfzjz006 ~]# cat /etc/zabbix/zabbix_server.conf
DBHost=10.110.172.156
DBUser=root
DBPassword=Hnqx@admin123
DBPort=3306

#配置/etc/httpd/conf/httpd.conf
[root@hnxxzxfzjz006 ~]#  vim /etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/html/zabbix"
<Directory "/var/www/html/zabbix">
ServerName 127.0.0.1
DirectoryIndex index.html index.html.var index.php
#设置web前端
[root@hnxxzxfzjz006 ~]#  mkdir /var/www/html/zabbix
[root@hnxxzxfzjz006 ~]#   mv /usr/share/zabbix/* /var/www/html/zabbix/
#设置apache的执行和所有者
[root@hnxxzxfzjz006 ~]#   chown -R apache:apache /var/www/html/zabbix
#赋予可执行权限
[root@hnxxzxfzjz006 ~]#   chmod +x /var/www/html/zabbix/conf/
#启动
[root@hnxxzxfzjz006 ~]#   service zabbix-server  start 
[root@hnxxzxfzjz006 ~]#   service zabbix-agent  start 
[root@hnxxzxfzjz006 ~]#   service httpd  start 
  • 访问测试和配置


    image.png
    image.png
    image.png
    image.png
    image.png

登录http://10.110.172.156 账号:Admin/zabbix

image.png image.png
  • 被监控节点安装

#配置
[root@hnxxzxfzjz006 ~]#   vim /etc/zabbix/zabbix_agentd.conf
Server=10.110.172.156 //服务端地址(就是安装完整zabbix的监控主机)
ServerActive=10.110.172.156 //服务端地址,同上
Hostname=hnxxzxfzjz006// 添加主机时使用的名字(也就是你要新添加被监控的主机)
image.png

相关文章

网友评论

      本文标题:Zabbix监控

      本文链接:https://www.haomeiwen.com/subject/ypliectx.html