1 # no need for shebang - this file is loaded from charts.d.plugin
4 # real-time performance and health monitoring, done right!
5 # (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
9 load_average_update_every=5
12 # this is an example charts.d collector
13 # it is disabled by default.
14 # there is no point to enable it, since netdata already
15 # collects this information using its internal plugins.
16 load_average_enabled=0
18 load_average_check() {
20 # - 0 to enable the chart
21 # - 1 to disable the chart
23 if [ ${load_average_update_every} -lt 5 ]
25 # there is no meaning for shorter than 5 seconds
26 # the kernel changes this value every 5 seconds
27 load_average_update_every=5
30 [ ${load_average_enabled} -eq 0 ] && return 1
34 load_average_create() {
35 # create a chart with 3 dimensions
37 CHART system.load '' "System Load Average" "load" load system.load line $((load_priority + 1)) $load_average_update_every
38 DIMENSION load1 '1 min' absolute 1 100
39 DIMENSION load5 '5 mins' absolute 1 100
40 DIMENSION load15 '15 mins' absolute 1 100
46 load_average_update() {
47 # do all the work to collect / calculate the values
49 # remember: KEEP IT SIMPLE AND SHORT
51 # here we parse the system average load
52 # it is decimal (with 2 decimal digits), so we remove the dot and
53 # at the definition we have divisor = 100, to have the graph show the right value
54 loadavg="`cat /proc/loadavg | sed -e "s/\.//g"`"
55 load1=`echo $loadavg | cut -d ' ' -f 1`
56 load5=`echo $loadavg | cut -d ' ' -f 2`
57 load15=`echo $loadavg | cut -d ' ' -f 3`
59 # write the result of the work.