]> arthur.barton.de Git - netdata.git/blob - charts.d/example.chart.sh
added support for different update frequency per chart in charts.d.plugin
[netdata.git] / charts.d / example.chart.sh
1 #!/bin/sh
2
3 example_update_every=
4
5 example_check() {
6         # this should return:
7         #  - 0 to enable the chart
8         #  - 1 to disable the chart
9
10         return 0
11 }
12
13 example_create() {
14 # create the chart with 3 dimensions
15 cat <<EOF
16 CHART example.random '' "Random Numbers Stacked Chart" "% of random numbers" random random stacked 5000 $example_update_every
17 DIMENSION random1 '' percentage-of-absolute-row 1 1
18 DIMENSION random2 '' percentage-of-absolute-row 1 1
19 DIMENSION random3 '' percentage-of-absolute-row 1 1
20 EOF
21
22         return 0
23 }
24
25 example_update() {
26         # the first argument to this function is the microseconds since last update
27         # pass this parameter to the BEGIN statement (see bellow).
28
29         # do all the work to collect / calculate the values
30         # for each dimension
31         # remember: KEEP IT SIMPLE AND SHORT
32
33         value1=$RANDOM
34         value2=$RANDOM
35         value3=$RANDOM
36
37         # write the result of the work.
38         cat <<VALUESEOF
39 BEGIN example.random $1
40 SET random1 = $value1
41 SET random2 = $value2
42 SET random3 = $value3
43 END
44 VALUESEOF
45
46         return 0
47 }
48