安装zabbix4.0+grafana
生活随笔
收集整理的這篇文章主要介紹了
安装zabbix4.0+grafana
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
---------------------- 那些年我走過的坑們 ----------------------
準(zhǔn)備環(huán)境
首先
zabbix官方下載
zabbix官方產(chǎn)品手冊
zabbix4.0軟件包
- 官方建議數(shù)據(jù)庫的安裝要求
關(guān)閉防火墻
[root@VM-0-17-centos ~]# systemctl stop firewalld [root@VM-0-17-centos ~]# systemctl disable firewalld關(guān)閉selinux
[root@VM-0-17-centos ~]# vim /etc/sysconfig/selinux # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of three values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted[root@VM-0-17-centos ~]# setenforce 0 setenforce: SELinux is disabled [root@VM-0-17-centos ~]# getenforce Disabled升級軟件
[root@VM-0-17-centos ~]# yum -y update Loaded plugins: fastestmirror, product-id, search-disabled-repos Loading mirror speeds from cached hostfile No packages marked for update部署lnmp
# 安裝依賴 [root@VM-0-17-centos ~]# yum -y install gcc pcre-devel zlib-devel openssl-devel # 將軟件包上傳到目錄 [root@VM-0-17-centos opt]# ls nginx-1.18.0.tar.gz rh zabbix-4.0.9.tar.gz php-7.3.22.tar.gz# 解壓Nginx [root@VM-0-17-centos opt]# tar -xf nginx-1.18.0.tar.gz [root@VM-0-17-centos opt]# cd nginx-1.18.0/ [root@VM-0-17-centos nginx-1.18.0]# ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_sub_module --with-http_stub_status_module [root@VM-0-17-centos nginx-1.18.0]# make && make install# 下載mysql [root@VM-0-17-centos ~]# rpm -q mariadb # 查看mariadb是否安裝過,如果安裝過,將mariadb利用yum或者rpm卸載,并且將/var/lib/mysql下面的文件全部刪除,mariadb會和mysql相沖突 package mariadb is not installed [root@VM-0-17-centos opt]# wget wget https://dev.mysql.com/get/mysql80-community-release-el7-2.noarch.rpm [root@VM-0-17-centos opt]# ls mysql80-community-release-el7-2.noarch.rpm nginx-1.18.0.tar.gz rh zabbix-4.0.9.tar.gz nginx-1.18.0 zabbix-4.0.9 [root@VM-0-17-centos opt]# yum -y install mysql80-community-release-el7-2.noarch.rpm # 下載rpm包 [root@VM-0-17-centos opt]# yum -y update # 更新一下yum源[root@VM-0-17-centos opt]# yum -y install mysql-community-server.x86_64 # 安裝mysql服務(wù)器[root@VM-0-17-centos opt]# systemctl start mysqld # 起服務(wù) [root@VM-0-17-centos opt]# ss -nutlp | grep 3306 tcp LISTEN 0 70 [::]:33060 [::]:* users:(("mysqld",pid=13816,fd=31)) tcp LISTEN 0 128 [::]:3306 [::]:* users:(("mysqld",pid=13816,fd=33))[root@VM-0-17-centos ~]# grep "password" /var/log/mysqld.log # 查看進入mysql的初始密碼 [root@VM-0-17-centos ~]# mysql -uroot -p # 登錄數(shù)據(jù)庫 Enter password: mysql> alter user root@"localhost" identified by "123tian.A"; # 修改用戶密碼 Query OK, 0 rows affected (0.01 sec)#下載PHP以及依賴包 [root@VM-0-17-centos ~]# tar -xf php-7.3.22.tar.gz # 解壓 [root@VM-0-17-centos ~]# yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses curl gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel expat-devel xmlrpc-c xmlrpc-c-devel libicu-devel libmcrypt-devel libmemcached-devel gcc-c++ # 下載依賴包[root@VM-0-17-centos ~]# groupadd www # 創(chuàng)建php組合用戶 [root@VM-0-17-centos ~]# useradd -g www www[root@VM-0-17-centos php-7.3.22]# ./configure --prefix=/usr/local/php --with-fpm-user=php --with-fpm-group=php --with-mysqli=mysqlnd --enable-embedded-mysqli --with-mysql-sock=/var/lib/mysql/mysql.sock --with-pdo-mysql=mysqlnd --enable-mysqlnd --with-zlib --enable-fpm --with-openssl --enable-fpm --with-openssl --enable-debug --with-freetype-dir --with-png-dir --with-gd --enable-gd-jis-conv --with-jpeg-dir --enable-sockets --enable-mbstring --enable-bcmath --with-config-file-path=/usr/local --with-libxml-dir --with-curl --enable-ftp --enable-intl --with-mhash --enable-soap --enable-maintainer-zts --with-pear --disable-fileinfo --disable-rpath --with-gettext --enable-sysvsem --enable-cli --enable-phpdbg-readline=/usr/local [root@VM-0-17-centos php-7.3.22]# make && make install[root@VM-0-17-centos php-7.3.22]# /usr/local/php/bin/php -v PHP 7.3.22 (cli) (built: Sep 19 2020 11:43:45) ( ZTS DEBUG ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.22, Copyright (c) 1998-2018 Zend Technologies[root@VM-0-17-centos php-7.3.22]# vim /etc/profile # 添加到環(huán)境變量 PATH=$PATH:/usr/local/php/bin export PATH [root@VM-0-17-centos ~]# source /etc/profile [root@VM-0-17-centos ~]# php -v # 更新環(huán)境變量 PHP 7.3.22 (cli) (built: Sep 19 2020 11:43:45) ( ZTS DEBUG ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.22, Copyright (c) 1998-2018 Zend Technologies# 配置php-fpm [root@VM-0-17-centos php-7.3.22]# cp php.ini-production /etc/php.ini [root@VM-0-17-centos php-7.3.22]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf [root@VM-0-17-centos php-7.3.22]# cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf [root@VM-0-17-centos php-7.3.22]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm [root@VM-0-17-centos php-7.3.22]# chmod +x /etc/init.d/php-fpm[root@VM-0-17-centos php-7.3.22]# /etc/init.d/php-fpm start # 起服務(wù) Starting php-fpm done [root@VM-0-17-centos php-7.3.22]# ss -nutlp | grep 9000 tcp LISTEN 0 128 127.0.0.1:9000 *:* users:(("php-fpm",pid=16269,fd=5),("php-fpm",pid=16268,fd=5),("php-fpm",pid=16267,fd=7))# 配置Nginx使其支持PHP [root@VM-0-17-centos ~]# vim /usr/local/nginx/conf/nginx.conf45 index index.html index.php index.htm; 65 location ~ \.php$ {66 root html;67 fastcgi_pass 127.0.0.1:9000;68 fastcgi_index index.php;69 # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;70 include fastcgi.conf; 71 } [root@VM-0-17-centos ~]# /usr/local/nginx/sbin/nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful [root@VM-0-17-centos ~]# /usr/local/nginx/sbin/nginx [root@VM-0-17-centos ~]# ss -nutlp | grep :80 tcp LISTEN 0 128 *:80 *:* users:(("nginx",pid=1518,fd=6),("nginx",pid=1517,fd=6)) [root@VM-0-17-centos ~]# ss -nutlp | grep :9000 tcp LISTEN 0 128 127.0.0.1:9000 *:* users:(("php-fpm",pid=13797,fd=0),("php-fpm",pid=13796,fd=0),("php-fpm",pid=13795,fd=0),("php-fpm",pid=13794,fd=0),("php-fpm",pid=13793,fd=0),("php-fpm",pid=13792,fd=6))# 測試是否可以訪問PHP頁面# 測試靜態(tài)頁面 [root@VM-0-17-centos ~]# curl localhost <h1>hello,Be happy!</h1> [root@VM-0-17-centos ~]# vim /usr/local/nginx/html/index.html [root@VM-0-17-centos ~]# curl localhost <h1>hello,Be happy! [root@VM-0-17-centos ~]# curl -I localhost HTTP/1.1 200 OK Server: nginx/1.18.0 Date: Thu, 20 Aug 2020 09:40:35 GMT Content-Type: text/html Content-Length: 20 Last-Modified: Thu, 20 Aug 2020 09:40:24 GMT Connection: keep-alive ETag: "5f3e4508-14" Accept-Ranges: bytes # 測試動態(tài)頁面 </div></body></html>[root@VM-0-17-centos ~]# curl -I localhost/test.php HTTP/1.1 200 OK Server: nginx/1.18.0 Date: Fri, 21 Aug 2020 02:16:19 GMT Content-Type: text/html; charset=UTF-8 Connection: keep-alive X-Powered-By: PHP/7.4.9配置zabbix用戶可以連接數(shù)據(jù)庫
[root@VM-0-17-centos ~]# mysql -uroot -p123tian.A -e "create database zabbix character set utf8 collate utf8_bin" # 命令行登錄,創(chuàng)建zabbix庫,使其支持中文# mysql8.0授權(quán)用戶登錄不是像5.x版本樣可以直接授權(quán)的同時創(chuàng)建用戶,只能單獨創(chuàng)建單獨授權(quán),并且授權(quán)用戶時不可以加identified by!!! mysql> create user 'zabbix'@'%' identified WITH mysql_native_password by '123qqq...A' ; # 創(chuàng)建用戶 Query OK, 0 rows affected (0.02 sec) mysql> grant all privileges on zabbix.* to 'zabbix'@'%'; # 授權(quán) Query OK, 0 rows affected (0.01 sec) mysql> flush privileges; # 刷新 Query OK, 0 rows affected (0.02 sec)[root@VM-0-17-centos ~]# vim /etc/my.cnf default_authentication_plugin=mysql_native_password# 修改測試頁的內(nèi)容,測試zabbix用戶能否登錄數(shù)據(jù)庫 [root@VM-0-17-centos ~]# vim /usr/local/nginx/html/index.php <?php $dbhost = '106.54.95.242:3306'; // mysql服務(wù)器主機地址 $dbuser = 'zabbix'; // mysql用戶名 $dbpass = '123qqq...A'; // mysql用戶名密碼 $conn = mysqli_connect($dbhost, $dbuser, $dbpass); if(! $conn ) {die('Could not connect: ' . mysqli_error()); } echo '數(shù)據(jù)庫連接成功!'; mysqli_close($conn); ?> [root@VM-0-17-centos ~]# curl localhost/index.php 數(shù)據(jù)庫連接成功!安裝并啟動zabbix
# 安裝依賴包 [root@VM-0-17-centos ~]# yum -y install net-snmp net-snmp-devel curl curl-devel libxml2 libxml2-devel libevent-devel.x86_64 javacc.noarch javacc-javadoc.noarch javacc-maven-plugin.noarch javacc*# 安裝PHP支持zabbix組件 [root@VM-0-17-centos ~]# yum install php-bcmath php-mbstring -y# 安裝zabbix [root@VM-0-17-centos ~]# mkdir /zabbix # 創(chuàng)建zabbix目錄 [root@VM-0-17-centos ~]# cd /zabbix/ [root@VM-0-17-centos zabbix]# ls zabbix40.tar.gz [root@VM-0-17-centos zabbix]# tar -xf zabbix40.tar.gz [root@VM-0-17-centos zabbix]# ls apr-1.4.8-3.el7_4.1.x86_64.rpm perl-File-Temp-0.23.01-3.el7.noarch.rpm apr-util-1.5.2-6.el7.x86_64.rpm perl-Filter-1.49-3.el7.x86_64.rpm createrepo-0.9.9-28.el7.noarch.rpm perl-Getopt-Long-2.40-3.el7.noarch.rpm dejavu-fonts-common-2.33-6.el7.noarch.rpm perl-HTTP-Tiny-0.033-3.el7.noarch.rpm dejavu-sans-fonts-2.33-6.el7.noarch.rpm perl-IO-Compress-2.061-2.el7.noarch.rpm deltarpm-3.6-3.el7.x86_64.rpm perl-libs-5.16.3-294.el7_6.x86_64.rpm fontpackages-filesystem-1.44-8.el7.noarch.rpm perl-macros-5.16.3-294.el7_6.x86_64.rpm fping-3.10-4.el7.x86_64.rpm perl-Net-Daemon-0.48-5.el7.noarch.rpm httpd-2.4.6-89.el7.centos.x86_64.rpm perl-parent-0.225-244.el7.noarch.rpm httpd-tools-2.4.6-89.el7.centos.x86_64.rpm perl-PathTools-3.40-5.el7.x86_64.rpm iksemel-1.4-2.el7.centos.x86_64.rpm perl-PlRPC-0.2020-14.el7.noarch.rpm libevent-2.0.21-4.el7.x86_64.rpm perl-Pod-Escapes-1.04-294.el7_6.noarch.rpm libjpeg-turbo-1.2.90-6.el7.x86_64.rpm perl-podlators-2.5.1-3.el7.noarch.rpm libpng-1.5.13-7.el7_2.x86_64.rpm perl-Pod-Perldoc-3.20-4.el7.noarch.rpm libtool-ltdl-2.4.2-22.el7_3.x86_64.rpm perl-Pod-Simple-3.28-4.el7.noarch.rpm libX11-1.6.5-2.el7.x86_64.rpm perl-Pod-Usage-1.63-3.el7.noarch.rpm libX11-common-1.6.5-2.el7.noarch.rpm perl-Scalar-List-Utils-1.27-248.el7.x86_64.rpm libXau-1.0.8-2.1.el7.x86_64.rpm perl-Socket-2.010-4.el7.x86_64.rpm libxcb-1.13-1.el7.x86_64.rpm perl-Storable-2.45-3.el7.x86_64.rpm libxml2-2.9.1-6.el7_2.3.x86_64.rpm perl-Text-ParseWords-3.29-4.el7.noarch.rpm libxml2-python-2.9.1-6.el7_2.3.x86_64.rpm perl-threads-1.87-4.el7.x86_64.rpm libXpm-3.5.12-1.el7.x86_64.rpm perl-threads-shared-1.43-6.el7.x86_64.rpm libxslt-1.1.28-5.el7.x86_64.rpm perl-Time-HiRes-1.9725-3.el7.x86_64.rpm libzip-0.10.1-8.el7.x86_64.rpm perl-Time-Local-1.2300-2.el7.noarch.rpm lrzsz-0.12.20-36.el7.x86_64.rpm php-5.4.16-46.el7.x86_64.rpm mailcap-2.1.41-2.el7.noarch.rpm php-bcmath-5.4.16-46.el7.x86_64.rpm mariadb-5.5.60-1.el7_5.x86_64.rpm php-cli-5.4.16-46.el7.x86_64.rpm mariadb-libs-5.5.60-1.el7_5.x86_64.rpm php-common-5.4.16-46.el7.x86_64.rpm mariadb-server-5.5.60-1.el7_5.x86_64.rpm php-gd-5.4.16-46.el7.x86_64.rpm net-snmp-libs-5.7.2-37.el7.x86_64.rpm php-ldap-5.4.16-46.el7.x86_64.rpm OpenIPMI-libs-2.0.23-2.el7.x86_64.rpm php-mbstring-5.4.16-46.el7.x86_64.rpm OpenIPMI-modalias-2.0.23-2.el7.x86_64.rpm php-mysql-5.4.16-46.el7.x86_64.rpm openssl-1.0.2k-16.el7_6.1.x86_64.rpm php-pdo-5.4.16-46.el7.x86_64.rpm openssl-libs-1.0.2k-16.el7_6.1.x86_64.rpm php-xml-5.4.16-46.el7.x86_64.rpm perl-5.16.3-294.el7_6.x86_64.rpm python-deltarpm-3.6-3.el7.x86_64.rpm perl-Carp-1.26-244.el7.noarch.rpm repodata perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm t1lib-5.1.2-14.el7.x86_64.rpm perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm unixODBC-2.3.1-11.el7.x86_64.rpm perl-constant-1.27-2.el7.noarch.rpm zabbix40.tar.gz perl-Data-Dumper-2.145-3.el7.x86_64.rpm zabbix-agent-4.0.7-1.el7.x86_64.rpm perl-DBD-MySQL-4.023-6.el7.x86_64.rpm zabbix-get-4.0.7-1.el7.x86_64.rpm perl-DBI-1.627-4.el7.x86_64.rpm zabbix-server-mysql-4.0.7-1.el7.x86_64.rpm perl-Encode-2.51-7.el7.x86_64.rpm zabbix-web-4.0.7-1.el7.noarch.rpm perl-Exporter-5.68-3.el7.noarch.rpm zabbix-web-mysql-4.0.7-1.el7.noarch.rpm perl-File-Path-2.09-2.el7.noarch.rpm# 將rpm包作為yum源 [root@VM-0-17-centos zabbix]# yum -y install yum-utils # 下載軟件,提供yum-config-manager服務(wù) [root@VM-0-17-centos zabbix]# yum-config-manager --add file:///zabbix Loaded plugins: fastestmirror adding repo from: file:///zabbix[zabbix] name=added from: file:///zabbix baseurl=file:///zabbix enabled=1[root@VM-0-17-centos zabbix]# vim /etc/yum.conf # 修改yum的配置,使其每次不檢查簽名8 gpgcheck=0[root@VM-0-17-centos zabbix]# yum -y update # 更新yum源 [root@VM-0-17-centos zabbix]# yum repolist Loaded plugins: fastestmirror, product-id, search-disabled-repos Loading mirror speeds from cached hostfile repo id repo name status base/7/x86_64 CentOS-7 - Base 10,070 extras/7/x86_64 CentOS-7 - Extras 413 mysql-connectors-community/x86_64 MySQL Connectors Community 165 mysql-tools-community/x86_64 MySQL Tools Community 115 mysql80-community/x86_64 MySQL 8.0 Community Server 193 updates/7/x86_64 CentOS-7 - Updates 1,112 zabbix_ added from: file:///zabbix/ 87 repolist: 12,155# 安裝zabbix組件 [root@VM-0-17-centos zabbix]# yum install zabbix-server-mysql zabbix-web-mysql -y# 導(dǎo)入數(shù)據(jù) [root@VM-0-17-centos zabbix]# zcat /usr/share/doc/zabbix-server-mysql-4.0.7/create.sql.gz | mysql -h106.54.95.242 -uzabbix -p123qqq...A zabbix # 導(dǎo)入數(shù)據(jù)到zabbix庫中,-h后面接ip,-u用戶名,-p密碼# 修改zabbix連接數(shù)據(jù)庫的配置 [root@VM-0-17-centos ~]# vim /etc/zabbix/zabbix_server.conf38 LogFile=/tmp/zabbix_server.log92 DBHost=localhost 100 DBName=zabbix 116 DBUser=zabbix 125 DBPassword=123qqq...A # 修改時區(qū) [root@VM-0-17-centos ~]# vim /etc/php.ini 956 date.timezone = Asia/Shanghai 380 max_execution_time = 300 689 post_max_size = 32M 390 max_input_time = 300# 修改Nginx頁面的配置 [root@VM-0-17-centos ~]# vim /usr/local/nginx/conf/nginx.conf17 http {18 include mime.types;19 default_type application/octet-stream;20 fastcgi_buffers 8 16k;21 fastcgi_buffer_size 32k;22 fastcgi_connect_timeout 300;23 fastcgi_send_timeout 300;24 fastcgi_read_timeout 300; [root@VM-0-17-centos ~]# /usr/local/nginx/sbin/nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful [root@VM-0-17-centos ~]# /usr/local/nginx/sbin/nginx -s reload [root@VM-0-17-centos ~]# /etc/init.d/php-fpm restart Gracefully shutting down php-fpm . done Starting php-fpm done [root@VM-0-17-centos ~]# zabbix_server [root@VM-0-17-centos ~]# netstat -nutlp | grep zabbix_server tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 31716/zabbix_server tcp6 0 0 :::10051 :::* LISTEN 31716/zabbix_server- 如果zabbix啟動報錯如下:
將zabbix上線網(wǎng)頁
[root@VM-0-17-centos ~]# cd /usr/share/zabbix/ [root@VM-0-17-centos ~]# ls actionconf.php chart6.php images screenedit.php adm.gui.php chart7.php img screen.import.php adm.housekeeper.php chart.php imgstore.php screens.php adm.iconmapping.php charts.php include search.php adm.images.php conf index_http.php services.php adm.macros.php conf.import.php index.php setup.php adm.other.php correlation.php items.php slideconf.php adm.regexps.php discoveryconf.php js slides.php adm.triggerdisplayoptions.php disc_prototypes.php jsLoader.php srv_status.php adm.triggerseverities.php favicon.ico jsrpc.php styles adm.valuemapping.php fonts latest.php sysmap.php adm.workingtime.php graphs.php local sysmaps.php api_jsonrpc.php history.php locale templates.php app host_discovery.php maintenance.php toptriggers.php applications.php hostgroups.php map.import.php tr_events.php audio hostinventoriesoverview.php map.php trigger_prototypes.php auditacts.php hostinventories.php overview.php triggers.php auditlogs.php host_prototypes.php profile.php usergrps.php browserwarning.php host_screen.php queue.php users.php chart2.php hosts.php report2.php zabbix.php chart3.php httpconf.php report4.php chart4.php httpdetails.php robots.txt chart5.php image.php screenconf.php [root@VM-0-17-centos zabbix]# cp -a * /usr/local/nginx/html/ cp: overwrite ‘/usr/local/nginx/html/index.php’? y [root@VM-0-17-centos zabbix]# chmod +x /usr/local/nginx/html/* [root@VM-0-17-centos zabbix]# ls /usr/local/nginx/html/index.* /usr/local/nginx/html/index.html /usr/local/nginx/html/index.php- 如果出現(xiàn)報錯如下,說明權(quán)限的設(shè)置出現(xiàn)問題
將服務(wù)設(shè)置為開機自啟
[root@VM-0-17-centos ~]# vim /etc/rc.local #!/bin/bash # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES # # It is highly advisable to create own systemd services or udev rules # to run scripts during boot instead of using this file. # # In contrast to previous versions due to parallel execution during boot # this script will NOT be run after all other services. # # Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure # that this script will be executed during boot.touch /var/lock/subsys/local /usr/local/qcloud/irq/net_smp_affinity.sh >/tmp/net_affinity.log 2>&1 /usr/local/qcloud/rps/set_rps.sh >/tmp/setRps.log 2>&1 /usr/local/qcloud/irq/virtio_blk_smp_affinity.sh > /tmp/virtio_blk_affinity.log 2>&1 /usr/local/qcloud/gpu/nv_gpu_conf.sh >/tmp/nv_gpu_conf.log 2>&1 /usr/local/nginx/sbin/nginx /etc/init.d/php-fpm 2>&1 /usr/sbin/zabbix_server [root@VM-0-17-centos ~]# systemctl enable mysqld
- 出現(xiàn)此種報錯直接在相應(yīng)的路徑手動上傳文件即可
- 默認(rèn)用戶名:Admin,默認(rèn)密碼:zabbix
下載grafana
grafana官網(wǎng)
[root@VM-0-17-centos opt]# wget https://dl.grafana.com/oss/release/grafana-7.1.5-1.x86_64.rpm [root@VM-0-17-centos opt]# yum -y install grafana-7.1.5-1.x86_64.rpm [root@VM-0-17-centos opt]# systemctl start grafana-server [root@VM-0-17-centos opt]# systemctl enable grafana-server Created symlink from /etc/systemd/system/multi-user.target.wants/grafana-server.service to /usr/lib/systemd/system/grafana-server.service.安裝zabbix-grafana插件
# 列出當(dāng)前可用的插件 [root@VM-0-17-centos opt]# grafana-cli plugins list-remote# 安裝zabbix插件 [root@VM-0-17-centos ~]# grafana-cli plugins install alexanderzobnin-zabbix-app [root@VM-0-17-centos ~]# ll /var/lib/grafana/plugins/ total 4 drwxr-xr-x 8 root root 4096 Sep 19 18:04 alexanderzobnin-zabbix-app [root@VM-0-17-centos ~]# cd /var/lib/grafana/plugins/ [root@VM-0-17-centos plugins]# git clone https://github.com/alexanderzobnin/grafana-zabbix-app [root@VM-0-17-centos plugins]# cd grafana-zabbix-app/ [root@VM-0-17-centos grafana-zabbix-app]# git pull# 重啟服務(wù) [root@VM-0-17-centos ~]# systemctl restart grafana-server [root@VM-0-17-centos ~]# systemctl enable grafana-server [root@VM-0-17-centos ~]# ss -nutlp | grep 3000 tcp LISTEN 0 128 [::]:3000 [::]:* users:(("grafana-server",pid=21886,fd=10))訪問grafana
[root@VM-0-17-centos ~]# curl -I localhost:3000 # curl 3000端口重定向 HTTP/1.1 302 Found Cache-Control: no-cache Content-Type: text/html; charset=utf-8 Expires: -1 Location: /login Pragma: no-cache Set-Cookie: redirect_to=%2F; Path=/; HttpOnly; SameSite=Lax X-Content-Type-Options: nosniff X-Frame-Options: deny X-Xss-Protection: 1; mode=block Date: Mon, 21 Sep 2020 01:51:50 GMT- 登錄grafana
-
設(shè)置密碼
-
啟用zabbix-grafana插件
- 添加數(shù)據(jù)源
- 在下拉菜單上面找到zabbix,如果找不到,可以進行如下操作:
- 自動跳轉(zhuǎn)到grafana數(shù)據(jù)源
- 如果出現(xiàn)unsigned,未簽名的不能使用,可以進行如下操作,在配置文件中修改:
- 選擇Add data source,進行添加數(shù)據(jù)源
- 進入數(shù)據(jù)源,可以選擇默認(rèn)的dashboards
- 在zabbix中配置被監(jiān)控主機
- 在grafana中查看數(shù)據(jù)
總結(jié)
以上是生活随笔為你收集整理的安装zabbix4.0+grafana的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: WordPress的varnish内存缓
- 下一篇: 搭建Nginx正向代理