Grafana是在互联网架构和应用分析中最流行的时序数据可视化工具,并且也在工业监控、气象监控、家居自动化和过程管理等领域有着广泛的应用。
我们可以访问Grafana官方网站的下载地址https://grafana.com/grafana/download,上面详细介绍了各种操作系统下Grafana的安装步骤。根据自己的系统版本和配置,下载对应的安装包进行安装。以Centos为例,具体的下载与安装命令如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
[root@emr-header-1 ~]# wget https://dl.grafana.com/oss/release/grafana-6.5.2-1.x86_64.rpm --2020-01-14 17:58:35-- https://dl.grafana.com/oss/release/grafana-6.5.2-1.x86_64.rpm Resolving dl.grafana.com (dl.grafana.com)... 151.101.26.217, 2a04:4e42:2e::729 Connecting to dl.grafana.com (dl.grafana.com)|151.101.26.217|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 60813768 (58M) [application/x-redhat-package-manager] Saving to: ‘grafana-6.5.2-1.x86_64.rpm’ 100%[===============================================================================================================================================================>] 60,813,768 9.02MB/s in 7.5s 2020-01-14 17:58:44 (7.76 MB/s) - ‘grafana-6.5.2-1.x86_64.rpm’ saved [60813768/60813768] [root@emr-header-1 ~]# sudo yum localinstall grafana-6.5.2-1.x86_64.rpm Loaded plugins: fastestmirror Examining grafana-6.5.2-1.x86_64.rpm: grafana-6.5.2-1.x86_64 Marking grafana-6.5.2-1.x86_64.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package grafana.x86_64 0:6.5.2-1 will be installed --> Processing Dependency: urw-fonts for package: grafana-6.5.2-1.x86_64 base | 3.6 kB 00:00:00 epel | 5.3 kB 00:00:00 extras | 2.9 kB 00:00:00 influxdb | 2.5 kB 00:00:00 updates | 2.9 kB 00:00:00 Loading mirror speeds from cached hostfile --> Running transaction check ---> Package urw-base35-fonts.noarch 0:20170801-10.el7 will be installed --> Processing Dependency: urw-base35-fonts-common = 20170801-10.el7 for package: urw-base35-fonts-20170801-10.el7.noarch --> Processing Dependency: urw-base35-z003-fonts for package: urw-base35-fonts-20170801-10.el7.noarch --> Processing Dependency: urw-base35-standard-symbols-ps-fonts for package: urw-base35-fonts-20170801-10.el7.noarch --> Processing Dependency: urw-base35-p052-fonts for package: urw-base35-fonts-20170801-10.el7.noarch --> Processing Dependency: urw-base35-nimbus-sans-fonts for package: urw-base35-fonts-20170801-10.el7.noarch --> Processing Dependency: urw-base35-nimbus-roman-fonts for package: urw-base35-fonts-20170801-10.el7.noarch --> Processing Dependency: urw-base35-nimbus-mono-ps-fonts for package: urw-base35-fonts-20170801-10.el7.noarch --> Processing Dependency: urw-base35-gothic-fonts for package: urw-base35-fonts-20170801-10.el7.noarch --> Processing Dependency: urw-base35-d050000l-fonts for package: urw-base35-fonts-20170801-10.el7.noarch --> Processing Dependency: urw-base35-c059-fonts for package: urw-base35-fonts-20170801-10.el7.noarch --> Processing Dependency: urw-base35-bookman-fonts for package: urw-base35-fonts-20170801-10.el7.noarch --> Running transaction check ---> Package urw-base35-bookman-fonts.noarch 0:20170801-10.el7 will be installed --> Processing Dependency: xorg-x11-server-utils for package: urw-base35-bookman-fonts-20170801-10.el7.noarch --> Processing Dependency: xorg-x11-server-utils for package: urw-base35-bookman-fonts-20170801-10.el7.noarch ---> Package urw-base35-c059-fonts.noarch 0:20170801-10.el7 will be installed ---> Package urw-base35-d050000l-fonts.noarch 0:20170801-10.el7 will be installed ---> Package urw-base35-fonts-common.noarch 0:20170801-10.el7 will be installed ---> Package urw-base35-gothic-fonts.noarch 0:20170801-10.el7 will be installed ---> Package urw-base35-nimbus-mono-ps-fonts.noarch 0:20170801-10.el7 will be installed ---> Package urw-base35-nimbus-roman-fonts.noarch 0:20170801-10.el7 will be installed ---> Package urw-base35-nimbus-sans-fonts.noarch 0:20170801-10.el7 will be installed ---> Package urw-base35-p052-fonts.noarch 0:20170801-10.el7 will be installed ---> Package urw-base35-standard-symbols-ps-fonts.noarch 0:20170801-10.el7 will be installed ---> Package urw-base35-z003-fonts.noarch 0:20170801-10.el7 will be installed --> Running transaction check ---> Package xorg-x11-server-utils.x86_64 0:7.7-20.el7 will be installed --> Processing Dependency: libXxf86misc.so.1()(64bit) for package: xorg-x11-server-utils-7.7-20.el7.x86_64 --> Processing Dependency: libXt.so.6()(64bit) for package: xorg-x11-server-utils-7.7-20.el7.x86_64 --> Processing Dependency: libXrandr.so.2()(64bit) for package: xorg-x11-server-utils-7.7-20.el7.x86_64 --> Processing Dependency: libXmuu.so.1()(64bit) for package: xorg-x11-server-utils-7.7-20.el7.x86_64 --> Processing Dependency: libXmu.so.6()(64bit) for package: xorg-x11-server-utils-7.7-20.el7.x86_64 --> Processing Dependency: libXinerama.so.1()(64bit) for package: xorg-x11-server-utils-7.7-20.el7.x86_64 --> Processing Dependency: libXcursor.so.1()(64bit) for package: xorg-x11-server-utils-7.7-20.el7.x86_64 --> Running transaction check ---> Package libXcursor.x86_64 0:1.1.15-1.el7 will be installed ---> Package libXinerama.x86_64 0:1.1.3-2.1.el7 will be installed ---> Package libXmu.x86_64 0:1.1.2-2.el7 will be installed ---> Package libXrandr.x86_64 0:1.5.1-2.el7 will be installed ---> Package libXt.x86_64 0:1.1.5-3.el7 will be installed ---> Package libXxf86misc.x86_64 0:1.0.3-7.1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ========================================================================================================================================================================================================= Package Arch Version Repository Size ========================================================================================================================================================================================================= Installing: grafana x86_64 6.5.2-1 /grafana-6.5.2-1.x86_64 168 M Installing for dependencies: libXcursor x86_64 1.1.15-1.el7 base 30 k libXinerama x86_64 1.1.3-2.1.el7 base 14 k libXmu x86_64 1.1.2-2.el7 base 71 k libXrandr x86_64 1.5.1-2.el7 base 27 k libXt x86_64 1.1.5-3.el7 base 173 k libXxf86misc x86_64 1.0.3-7.1.el7 base 19 k urw-base35-bookman-fonts noarch 20170801-10.el7 base 852 k urw-base35-c059-fonts noarch 20170801-10.el7 base 879 k urw-base35-d050000l-fonts noarch 20170801-10.el7 base 75 k urw-base35-fonts noarch 20170801-10.el7 base 7.6 k urw-base35-fonts-common noarch 20170801-10.el7 base 19 k urw-base35-gothic-fonts noarch 20170801-10.el7 base 650 k urw-base35-nimbus-mono-ps-fonts noarch 20170801-10.el7 base 796 k urw-base35-nimbus-roman-fonts noarch 20170801-10.el7 base 860 k urw-base35-nimbus-sans-fonts noarch 20170801-10.el7 base 1.3 M urw-base35-p052-fonts noarch 20170801-10.el7 base 978 k urw-base35-standard-symbols-ps-fonts noarch 20170801-10.el7 base 40 k urw-base35-z003-fonts noarch 20170801-10.el7 base 275 k xorg-x11-server-utils x86_64 7.7-20.el7 base 178 k Transaction Summary ========================================================================================================================================================================================================= Install 1 Package (+19 Dependent packages) Total size: 175 M Total download size: 7.1 M Installed size: 180 M Is this ok [y/d/N]: y Downloading packages: (1/19): libXcursor-1.1.15-1.el7.x86_64.rpm | 30 kB 00:00:00 (2/19): libXinerama-1.1.3-2.1.el7.x86_64.rpm | 14 kB 00:00:00 (3/19): libXrandr-1.5.1-2.el7.x86_64.rpm | 27 kB 00:00:00 (4/19): libXmu-1.1.2-2.el7.x86_64.rpm | 71 kB 00:00:00 (5/19): libXxf86misc-1.0.3-7.1.el7.x86_64.rpm | 19 kB 00:00:00 (6/19): urw-base35-bookman-fonts-20170801-10.el7.noarch.rpm | 852 kB 00:00:00 (7/19): libXt-1.1.5-3.el7.x86_64.rpm | 173 kB 00:00:00 (8/19): urw-base35-d050000l-fonts-20170801-10.el7.noarch.rpm | 75 kB 00:00:00 (9/19): urw-base35-fonts-20170801-10.el7.noarch.rpm | 7.6 kB 00:00:00 (10/19): urw-base35-fonts-common-20170801-10.el7.noarch.rpm | 19 kB 00:00:00 (11/19): urw-base35-c059-fonts-20170801-10.el7.noarch.rpm | 879 kB 00:00:00 (12/19): urw-base35-gothic-fonts-20170801-10.el7.noarch.rpm | 650 kB 00:00:00 (13/19): urw-base35-nimbus-roman-fonts-20170801-10.el7.noarch.rpm | 860 kB 00:00:00 (14/19): urw-base35-nimbus-mono-ps-fonts-20170801-10.el7.noarch.rpm | 796 kB 00:00:00 (15/19): urw-base35-nimbus-sans-fonts-20170801-10.el7.noarch.rpm | 1.3 MB 00:00:00 (16/19): urw-base35-standard-symbols-ps-fonts-20170801-10.el7.noarch.rpm | 40 kB 00:00:00 (17/19): urw-base35-z003-fonts-20170801-10.el7.noarch.rpm | 275 kB 00:00:00 (18/19): xorg-x11-server-utils-7.7-20.el7.x86_64.rpm | 178 kB 00:00:00 (19/19): urw-base35-p052-fonts-20170801-10.el7.noarch.rpm | 978 kB 00:00:00 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 22 MB/s | 7.1 MB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : urw-base35-fonts-common-20170801-10.el7.noarch 1/20 Installing : libXt-1.1.5-3.el7.x86_64 2/20 Installing : libXmu-1.1.2-2.el7.x86_64 3/20 Installing : libXxf86misc-1.0.3-7.1.el7.x86_64 4/20 Installing : libXrandr-1.5.1-2.el7.x86_64 5/20 Installing : libXinerama-1.1.3-2.1.el7.x86_64 6/20 Installing : libXcursor-1.1.15-1.el7.x86_64 7/20 Installing : xorg-x11-server-utils-7.7-20.el7.x86_64 8/20 Installing : urw-base35-c059-fonts-20170801-10.el7.noarch 9/20 Installing : urw-base35-z003-fonts-20170801-10.el7.noarch 10/20 Installing : urw-base35-nimbus-mono-ps-fonts-20170801-10.el7.noarch 11/20 Installing : urw-base35-d050000l-fonts-20170801-10.el7.noarch 12/20 Installing : urw-base35-p052-fonts-20170801-10.el7.noarch 13/20 Installing : urw-base35-nimbus-roman-fonts-20170801-10.el7.noarch 14/20 Installing : urw-base35-standard-symbols-ps-fonts-20170801-10.el7.noarch 15/20 Installing : urw-base35-bookman-fonts-20170801-10.el7.noarch 16/20 Installing : urw-base35-nimbus-sans-fonts-20170801-10.el7.noarch 17/20 Installing : urw-base35-gothic-fonts-20170801-10.el7.noarch 18/20 Installing : urw-base35-fonts-20170801-10.el7.noarch 19/20 Installing : grafana-6.5.2-1.x86_64 20/20 ### NOT starting on installation, please execute the following statements to configure grafana to start automatically using systemd sudo /bin/systemctl daemon-reload sudo /bin/systemctl enable grafana-server.service ### You can start grafana-server by executing sudo /bin/systemctl start grafana-server.service POSTTRANS: Running script Verifying : urw-base35-fonts-20170801-10.el7.noarch 1/20 Verifying : libXmu-1.1.2-2.el7.x86_64 2/20 Verifying : urw-base35-c059-fonts-20170801-10.el7.noarch 3/20 Verifying : libXcursor-1.1.15-1.el7.x86_64 4/20 Verifying : urw-base35-z003-fonts-20170801-10.el7.noarch 5/20 Verifying : urw-base35-nimbus-mono-ps-fonts-20170801-10.el7.noarch 6/20 Verifying : urw-base35-d050000l-fonts-20170801-10.el7.noarch 7/20 Verifying : urw-base35-p052-fonts-20170801-10.el7.noarch 8/20 Verifying : urw-base35-nimbus-roman-fonts-20170801-10.el7.noarch 9/20 Verifying : libXinerama-1.1.3-2.1.el7.x86_64 10/20 Verifying : urw-base35-standard-symbols-ps-fonts-20170801-10.el7.noarch 11/20 Verifying : libXrandr-1.5.1-2.el7.x86_64 12/20 Verifying : urw-base35-bookman-fonts-20170801-10.el7.noarch 13/20 Verifying : libXxf86misc-1.0.3-7.1.el7.x86_64 14/20 Verifying : libXt-1.1.5-3.el7.x86_64 15/20 Verifying : xorg-x11-server-utils-7.7-20.el7.x86_64 16/20 Verifying : urw-base35-fonts-common-20170801-10.el7.noarch 17/20 Verifying : grafana-6.5.2-1.x86_64 18/20 Verifying : urw-base35-nimbus-sans-fonts-20170801-10.el7.noarch 19/20 Verifying : urw-base35-gothic-fonts-20170801-10.el7.noarch 20/20 Installed: grafana.x86_64 0:6.5.2-1 Dependency Installed: libXcursor.x86_64 0:1.1.15-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 libXt.x86_64 0:1.1.5-3.el7 libXxf86misc.x86_64 0:1.0.3-7.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-server-utils.x86_64 0:7.7-20.el7 Complete! [root@emr-header-1 ~]# |
配置文件默认位于/etc/grafana/grafana.ini,3000为Grafana的默认侦听端口。下载安装完成后,输入对应操作系统的启动命令来启动Grafana服务。以Centos为例:
1 2 |
[root@emr-header-1 ~]# service grafana-server start Starting grafana-server (via systemctl): [ OK ] |
Grafana服务启动后,就可以通过浏览器访问了:
Grafana的默认管理员账号密码为admin/admin,首次登陆可根据您的需要修改管理员默认密码。
在主页点击Add data source,进入数据源设置界面,配置InfluxDB基本网络、权限、数据库等信息:
其中:
1)URL:填写InfluxDB的地址;
2)InfluxDB Details:填写将要访问的数据库、对应数据库的用户名及密码信息;
接下来,让我们新建一个Dashboard。Dashboard是Grafana可视化展示的重要组件,Grafana会根据好配置的查询规则向时序数据库查询数据并展示在Dashboard上。下面以Graph类型为例,配置一个Dashboard:
(1)Data Source处选择配置好的Data Source;
(2)在FROM后方先写的两个值分别为RETENTION POLOCY与MEASUREMENT;
(3)WHERE后填写的是tag filter,可添加多个;
(4)SELECT后是field与聚合函数的查询条件,特别是如果配置了一个time的group by条件的话,需要在这里配置聚合函数。聚合函数的执行顺序是从左往右的;
(5)GROUP BY后填写的是group by条件,可以配置group by 时间或group by tag,也可以配置排序与limit;
(6)FORMAT AS配置的是显示方式,分为Time Series和Table;
(7)ALIAS BY后配置的是measurement或tag的别名;
(8)通过右上角的Add Query可以配置多个子查询;
(9)配置完成后点击页面上方的保存按钮保存;
根据配置的查询,数据会即时显示在Graph中,根据查询规则的不同,展示效果也有所区别。除了默认的Graphic外还有多种显示方式:
如果要修改已有的Dashboard,可以点击标题栏,然后选择Edit:
转载时请保留出处,违法转载追究到底:进城务工人员小梅 » Centos 7.4上Grafana的安装及与InfluxDB搭配的简单使用