grafana 8.x配置日报定时发送配置及踩坑经过

本文涉及的产品
可观测可视化 Grafana 版,10个用户账号 1个月
简介: grafana 8.x配置日报定时发送配置及踩坑经过

grafana 8.x配置日报定时发送配置及踩坑经过

环境说明

系统版本:CentOS 7.9

Grafana版本:8.5.2

配置说明

想要每日定时发送系统运行状态给leader和运维管理人员查看,因为开源版本并不具备enterprise那样拥有reporting功能,假如我们需要实现类似的功能,需要依靠IzakMarais/reporter: Service that generates a PDF report from a Grafana dashboard (github.com)这个项目去实现。

安装

安装grafana-reporter

安装texlive包和go

yum install go gityum install texlive-pdftex texlive-latex-bin texlive-texconfig* texlive-latex* texlive-metafont* texlive-cmap* texlive-ec texlive-fncychap* texlive-pdftex-def texlive-fancyhdr* texlive-titlesec* texlive-multirow texlive-framed* texlive-wrapfig* texlive-parskip* texlive-caption texlive-ifluatex* texlive-collection-fontsrecommended texlive-collection-latexrecommended texinfo-tex

获取grafana-reporter的源码和依赖包

go get github.com/IzakMarais/reporter/…

编译安装二进制文件

go install github.com/IzakMarais/reporter/cmd/grafana-reporter@latest

编译完成后,会在go/bin/下生成grafana-reporter二进制文件

添加服务

cat > /etc/systemd/system/grafana-reporter.service << EOF
[Unit]
Description=Grafana Reporter
After=grafana-reporter.service
[Service]
Type=sample
ExecStart=/root/go/bin/grafana-reporter -ip localhost:3000
ExecStop=pkill -9 grafana-report
StandardOutput=syslog
StandardError=syslog
[Install]
WantedBy=multi-user.target
EOF

配置开机自启动

systemctl daemon-reload
systemctl enable --now grafana-reporter.service

防火墙开放8686端口

firewall-cmd --zone=public --permanent--add-port=8686/tcp
firewall-cmd --reload

开始配置grafana links

需要安装Grafana Image Renderer插件,不然可能出现下图所示的错误

grafana-cli plugins install grafana-image-renderer

1.png

重启服务

systemctl restart grafana-server

添加API Keys,roles选择Viewer即可。

2.png

生成后,会显示Key,点击Copy,复制下来Key,准备添加到links配置中

选中需要daily report的dashboard,点击设备按钮开始配置

3.png

4.png

5.png

URL这里填写http://<grafana-access-ip>:3000/api/v5/report/<dashboard-path>?apitoken=<key-create>

6.png

dashboard-path路径可以从这里查看

7.png完成后,回到dashboard,点解report查看是否生效

8.png

假如遇到了下述的问题,那可能是缺少一些依赖包

10.png

我们可以从/var/log/grafana/grafana.log查看到底缺少哪些包,如下图所示

9.png

解决依赖问题

yum install atk -yyum install at-spi2-atk -yyum -y install cups-libs
yum install libXss* -yyum install libX11
yum install -y libXcomposite libXcomposite-devel

假如日志没有其他报错后,应该是可以生成pdf文件了

开始配置定时发送邮件

安装mail

yum install -y mailx

修改/etc/mail.rc,对该文件追加下述内容,因为我用的是qq企业邮箱

cat >> /etc/mail.rc << EOF
setfrom=<mail>
setsmtp=smtps://smtp.exmail.qq.com:465
setsmtp-auth-user=<mail>
setsmtp-auth-password=wbxMo9q9gaUWej5Z
setsmtp-auth=login
setssl-verify=ignore
setnss-config-dir=/etc/pki/nssdb/
EOF

接下来还需要写个脚本自动发送。


目录
相关文章
|
3月前
|
Prometheus Cloud Native Java
微服务框架(二十三)Prometheus + Grafana 安装、配置及使用
此系列文章将会描述Java框架Spring Boot、服务治理框架Dubbo、应用容器引擎Docker,及使用Spring Boot集成Dubbo、Mybatis等开源框架,其中穿插着Spring Boot中日志切面等技术的实现,然后通过gitlab-CI以持续集成为Docker镜像。 本文为Prometheus + Grafana 安装、配置及使用 本系列文章中所使用的框架版本为Spring ...
|
3月前
|
JSON 监控 数据库
使用Telegraf+Influxdb+Grafana配置VMware vSphere监控大屏
使用Telegraf+Influxdb+Grafana配置VMware vSphere监控大屏
68 0
|
3月前
|
Dubbo Java BI
微服务框架(二十六)Grafana dashboard 定时报表
此系列文章将会描述Java框架Spring Boot、服务治理框架Dubbo、应用容器引擎Docker,及使用Spring Boot集成Dubbo、Mybatis等开源框架,其中穿插着Spring Boot中日志切面等技术的实现,然后通过gitlab-CI以持续集成为Docker镜像。 本文为使用grafana-reporter生成grafana dashboard报表,并使用定时任务邮件发送
|
4月前
|
Prometheus 数据可视化 Cloud Native
Grafana【部署 02】可视化工具 Grafana 9 最新版下载安装配置及使用(新特性体验)
Grafana【部署 02】可视化工具 Grafana 9 最新版下载安装配置及使用(新特性体验)
94 0
|
4月前
|
存储 数据可视化 关系型数据库
Grafana【部署 01】可视化工具 Grafana 8.2.0 专业版安装配置及使用(SHA256完整性验证)
Grafana【部署 01】可视化工具 Grafana 8.2.0 专业版安装配置及使用(SHA256完整性验证)
58 0
|
4月前
|
存储 数据可视化 数据库
InfluxData【付诸实践 01】Windows环境部署Telegraf+Influxdb+Grafana安装及使用配置(含百度云盘资源+demo脚本)
InfluxData【付诸实践 01】Windows环境部署Telegraf+Influxdb+Grafana安装及使用配置(含百度云盘资源+demo脚本)
83 0
|
4月前
|
Prometheus 监控 Cloud Native
配置Grafana
配置Grafana
36 1
|
4月前
|
Prometheus Kubernetes Cloud Native
k8s grafana 安装插件配置
k8s grafana 安装插件配置
127 1
|
4月前
|
监控 数据安全/隐私保护 时序数据库
grafana的配置内容
grafana的配置内容
42 2
|
4月前
|
Prometheus 监控 数据可视化
配置grafana的具体情况
配置grafana的具体情况
32 2