Version 2 (modified by 3 years ago) (diff) | ,
---|
Influxdb
Export data to csv
OMD[monitor@3aa1bf04cbdd]:~$ influx -database nagflux -execute 'SELECT * FROM metrics' -format csv > test.csv
Select the lastest 2 value from metrics
OMD[monitor@1f46579684ec]:~/etc$ influx Connected to http://127.0.0.1:8086 version 1.8.10 InfluxDB shell version: 1.8.10 > use nagflux Using database nagflux > SELECT * FROM metrics ORDER BY DESC LIMIT 2 name: metrics time command crit crit-fill host max min performanceLabel service unit value warn warn-fill ---- ------- ---- --------- ---- --- --- ---------------- ------- ---- ----- ---- --------- 2022-05-05T10:18:27Z check-host-alive localhost rtmin ping ms 0.014 2022-05-05T10:18:27Z check-host-alive 5000 none localhost 0 rta ping ms 0.028 3000 none > We can select the field to show {{{ > SELECT * FROM metrics WHERE host = 'kmitl' and service = 'ping' and unit = 'ms' ORDER BY DESC LIMIT 2 name: metrics time command crit crit-fill host max min performanceLabel service unit value warn warn-fill ---- ------- ---- --------- ---- --- --- ---------------- ------- ---- ----- ---- --------- 2022-05-05T10:24:53Z check-host-alive kmitl rtmin ping ms 5.407 2022-05-05T10:24:53Z check-host-alive 5000 none kmitl 0 rta ping ms 5.688 3000 none > }}}