summaryrefslogtreecommitdiffstats
path: root/collectors/charts.d.plugin/cpu_apps/cpu_apps.chart.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-02-08 07:31:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-02-08 07:31:03 +0000
commit50485bedfd9818165aa1d039d0abe95a559134b7 (patch)
tree79c7b08f67edcfb0c936e7a22931653b91189b9f /collectors/charts.d.plugin/cpu_apps/cpu_apps.chart.sh
parentReleasing debian version 1.11.1+dfsg-7. (diff)
downloadnetdata-50485bedfd9818165aa1d039d0abe95a559134b7.tar.xz
netdata-50485bedfd9818165aa1d039d0abe95a559134b7.zip
Merging upstream version 1.12.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collectors/charts.d.plugin/cpu_apps/cpu_apps.chart.sh')
-rw-r--r--collectors/charts.d.plugin/cpu_apps/cpu_apps.chart.sh20
1 files changed, 9 insertions, 11 deletions
diff --git a/collectors/charts.d.plugin/cpu_apps/cpu_apps.chart.sh b/collectors/charts.d.plugin/cpu_apps/cpu_apps.chart.sh
index 869464afe..e91c46d54 100644
--- a/collectors/charts.d.plugin/cpu_apps/cpu_apps.chart.sh
+++ b/collectors/charts.d.plugin/cpu_apps/cpu_apps.chart.sh
@@ -23,8 +23,7 @@ cpu_apps_check() {
# - 0 to enable the chart
# - 1 to disable the chart
- if [ -z "$cpu_apps_apps" ]
- then
+ if [ -z "$cpu_apps_apps" ]; then
error "manual configuration required: please set cpu_apps_apps='command1 command2 ...' in $confd/cpu_apps_apps.conf"
return 1
fi
@@ -38,8 +37,7 @@ cpu_apps_create() {
echo "CHART chartsd_apps.cpu '' 'Apps CPU' 'milliseconds / $cpu_apps_update_every sec' apps apps stacked 20001 $cpu_apps_update_every"
local x=
- for x in $cpu_apps_apps
- do
+ for x in $cpu_apps_apps; do
echo "DIMENSION $x $x incremental 1000 $cpu_apps_clockticks"
# this string is needed later in the update() function
@@ -55,15 +53,15 @@ cpu_apps_update() {
# remember: KEEP IT SIMPLE AND SHORT
echo "BEGIN chartsd_apps.cpu"
- ps -o pid,comm -C "$cpu_apps_apps" |\
- grep -v "COMMAND" |\
+ ps -o pid,comm -C "$cpu_apps_apps" |
+ grep -v "COMMAND" |
(
- while read pid name
- do
- echo "$name+=`cat /proc/$pid/stat | cut -d ' ' -f 14-15`"
+ while read pid name; do
+ echo "$name+=$(cat /proc/$pid/stat | cut -d ' ' -f 14-15)"
done
- ) |\
- ( sed -e "s/ \+/ /g" -e "s/ /+/g";
+ ) |
+ (
+ sed -e "s/ \+/ /g" -e "s/ /+/g"
echo "$cpu_apps_bc_finalze"
) | bc
echo "END"