升级grafana
缘起
目前的grafana版本过低,只有在状态变化的时候才发送报警的提醒
Grafana sends notifications on state changes, so OK -> Alerting, Alerting -> OK, OK -> NoData, etc
高版本有work around可以解决:
This is possible since 5.3 if you configure alert reminder at the same or lower interval as the alert rule.
It’s not exactly what’s described in this issue but its close enough that we won’t implement this feature.
当前配置信息
当前版本:
1 | [qisheng.li@yd-devops-web yum.repos.d]$ sudo yum list installed | grep grafana |
启动脚本:
1 | [qisheng.li@yd-devops-web yum.repos.d]$ ps axu | grep grafana |
LDAP配置:
1 | #################################### Auth LDAP ########################## |
风险评估
grafana只是作为展示层,升级对程序打点和数据收集无影响,而且grafana是后向兼容的;升级只会影响监控的查看和报警。
We recommend everyone to upgrade Grafana often to stay up to date with the latest fixes and enhancements. In order make this a reality Grafana upgrades are backward compatible and the upgrade process is simple & quick.
升级步骤
备份配置文件
- /etc/grafana/grafana.ini
- /etc/grafana/ldap.toml
1 | [qisheng.li@yd-devops-web yum.repos.d]$ sudo cp -p /etc/grafana/ldap.toml ~/ |
备份db
1 | [qisheng.li@yd-devops-web yum.repos.d]$ sudo cp -p /var/lib/grafana/grafana.db ~/ |
更新yum源
aliyun的yum的最新版本是4.6.3
是我们当前使用的版本
1 | [qisheng.li@yd-devops-web yum.repos.d]$ yum info grafana |
添加grafana的源Installing on RPM-based Linux | Grafana Documentation
新建配置文件/etc/yum.repos.d/grafana.repo
键入一下内容:
1 | [grafana] |
grafana也提供了beta的源,生产环境不建议使用。
再次查看yum信息
1 | [qisheng.li@yd-devops-web yum.repos.d]$ yum info grafana |
可以拿到5.4.2
的信息了
升级版本
1 | [qisheng.li@yd-devops-web yum.repos.d]$ sudo yum update grafana |
配置reminder
这样如果处于alert状态就会每隔30s报一次