3 # report our PID back to netdata
4 # this is required for netdata to kill this process when it exits
7 # default sleep function
11 # if found and included, this file overwrites loopsleepms()
12 # with a high resolution timer function for precise looping.
13 . "`dirname $0`/loopsleepms.sh.inc"
15 # netdata passes the requested update frequency as the first argument
17 update_every=$(( update_every + 1 - 1)) # makes sure it is a number
18 test $update_every -eq 0 && update_every=1 # if it is zero, make it 1
21 # create the chart with 3 dimensions
23 CHART example.load '' "System Load Average" "load" load load line 500 $update_every
24 DIMENSION load1 '1 min' absolute 1 100
25 DIMENSION load5 '5 mins' absolute 1 100
26 DIMENSION load15 '15 mins' absolute 1 100
28 CHART example.random '' "Random Numbers Stacked Chart" "% of random numbers" random random stacked 5000 $update_every
29 DIMENSION random1 '' percentage-of-absolute-row 1 1
30 DIMENSION random2 '' percentage-of-absolute-row 1 1
31 DIMENSION random3 '' percentage-of-absolute-row 1 1
34 # You can create more charts if you like.
35 # Just add more chart definitions.
40 # do all the work to collect / calculate the values
43 # here we parse the system average load
44 # it is decimal (with 2 decimal digits), so we remove the dot and
45 # at the definition we have divisor = 100, to have the graph show the right value
46 loadavg="`cat /proc/loadavg | sed -e "s/\.//g"`"
47 load1=`echo $loadavg | cut -d ' ' -f 1`
48 load5=`echo $loadavg | cut -d ' ' -f 2`
49 load15=`echo $loadavg | cut -d ' ' -f 3`
55 # write the result of the work.
70 # if you have more charts, add BEGIN->END statements here
72 # wait the time you are required to
73 loopsleepms $update_every