-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
398 lines (394 loc) · 13.5 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<title>RRDTool_API</title>
<link rel="shortcut icon" href="icon.png" />
<style>
{
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid black;
}
td {
vertical-align: top;
padding-bottom: 12px;
}
tr:hover {
background-color: #f5f5f5;
}
th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #d3d3d3;
color: black;
}
a {
color:blue;
display: inline;
font-weight: bold;
}
</style>
</head>
<body>
<h2>HTTP API for RRDtool</h2>
<a href='https://oss.oetiker.ch/rrdtool' target='_blank'><u>RRDtool Website</u></a><br>
<br>
<table>
<tr>
<th>Action</th>
<th>Method</th>
<th>URL-Path + Query-String</th>
<th>success</th>
<th>ETag</th>
<th>failed/not found</th>
</tr>
<tr>
<td colspan=6 style="background-color: #f2f2f2;"><br>
<b>*** Survey ***</b><br><br></td>
</tr>
<tr>
<td>functional survey (this page)</td>
<td>
GET
</td>
<td>/</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>README.md<br>
Markdown Viewer plugin necessary to format the response</td>
<td>
GET
</td>
<td>
<a href='../README'><u>/README</u></a>
</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>TIME_FORMATS.md<br>
Markdown Viewer plugin necessary to format the response</td>
<td>
GET
</td>
<td>
<a href='../TIME_FORMATS'><u>/TIME_FORMATS</u></a>
</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td colspan=6 style="background-color: #f2f2f2;"><br>
<b>*** API ***</b> responds with JSON structure
, JSON Viewer plugin necessary to format the response<br><br></td>
</tr>
<tr>
<td>API version</td>
<td>
GET
</td>
<td>
<a href='../version'><u>/version</u></a>
</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>display a list of all rrd database files <db>.rrd</td>
<td>
GET
</td>
<td>
<a href='../list_databases'><u>/list_databases</u></a>
</td>
<td>200</td>
<td></td>
<td>900</td>
</tr>
<tr>
<td>rrdtool update: add a new row</td>
<td>
POST, GET
</td>
<td><b>/<db>/update?ts=<timestamp|N>&values=<values[:...]></b></td>
<td>200</td>
<td></td>
<td>900</td>
</tr>
<tr>
<td>rrdtool fetch: get data from db<br>
defaults:<br>
cf: LAST<br>
e: now<br>
l: 1d<br>
s: end-<length><br>
r: highest resolution<br>
times: yes
</td>
<td>
GET
</td>
<td><b>/<db>/fetch [?<options>]</b><br>
possible options:<br>
cf=<LAST|AVERAGE|MIN|MAX><br>
e=<end time><br>
l=<length><br>
s=<start time><br>
r=<resolution><br>
times=<yes|no>
</td>
<td>200</td>
<td></td>
<td>900</td>
</tr>
<tr>
<td>rrdtool first: get timestamp of first stored data<br>
defaults:<br>
rra: 0<br>
</td>
<td>
GET
</td>
<td><b>/<db>/first [?rra=<rraindex>]</b></td>
<td>200</td>
<td></td>
<td>900</td>
</tr>
<tr>
<td>rrdtool last+lastupdate: get timestamp and values of last stored data</td>
<td>
GET
</td>
<td><b>/<db>/last</b></td>
<td>200</td>
<td></td>
<td>900</td>
</tr>
<tr>
<td>rrdtool info: show header information of db</td>
<td>
GET
</td>
<td><b>/<db>/info</b></td>
<td>200</td>
<td></td>
<td>900</td>
</tr>
<tr>
<td>rrdtool dump: dump db in xml format</td>
<td>
GET
</td>
<td><b>/<db>/dump</b></td>
<td>200</td>
<td></td>
<td>900</td>
</tr>
<tr>
<td colspan=6 style="background-color: #f2f2f2;"><br><b>*** Graphs ***</b><br><br></td>
</tr>
<tr>
<td>display a list of all existing graph definition files ./graphs_def/<graph>.def</td>
<td>
GET
</td>
<td>
<a href='../list_graph_definitions'><u>/list_graph_definitions</u></a>
</td>
<td>200</td>
<td></td>
<td>900</td>
</tr>
<tr>
<td>print graph definition<br>
defaults:<br>
g: all existing graph definitions
</td>
<td>
GET
</td>
<td>
<a href='../print_graph_definition'><u>
/print_graph_definition</u></a><b> [?<options>]</b><br>
possible options:<br>
g=<colon separated list of graphs>, *: any characters
</td>
<td>200</td>
<td></td>
<td>900</td>
</tr>
<tr>
<td>create new default graph definition(s) from database file<br>
defaults:<br>
ds: all ds sources from db<br>
name of the new definition file(s): <br>
<db name>-<ds source>.def
</td>
<td>
GET
</td>
<td>
<b>/new_graph_definition?db=<db name>[&ds=<ds source>]</b><br>
possible options:<br>
db=<name of rrd file without path and extension><br>
ds=<ds source>
</td>
<td>200</td>
<td></td>
<td>900</td>
</tr>
<tr>
<td>display a list of all already generated graph image files ./graphs_img/<graph>.*</td>
<td>
GET
</td>
<td>
<a href='../list_graphs'><u>/list_graphs</u></a>
</td>
<td>200</td>
<td></td>
<td>900</td>
</tr>
<tr>
<td>rrdtool graph: build and display new graphs from graph definitions<br>
defaults:<br>
g: all existing graph definitions<br>
html: automatic generated html page<br><br>
if nothing else is specified in definition file:<br>
e: now<br>
l: 1d<br>
s: end-1d<br>
r: highest resolution<br>
w: 1000<br>
h: 300<br>
back: /html/<br>
create_bash: no
</td>
<td>
GET
</td>
<td>
<a href='../build_graph'><u>
/build_graph</u></a> <b>[?<options>]</b><br>
possible options:<br>
g=<colon separated list of graphs>, *: any characters<br>
html=<user html page to start after generation><br>
html=- : don't display a html page after generation<br>
e=<end time><br>
l=<length><br>
s=<start time><br>
r=<resolution><br>
w=<width><br>
h=<height><br>
back=<index path for automatic generated page><br>
create_bash=<yes|no><br>
create_bash=yes : create an additional bash script in tmp folder<br><br>
format for start and end time;<br>
<point in time>[+-<time difference>]<br>
point in time: <br>
now|first|last|start|end|epoch time in seconds<br>
time difference: <br>
<number><interval code>|seconds<br>
interval codes: <br>
m=minute(s), h=hour(s), d=day(s)<br>
w=week(s), M=Month(s), y=year(s)
</td>
<td>200</td>
<td></td>
<td>900</td>
</tr>
<tr>
<td>display already generated graphs<br>
defaults:<br>
g: all generated graphs<br>
back: '/html/'
</td>
<td>
GET
</td>
<td>
<a href='../display_graph'><u>/display_graph</u></a>
<b>[?<options>]</b><br>
possible options:<br>
g=<colon separated list of graphs>, *: any characters<br>
back=<index path for automatic generated page>
</td>
<td>200</td>
<td></td>
<td>900</td>
</tr>
<tr>
<td colspan=6 style="background-color: #f2f2f2;"><br><b>*** User web pages ***</b><br><br></td>
</tr>
<tr>
<td>display a predefined user web page from the html folder<br>
defaults:<br>
htmlfile: index.html
</td>
<td>
GET
</td>
<td>
<a href='../html'><u>/html/</u></a> <b>[<htmlfile>]</b>
</td>
<td>200</td>
<td></td>
<td>900</td>
</tr>
<tr>
<td colspan=6 style="background-color: #f2f2f2;"><br><b>*** SQL like command ***</b><br><br></td>
</tr>
<tr>
<td>invoke a SQL like select<br>
defaults:<br>
columns: *<br>
cf: LAST<br>
end: now<br>
start: end-1d<br>
r: highest resolution<br>
<br>
column names for response:<br>
ts = timestamp<br>
usertime = timestamp as string<br>
<br>
example:<br>
select ts,reading,consumption from electric_meter <br>
where cf = LAST <br>
and ts > 1669503600 and ts <= 1669736328
</td>
<td>
GET
</td>
<td>
<b>/sql?[c=]<command></b><br>
<b>/sql/json?[c=]<command></b><br>
command format:<br>
select <columns> from <database> <br>
where cf = <LAST|AVERAGE|MIN|MAX> <br>
and ts > <start time> <br>
and ts <= <end time><br>
and r = <resolution><br>
epoch time in seconds or milliseconds<br><br>
text response,
each record contains as a string with a comma separated list of values<br><br>
<b>json:</b> json response, array of arrays <br><br>
no columns and and no '*' given:
response starts with a list of column headers
</td>
<td>200</td>
<td></td>
<td>900</td>
</tr>
</table>
</body>
</html>