Obtain data from InfluxDB and Grafana
古いコメントを表示
Hi!
I need to download data from Grafana through InfluxDB. I know it is possible to do it in Python using a specific package. I was wondering if it is possible to do the same in MATLAB. Reading the forum, I saw that there are a couple of functions that could be used, but I would like to understand if there is an official Matlab Toolbox or some function that I coud use instead having an API Token to access the data.
Thank you,
Andrea
採用された回答
その他の回答 (1 件)
Kotya Karapetyan
2026 年 4 月 17 日
For the sake of completeness, this is how I do it:
user = '<username>';
pass = '<pwd>';
url = 'https://<domain>.com:1443';
db = <db_name>;
opts = weboptions('Username', user, 'Password', pass, ...
'ContentType', 'json', 'Timeout', 60);
t_start_ms = round(posixtime(start_datetime)) * 1000;
t_end_ms = round(posixtime(end_datetime)) * 1000;
q = sprintf('SELECT mean("<signal>.average") FROM "<table>" WHERE "<signal>.average">0 and time >= %dms AND time <= %dms GROUP BY time(1m) fill(0)', t_start_ms, t_end_ms);
resp = webread([url '/query'], 'db', db, 'epoch', 's', 'q', q, opts);
results = resp.results.series.values;
カテゴリ
ヘルプ センター および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!