1
0
mirror of https://github.com/limosek/zaf.git synced 2024-11-22 10:29:06 +01:00
limosek-zaf/plugins/process-info/control

16 lines
741 B
Plaintext
Raw Normal View History

2016-03-23 14:37:51 +01:00
Plugin: process-info
Maintainer: Lukas Macura <lukas@macura.cz>
Item: cpu[*]
This item will return cpu usage of given process. In zabbix, it will be prefixed automaticaly by plugin name (processlist.cpu)
Item-cmd-cpu[*]: TOTAL=0; for PROC in $(/bin/ps u -C $1 | /bin/grep -e '^$2' | /usr/bin/awk '{ print $$3 }'); do TOTAL=$(echo "$TOTAL $PROC" | /usr/bin/awk '{print $$1 + $$2}') ; done; echo $TOTAL
Item: discovery
Discovery of runing processes
Item-cmd-discovery: echo "{\n \"data\":[" ; /bin/ps --no-headers caux | /usr/bin/awk '{ print " { \"{#PSUSER}\":\"" $1 "\", \"{#PSNAME}\":\"" $11 "\" },"}' | /usr/bin/sort | /usr/bin/uniq | /bin/sed -e 's/\//\\\//g' -e '$s/.$//' ; echo " ]\n}"
Binary-Depends: echo ps awk sort uniq sed