查询某个端口再一段时间内的流量值
#查询语句,选取时间段(2021-12-26 23:35:00 - 2021-12-26 23:39:59)
SELECT date_format(from_unixtime(clock), '%Y-%m-%d %H:%i') as time , itemid, value
FROM history_uint
WHERE itemid IN (41201,41202, 41187,41188)
AND clock >= 1640532900 AND clock <= 1640533199
ORDER BY time
结果按时间求和
SELECT
unix_timestamp(time) as time_sec,
(SUM(value)/1024/1024/1024) as value,
'Out端口流量汇总(原始数据)' as metric
FROM
(SELECT date_format(from_unixtime(clock), '%Y-%m-%d %H:%i') as time , value
FROM history_uint
WHERE itemid IN (41201,41202, 41187,41188)
AND clock >= 1640532900 AND clock <= 1640533199
ORDER BY time)
AS temp
GROUP BY time;
评论 (0)