]> arthur.barton.de Git - netdata.git/blob - charts.d/example.chart.sh
supports for charts.d scripts and plugins.d plugins
[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         # do all the work to collect / calculate the values
25         # for each dimension
26         # remember: KEEP IT SIMPLE AND SHORT
27
28         value1=$RANDOM
29         value2=$RANDOM
30         value3=$RANDOM
31
32         # write the result of the work.
33         cat <<VALUESEOF
34 BEGIN example.random
35 SET random1 = $value1
36 SET random2 = $value2
37 SET random3 = $value3
38 END
39 VALUESEOF
40
41         return 0
42 }
43