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>
8 # THIS PLUGIN IS OBSOLETE
9 # USE apps.plugin INSTEAD
11 # a space separated list of command to monitor
14 # these are required for computing memory in bytes and cpu in seconds
15 #cpu_apps_pagesize="`getconf PAGESIZE`"
16 cpu_apps_clockticks="$(getconf CLK_TCK)"
18 cpu_apps_update_every=60
22 # - 0 to enable the chart
23 # - 1 to disable the chart
25 if [ -z "$cpu_apps_apps" ]
27 error "manual configuration required: please set cpu_apps_apps='command1 command2 ...' in $confd/cpu_apps_apps.conf"
37 echo "CHART chartsd_apps.cpu '' 'Apps CPU' 'milliseconds / $cpu_apps_update_every sec' apps apps stacked 20001 $cpu_apps_update_every"
40 for x in $cpu_apps_apps
42 echo "DIMENSION $x $x incremental 1000 $cpu_apps_clockticks"
44 # this string is needed later in the update() function
45 # to finalize the instructions for the bc command
46 cpu_apps_bc_finalze="$cpu_apps_bc_finalze \"SET $x = \"; $x;"
52 # do all the work to collect / calculate the values
54 # remember: KEEP IT SIMPLE AND SHORT
56 echo "BEGIN chartsd_apps.cpu"
57 ps -o pid,comm -C "$cpu_apps_apps" |\
62 echo "$name+=`cat /proc/$pid/stat | cut -d ' ' -f 14-15`"
65 ( sed -e "s/ \+/ /g" -e "s/ /+/g";
66 echo "$cpu_apps_bc_finalze"