grafana用户
user: admin
password: xxxx
配置数据源
configuration图标--->datasource--->settings--->mysql--->配置数据库地址和连接
配置图表(比如通过mysql语句形成横纵坐标)
add符号--->create dashboard--->add query(建立查询语句)--->queries to db(选择数据库名)--->构造查询语句
时间横轴和指标纵轴
grafana sql:Data points outside time range
一定要有as time 或者 as time_sec 转换为时间戳或者Unix 时间戳, 作为横轴;
剩下的作为衡量指标, 作为纵轴
====> ctrl+s保存为新面板放在自己文件夹下。
SELECT
UNIX_TIMESTAMP(data_time) as time_sec,
current_offset, last_offset, offset_diff
FROM monitor_kafka_offsets;
SELECT
UNIX_TIMESTAMP(data_time) as time_sec,
current_offset,
last_offset,
offset_diff
FROM monitor_kafka_offsets
where cluster in ($cluster)
and topic in ($topic)
and frequency in($frequency);
SELECT