0


服务监控(二)之安装Grafana

在这里插入图片描述

一、Grafana简介

Grafana是一个跨平台的开源的度量分析和可视化工具,可以通过将采集的数据查询然后可视化的展示,并及时通知。它主要有以下六大特点:

展示方式:快速灵活的客户端图表,面板插件有许多不同方式的可视化指标和日志,官方库中具有丰富的仪表盘插件,比如热图、折线图、图表等多种展示方式;

数据源:Graphite,InfluxDB,OpenTSDB,Prometheus,Elasticsearch,CloudWatch和KairosDB等;

通知提醒:以可视方式定义最重要指标的警报规则,Grafana将不断计算并发送通知,在数据达到阈值时通过Slack、PagerDuty等获得通知;

混合展示:在同一图表中混合使用不同的数据源,可以基于每个查询指定数据源,甚至自定义数据源;

注释:使用来自不同数据源的丰富事件注释图表,将鼠标悬停在事件上会显示完整的事件元数据和标记;

过滤器:Ad-hoc过滤器允许动态创建新的键/值过滤器,这些过滤器会自动应用于使用该数据源的所有查询。

二、Grafana安装

1、下载

下载地址:https://grafana.com/grafana/download 下载如下版本:
在这里插入图片描述
我的服务器是Centos7, 根据提示下载:

wget https://dl.grafana.com/enterprise/release/grafana-enterprise-8.4.6-1.x86_64.rpm
[root@VM-0-2-centos srv]# wget https://dl.grafana.com/enterprise/release/grafana-enterprise-8.4.6-1.x86_64.rpm
--2022-04-16 12:08:27--  https://dl.grafana.com/enterprise/release/grafana-enterprise-8.4.6-1.x86_64.rpm
Resolving dl.grafana.com (dl.grafana.com)... 146.75.94.217, 2a04:4e42:a::729
Connecting to dl.grafana.com (dl.grafana.com)|146.75.94.217|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 84650817(81M)[application/x-redhat-package-manager]
Saving to: ‘grafana-enterprise-8.4.6-1.x86_64.rpm’

100%[=============================================================================================================================================================================================================================>]84,650,817   300KB/s   in 18m 1s 

2022-04-16 12:26:30 (76.4 KB/s) - ‘grafana-enterprise-8.4.6-1.x86_64.rpm’ saved [84650817/84650817]

2、安装

yum安装(本地方式localinstall )

yum localinstall grafana-enterprise-8.4.6-1.x86_64.rpm 
[root@VM-0-2-centos srv]# yum localinstall grafana-enterprise-8.4.6-1.x86_64.rpm 
Loaded plugins: fastestmirror, langpacks
Examining grafana-enterprise-8.4.6-1.x86_64.rpm: grafana-enterprise-8.4.6-1.x86_64
Marking grafana-enterprise-8.4.6-1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package grafana-enterprise.x86_64 0:8.4.6-1 will be installed
--> Processing Dependency: fontconfig for package: grafana-enterprise-8.4.6-1.x86_64
Determining fastest mirrors
docker-ce-stable                                                                                                                                                                                                                                |3.5 kB  00:00:00     
epel                                                                                                                                                                                                                                            |4.7 kB  00:00:00     
extras                                                                                                                                                                                                                                          |2.9 kB  00:00:00     
os                                                                                                                                                                                                                                              |3.6 kB  00:00:00     
updates                                                                                                                                                                                                                                         |2.9 kB  00:00:00     
(1/6): epel/7/x86_64/group_gz                                                                                                                                                                                                                   |96 kB  00:00:00     
(2/6): extras/7/x86_64/primary_db                                                                                                                                                                                                               |246 kB  00:00:00     
(3/6): epel/7/x86_64/updateinfo                                                                                                                                                                                                                 |1.0 MB  00:00:00     
(4/6): updates/7/x86_64/primary_db                                                                                                                                                                                                              |15 MB  00:00:00     
(5/6): docker-ce-stable/7/x86_64/primary_db                                                                                                                                                                                                     |75 kB  00:00:01     
(6/6): epel/7/x86_64/primary_db                                                                                                                                                                                                                 |7.0 MB  00:00:02     
--> Processing Dependency: urw-fonts for package: grafana-enterprise-8.4.6-1.x86_64
--> Running transaction check
---> Package fontconfig.x86_64 0:2.13.0-4.3.el7 will be installed
--> Processing Dependency: fontpackages-filesystem for package: fontconfig-2.13.0-4.3.el7.x86_64

……省略一些

Installed:
  grafana-enterprise.x86_64 0:8.4.6-1                                                                                                                                                                                                                                  

Dependency Installed:
  dejavu-fonts-common.noarch 0:2.33-6.el7                                 dejavu-sans-fonts.noarch 0:2.33-6.el7                            fontconfig.x86_64 0:2.13.0-4.3.el7                              fontpackages-filesystem.noarch 0:1.44-8.el7               
  libICE.x86_64 0:1.0.9-9.el7                                             libSM.x86_64 0:1.2.2-2.el7                                       libX11.x86_64 0:1.6.7-4.el7_9                                   libX11-common.noarch 0:1.6.7-4.el7_9                      
  libXau.x86_64 0:1.0.8-2.1.el7                                           libXcursor.x86_64 0:1.1.15-1.el7                                 libXext.x86_64 0:1.3.3-3.el7                                    libXfixes.x86_64 0:5.0.3-1.el7                            
  libXi.x86_64 0:1.7.9-1.el7                                              libXinerama.x86_64 0:1.1.3-2.1.el7                               libXmu.x86_64 0:1.1.2-2.el7                                     libXrandr.x86_64 0:1.5.1-2.el7                            
  libXrender.x86_64 0:0.9.10-1.el7                                        libXt.x86_64 0:1.1.5-3.el7                                       libXxf86misc.x86_64 0:1.0.3-7.1.el7                             libXxf86vm.x86_64 0:1.1.4-1.el7                           
  libfontenc.x86_64 0:1.1.3-3.el7                                         libxcb.x86_64 0:1.13-1.el7                                       urw-base35-bookman-fonts.noarch 0:20170801-10.el7               urw-base35-c059-fonts.noarch 0:20170801-10.el7            
  urw-base35-d050000l-fonts.noarch 0:20170801-10.el7                      urw-base35-fonts.noarch 0:20170801-10.el7                        urw-base35-fonts-common.noarch 0:20170801-10.el7                urw-base35-gothic-fonts.noarch 0:20170801-10.el7          
  urw-base35-nimbus-mono-ps-fonts.noarch 0:20170801-10.el7                urw-base35-nimbus-roman-fonts.noarch 0:20170801-10.el7           urw-base35-nimbus-sans-fonts.noarch 0:20170801-10.el7           urw-base35-p052-fonts.noarch 0:20170801-10.el7            
  urw-base35-standard-symbols-ps-fonts.noarch 0:20170801-10.el7           urw-base35-z003-fonts.noarch 0:20170801-10.el7                   xorg-x11-font-utils.x86_64 1:7.5-21.el7                         xorg-x11-server-utils.x86_64 0:7.7-20.el7                 

Complete!

3、启动

设置为开机启动:

systemctl enable grafana-server

启动:

systemctl start grafana-server

查看启动情况:

ps -ef | grep grafana

具体如下:

[root@VM-0-2-centos srv]# 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.
[root@VM-0-2-centos srv]# systemctl start grafana-server[root@VM-0-2-centos srv]# ps -ef | grep grafana
grafana   42731912:44 ?        00:00:00 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile=/var/run/grafana/grafana-server.pid --packaging=rpm cfg:default.paths.logs=/var/log/grafana cfg:default.paths.data=/var/lib/grafana cfg:default.paths.plugins=/var/lib/grafana/plugins cfg:default.paths.provisioning=/etc/grafana/provisioning
root      432317359012:45 pts/0    00:00:00 grep --color=auto grafana

4、访问

grafana的默认配置文件是 /etc/grafana/grafana.ini, 默认端口3000

访问 http://yourIP:3000 ,默认会跳到login页 如下图,输入默认用户名/密码:admin/admin登录。
第一次登录会提示输入2次密码,设置一个新密码,根据个人设置就行,别忘记哈。
在这里插入图片描述
主页:
在这里插入图片描述

至此,Grafana安装启动完毕。

END Please One Key Three Connect (One button three connections)Thanks!


本文转载自: https://blog.csdn.net/wdy_2099/article/details/124211397
版权归原作者 一掬净土 所有, 如有侵权,请联系我们删除。

“服务监控(二)之安装Grafana”的评论:

还没有评论