3 mem_apps_apps="netdata asterisk squid apache2 mysqld dovecot cupsd sshd named clamd smbd"
5 # these are required for computing memory in bytes and cpu in seconds
6 #mem_apps_pagesize="`getconf PAGESIZE`"
7 #mem_apps_clockticks="`getconf CLK_TCK`"
11 # - 0 to enable the chart
12 # - 1 to disable the chart
14 if [ -z "$mem_apps_apps" ]
16 echo >&2 "mem_apps: Please set mem_apps_apps='command1 command2 ...' in $confd/mem_apps_apps.conf"
27 CHART system.apps '' "Apps Memory" "MB" "mem" "mem" stacked 20000 $update_every
31 for x in $mem_apps_apps
35 DIMENSION $x $x absolute 1 1024
37 # this string is needed later in the update() function
38 # to finalize the instructions for the bc command
39 mem_apps_bc_finalze="$mem_apps_bc_finalze \"SET $x = \"; $x;"
44 mem_apps_egrep="(`echo "$mem_apps_apps" | sed -e "s/^ \+//g" -e "s/ \+$//g" -e "s/ /|/g"`)"
46 # do all the work to collect / calculate the values
48 # remember: KEEP IT SIMPLE AND SHORT
50 echo "BEGIN system.apps"
52 egrep "^$mem_apps_egrep " |\
53 ( sed -e "s/ \+/ /g" -e "s/ /+=/g";
54 echo "$mem_apps_bc_finalze"