]> arthur.barton.de Git - netdata.git/blob - src/rrd2json.h
first complete API implementation - it now supports multiple different visualizations
[netdata.git] / src / rrd2json.h
1 #include <time.h>
2
3 #include "web_buffer.h"
4 #include "rrd.h"
5
6 #ifndef NETDATA_RRD2JSON_H
7 #define NETDATA_RRD2JSON_H 1
8
9 #define HOSTNAME_MAX 1024
10 extern char *hostname;
11
12 // type of JSON generations
13 #define DATASOURCE_INVALID -1
14 #define DATASOURCE_JSON 0
15 #define DATASOURCE_GOOGLE_JSON 1
16 #define DATASOURCE_GOOGLE_JSONP 2
17 #define DATASOURCE_SSV 3
18 #define DATASOURCE_CSV 4
19 #define DATASOURCE_JSONP 5
20 #define DATASOURCE_TSV 6
21 #define DATASOURCE_HTML 7
22 #define DATASOURCE_JS_ARRAY 8
23 #define DATASOURCE_SSV_COMMA 9
24
25 #define GROUP_AVERAGE   0
26 #define GROUP_MAX               1
27 #define GROUP_SUM               2
28
29 #define RRDR_OPTION_NONZERO             0x00000001 // don't output dimensions will just zero values
30 #define RRDR_OPTION_REVERSED            0x00000002 // output the rows in reverse order (oldest to newest)
31 #define RRDR_OPTION_ABSOLUTE            0x00000004 // values positive, for DATASOURCE_SSV before summing
32 #define RRDR_OPTION_MIN2MAX                     0x00000008 // for DATASOURCE_SSV, out max - min
33 #define RRDR_OPTION_SECONDS                     0x00000010 // output seconds, instead of dates
34 #define RRDR_OPTION_MILLISECONDS        0x00000020 // output milliseconds, instead of dates
35 #define RRDR_OPTION_NULL2ZERO           0x00000040 // do not show nulls, convert them to zeros
36
37 extern void rrd_stats_api_v1_chart(RRDSET *st, BUFFER *wb);
38 extern void rrd_stats_api_v1_charts(BUFFER *wb);
39
40 extern unsigned long rrd_stats_one_json(RRDSET *st, char *options, BUFFER *wb);
41
42 extern void rrd_stats_graph_json(RRDSET *st, char *options, BUFFER *wb);
43
44 extern void rrd_stats_all_json(BUFFER *wb);
45
46 extern unsigned long rrd_stats_json(int type, RRDSET *st, BUFFER *wb, int entries_to_show, int group, int group_method, time_t after, time_t before, int only_non_zero);
47
48 extern int rrd2format(RRDSET *st, BUFFER *out, BUFFER *dimensions, uint32_t format, long points, long long after, long long before, int group_method, uint32_t options, time_t *latest_timestamp);
49
50
51 #endif /* NETDATA_RRD2JSON_H */