CentOS 7.5 安装Zabbix4.4.4和Grafana6.4.4监控系统安装

本文档详细介绍了如何在CentOS 7.5上安装Zabbix 4.4.4监控系统和Grafana 6.4.4,包括Zabbix服务器的源码编译安装、数据库配置、前端设置,以及Grafana的安装、配置Zabbix数据源等步骤。在完成安装后,通过Grafana可以查看Zabbix的监控数据。
摘要由CSDN通过智能技术生成

1、Zabbix安装
下载zabbix server源码包

wget https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/4.4.4/zabbix-4.4.4.tar.gz

安装依赖

yum install wget telnet net-tools python-paramiko gcc gcc-c++ dejavu-sans-fonts python-setuptools python-devel sendmail mailx net-snmp net-snmp-devel net-snmp-utils freetype-devel libpng-devel perl unbound libtasn1-devel p11-kit-devel OpenIPMI unixODBC libevent-devel mysql-devel libxml2-devel libssh2-devel OpenIPMI-devel java-1.8.0-openjdk-devel openldap-devel curl-devel unixODBC-devel

解压并编译安装

tar -zxvf zabbix-4.4.1.tar.gz
cd zabbix-4.4.1/

建立编译安装目录

mkdir -p /data/zabbix
./configure --prefix=/data/zabbix --enable-server --enable-agent --enable-java --with-mysql --with-libxml2 --with-unixodbc --with-net-snmp --with-ssh2 --with-openipmi --with-ldap --with-libcurl --with-iconv
make
make install

查看安装版本

/data/zabbix/sbin/zabbix_server -V

在这里插入图片描述
数据库安装

yum install mariadb-server
systemctl start mariadb.service
systemctl status mariadb.service
mysql_secure_installation

在这里插入图片描述
创建数据库

mysql -uroot -p
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'abc123456.';
flush privileges;

导入数据结构

mysql -uzabbix -pabc123456. zabbix < /root/zabbix-4.4.4/database/mysql/schema.sql
mysql -uzabbix -pabc123456. zabbix < /root/zabbix-4.4.4/database/mysql/images.sql
mysql -uzabbix -pabc123456. zabbix < /root/zabbix-4.4.4/database/mysql/data.sql

在这里插入图片描述
修改zabbix server配置

vim /data/zabbix/etc/zabbix_server.conf
ListenPort=10051
DBHost=localhost
DBPassword=zabbix
DBPort=3306
ListenIP=127.0.0.1

增加用户

groupadd --system zabbix
useradd --system -g zabbix -d /usr/lib/zabbix -s /sbin/nologin -c "Zabbix System" zabbix

启动服务

/data/zabbix/sbin/zabbix_server -c /data/zabbix/etc/zabbix_server.conf
/data/zabbix/sbin/zabbix_agentd -c /data/zabbix/etc/zabbix_agentd.conf
tailf /tmp/zabbix_server.log
tailf /tmp/zabbix_agentd.log
ps aux | grep zabbix

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
解决办法 :

增加Zabbix镜像源

rpm -ivh http://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm

安装Zabbix Frontend

yum install zabbix-web-mysql

配置Zabbix frontend

vim /etc/php.ini

max_execution_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_input_time = 300
max_input_vars = 10000
always_populate_raw_post_data = -1
date.timezone = Asia/Shanghai

启动httpd

systemctl start httpd.service
systemctl status httpd.service

cd zabbix-4.4.4
cp misc/init.d/fedora/core/zabbix_server /etc/rc.d/init.d/zabbix-server

cp misc/init.d/fedora/core/zabbix_agentd /etc/rc.d/init.d/zabbix-agent

chmod +x /etc/rc.d/init.d/zabbix-server
chmod +x /etc/rc.d/init.d/zabbix-agent
chkconfig --add zabbix-server
chkconfig --add zabbix-agent
chkconfig zabbix-server on
chkconfig zabbix-agent on

vi /etc/rc.d/init.d/zabbix-agent 和zabbix-server

编辑客户端配置文件

BASEDIR=/data/zabbix/

zabbix安装目录

PIDFILE=/usr/local/zabbix/logs/$BINARY_NAME.pid #pid文件路径
(可以使用默认)

:wq! #保存退出

http://ip/zabbix/setup.php

Admin
zabbix

2、grafana安装

wget https://dl.grafana.com/oss/release/grafana-6.4.4-1.x86_64.rpm
yum localinstall grafana-6.4.4-1.x86_64.rpm

systemctl daemon-reload
systemctl start grafana-server
systemctl status grafana-server

配置支持zabbix

安装 zabbix 插件(grafana-zabbix)

grafana-cli plugins install alexanderzobnin-zabbix-app
systemctl restart grafana-server

启用插件

进入 Plugins 界面,选择 “Zabbix”
开始面板(左上角图标) -> Plugins -> Apps -> Zabbix

添加 zabbix 数据源

进入 “添加数据源” 界面
开始面板(左上角图标) -> Data Sources -> Add data source

配置 Zabbix 数据源

配置完后,保存退出,配置的内容如下:
重要参数有:
Type: Zabbix
Url: http://zabbix服务器/zabbix/api_jsonrpc.php
Access: direct
(Zabbix API details)
Username: Admin(默认)
Password: zabbix(默认)

验证
之后,我们从 开始面板 -> Zabbix 中,便可看到 Zabbix 相关的监控数据。

监控客户端

安装Zabbix Agent

yum install zabbix-agent

systemctl start zabbix-agent.service

常见问题:
1、[root@localhost zabbix-4.4.4]# rpm -ivh http://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
Error downloading packages:
zabbix-web-4.4.4-1.el7.noarch: [Errno 256] No more mirrors to try
在这里插入图片描述
2、

[root@localhost ~]# tailf /tmp/zabbix_agentd.log
 47516:20200108:112823.326 TLS support:            NO
 47516:20200108:112823.326 **************************
 47516:20200108:112823.326 using configuration file: /data/zabbix/etc/zabbix_agentd.conf
 47516:20200108:112823.327 agent #0 started [main process]
 47518:20200108:112823.331 agent #2 started [listener #1]
 47519:20200108:112823.331 agent #3 started [listener #2]
 47520:20200108:112823.332 agent #4 started [listener #3]
 47521:20200108:112823.332 agent #5 started [active checks #1]
 47517:20200108:112823.335 agent #1 started [collector]
 47521:20200108:112823.337 active check configuration update from [127.0.0.1:10051] started to fail (cannot connect to [[127.0.0.1]:10051]: [111] Connection refused)

^C
[root@localhost ~]# !48
tailf /tmp/zabbix_server.log
zabbix_server [48713]: Is this process already running? Could not lock PID file [/tmp/zabbix_server.pid]: [11] Resource temporarily unavailable
zabbix_server [48716]: Is this process already running? Could not lock PID file [/tmp/zabbix_server.pid]: [11] Resource temporarily unavailable
 47511:20200108:132306.061 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)
 47511:20200108:132306.061 database is down: reconnecting in 10 seconds
 47511:20200108:132316.063 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)
 47511:20200108:132316.063 database is down: reconnecting in 10 seconds
 47511:20200108:132326.064 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)
 47511:20200108:132326.064 database is down: reconnecting in 10 seconds
 47511:20200108:132336.066 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)
 47511:20200108:132336.066 database is down: reconnecting in 10 seconds

在这里插入图片描述

扩展

1、如果是rpm包安装的Grafana,如何删除。

查看安装

rpm -qa | grep grafana
find / -name grafana

清除(卸载)

rpm -e grafana-5.3.2-1.x86_64
find / -name grafana -exec rm -rf {} \

参考连接 :

Grafana 安装及 Windows 应用程序服务配置工具 NSSM使用 : https://blog.csdn.net/kk185800961/article/details/83515382

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
下载zabbix server源码包 `wget -o zabbix-4.0.4.tar.gz <https://sourceforge.net/projects/zabbix/files/ZABBIX Latest Stable/4.0.4/zabbix-4.0.4.tar.gz/download`> 安装依赖 `yum install wget telnet net-tools python-paramiko gcc gcc-c++ dejavu-sans-fonts python-setuptools python-devel sendmail mailx net-snmp net-snmp-devel net-snmp-utils freetype-devel libpng-devel perl unbound libtasn1-devel p11-kit-devel OpenIPMI unixODBC libevent-devel mysql-devel libxml2-devel libssh2-devel OpenIPMI-devel java-1.8.0-openjdk-devel openldap-devel curl-devel unixODBC-devel` 解压并编译安装 `tar -zxvf zabbix-4.0.4.tar.gz` `cd zabbix-4.0.4/` 建立编译安装目录 `mkdir -p /data/zabbix` `./configure --prefix=/data/zabbix --enable-server --enable-agent --enable-java --with-mysql --with-libxml2 --with-unixodbc --with-net-snmp --with-ssh2 --with-openipmi --with-ldap --with-libcurl --with-iconv` `make&&make; install` `/data/zabbix/sbin/zabbix_server -V` 数据库安装 `yum install mariadb-server` `systemctl start mariadb.service` `systemctl status mariadb.service` `mysql_secure_installation` 创建zabbix数据库 `mysql -uroot -p` `create database zabbix character set utf8 collate utf8_bin;` `grant all privileges on zabbix.* to zabbix@localhost identified by ‘123456’;` 导入zabbix数据结构 `mysql -uzabbix -p123456 zabbix < /root/zabbix-4.0.4/database/mysql/schema.sql` `mysql -uzabbix -p123456 zabbix < /root/zabbix-4.0.4/database/mysql/images.sql` `mysql -uzabbix -p123456 zabbix < /root/zabbix-4.0.4/database/mysql/data.sql` 更改zabbix-server配置文件 `[root@localhost ~]# egrep -v "^#|^$" /data/zabbix/etc/zabbix_server.conf` `LogFile=/tmp/zabbix_server.log` `DBHost=localhost` `DBName=zabbix` `DBUser=zabbix` `DBPassword=123456` `Timeout=4` 增加用户 `groupadd --system zabbix` `useradd --system -g zabbix -d /usr/lib/zabbix -s /sbin/nologin -c "Zabbix Monitoring System" Zabbix` 启动zabbix server `/data/zabbix/sbin/zabbix_server -c /data/zabbix/etc/zabbix_server.conf` 启动zabbix agent `/data/zabbix/sbin/zabbix_agentd -c /data/zabbix/etc/zabbix_agentd.conf` 安装Zabbix Agent `yum install zabbix-agent` `systemctl start zabbix-agent.service` 安装zabbix前端 `rpm -ivh <https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm>` `yum -y install zabbix-web-mysql` `egrep -v “^#|^$” /etc/php.ini` `max_execution_time = 300` `memory_limit = 128M` `post_max_size = 16M` `upload_max_filesize = 2M` `max_input_time = 300` `max_input_vars = 10000` `always_populate_raw_post_data = -1` `date.timezone = Asia/Shanghai` `` 启动httpd `systemctl start httpd.service` `systemctl status httpd.service` 访问 http://webIP/zabbix/setup.php 默认账号密码 Admin zabbix
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值