wget https://dl.grafana.com/oss/release/grafana-7.0.4-1.x86_64.rpm
yum localinstall grafana-7.0.4-1.x86_64.rpm
systemctl daemon-reload
systemctl enable grafana-server.service
systemctl start grafana-server.service
netstat -an | grep 3000
ps -ef | grep grafana
通过浏览器打开:http://localhost:3000/,
系统默认用户名和密码为admin/admin
首先设置 Data Sources,如下图所示
然后新建一个 Graph 类型的 dashboard,点击 Panel Title,从列表中选择 Edit,将 Data Source 设置成上面给 Data Source 起的名字,并编写 sql 语句
SELECT $__timeEpoch(phpsnmp.snaps.`datetime`), cast(phpsnmp.processors.cpu_load as unsigned int) as value, phpsnmp.processors.cpu_id as metric from phpsnmp.snaps,phpsnmp.processors where $__timeFilter(phpsnmp.snaps.`datetime`) and phpsnmp.snaps.snap_id=phpsnmp.processors.snap_id and phpsnmp.processors.device_id=64 order by phpsnmp.processors.snap_id,phpsnmp.processors.cpu_id
注意:value一定是数值类型,如果是字符串需要转换
最终的显示效果