grafana5安装与配置

2023年 7月 15日 91.1k 0

grafana能够更好的提供分析展示的工作,而且他很强大,支持的类型也很多,如:graphite,elasticsearch,influxDB,cloudwatch,prometheus,hosted Metrics等,目前支持45个数据源,更多的面板和仪表板等,它还支持很多的插件,社区非常活跃,完全开源,几乎适用于任何指标,提供报警功能,使用grafana将会是一个不错的选择

按照以往惯例,这里会出现一张图用作博客首页展示(^_^)20180812.png

  • 准备工作:

准备使用mysql,先授权下

MariaDB [(none)]> create database grafana character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.02 sec)
MariaDB [(none)]> grant all privileges on grafana.* to 'grafana'@'10.10.240.143' identified by 'MjQzNmVhNTdmY2Fl';
Query OK, 0 rows affected (0.02 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> 

下载安装

axel -n 50 https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.1.4-1.x86_64.rpm
yum localinstall grafana-5.1.4-1.x86_64.rpm -y

可以通过官网的安装信息参考,和官网的配置文件参考centos6启动

[root@linuxea-VM-Node_10_10_240_143 ~]$  service grafana-server start
Starting grafana-server (via systemctl):                   [  确定  ]
[root@linuxea-VM-Node_10_10_240_143 ~]$ /sbin/chkconfig --add grafana-server

centos7启动

[root@linuxea-VM-Node_10_10_240_143 ~]$ systemctl daemon-reload
[root@linuxea-VM-Node_10_10_240_143 ~]$ systemctl start grafana-server
[root@linuxea-VM-Node_10_10_240_143 ~]$ systemctl status grafana-server
[root@linuxea-VM-Node_10_10_240_143 ~]$ systemctl enable grafana-server.service

放行一条防火墙规则[root@linuxea-VM-Node_10_10_240_143 ~]$ iptables -I INPUT -p tcp --dport 3000 -j ACCEPT打开浏览器ip:port,键入admin,admin直接登录即可grafana-1.png登录之后,点击加号选择Dashboard,其中选择Graphgrafana-4.png点击Editgrafana-5.png在Data Source中选择刚才保存的Prometheus,而后键入函数即可sum (rate(container_cpu_usage_seconds_total{image!=""}[5m]))by (name)grafana-6.png关于语句的参考可以直接在官网查看其他用法在后续有时间在写

相关文章

对接alertmanager创建钉钉卡片(1)
手把手教你搭建OpenFalcon监控系统
无需任何魔法即可使用 Ansible 的神奇变量“hostvars”
openobseve HA本地单集群模式
基于k8s上loggie/vector/openobserve日志收集
openobseve单节点和查询语法

发布评论