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