1
0
mirror of https://github.com/limosek/zaf-plugins.git synced 2024-11-01 08:17:19 +01:00
limosek-zaf-plugins/psx/control.zaf

44 lines
886 B
Plaintext
Raw Normal View History

2016-04-01 15:44:35 +02:00
Plugin: psx
Description::
Plugin which will make deeper look to processess and their usage.
::
2016-04-21 15:29:20 +02:00
Version: 0.2
2016-04-01 15:44:35 +02:00
Url: https://raw.githubusercontent.com/limosek/zaf-plugins/master/psx
Web: https://github.com/limosek/zaf-plugins/
Maintainer: Lukas Macura <lukas@macura.cz>
# Dependencies
Depends-dpkg: dash curl
2016-11-28 14:42:01 +01:00
Depends-opkg: busybox curl
2016-04-01 15:44:35 +02:00
Depends-rpm: curl
Depends-bin: curl ps
Item discovery:
Description::
Discovery of runing processes
::
2016-04-21 15:29:20 +02:00
Testparameters: ps systemd,root
Parameters::
pregex '.*' '' # regexp to match process name
uregex '.*' '' # regexp to match user name
::
Script::
if [ "${ZAF_PKG}" = "opkg" ]; then
2016-04-22 09:44:06 +02:00
AWK='{ print $5" "$2; }'
2016-04-21 15:29:20 +02:00
PS="w"
else
AWK='{ print $11" "$1; }'
PS="--no-headers caux"
fi
ps $PS | awk "$AWK" | sort | uniq | sed -e 's/\//\\\//g' -e '$s/.$//' | grep -E "^$pregex" | grep -E "$uregex\$" | zaf_discovery '{#PSNAME}' '{#PSUSER}'
::
2016-04-01 15:44:35 +02:00
/Item