summaryrefslogtreecommitdiffstats
path: root/collectors/charts.d.plugin/cpu_apps
diff options
context:
space:
mode:
Diffstat (limited to 'collectors/charts.d.plugin/cpu_apps')
-rw-r--r--collectors/charts.d.plugin/cpu_apps/README.md6
-rw-r--r--collectors/charts.d.plugin/cpu_apps/cpu_apps.chart.sh20
2 files changed, 14 insertions, 12 deletions
diff --git a/collectors/charts.d.plugin/cpu_apps/README.md b/collectors/charts.d.plugin/cpu_apps/README.md
index cd8adf0a2..a32a6330a 100644
--- a/collectors/charts.d.plugin/cpu_apps/README.md
+++ b/collectors/charts.d.plugin/cpu_apps/README.md
@@ -1,2 +1,6 @@
+# cpu_apps
+
> THIS MODULE IS OBSOLETE.
-> USE APPS.PLUGIN.
+> USE [APPS.PLUGIN](../../apps.plugin).
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fcpu_apps%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
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"