diff --git a/README.md b/README.md index 39069e4..3c56e0e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # zaf-plugins -Zabbix Agent Framework plugins repository +Zabbix Agent Framework plugins repository. It contains working set of default plugins. Feel free to contribute. Or write your public and maintain control file on your site. + diff --git a/process-info/README.md b/process-info/README.md new file mode 100644 index 0000000..0a5b2f2 --- /dev/null +++ b/process-info/README.md @@ -0,0 +1,8 @@ +# Zaf plugin for detailed process info +This plugin is used to monitor process activity on linux based systems. It supports autodiscovery of processes and next to this it will show CPU and memory usage of each process. +Please note that this plugin is very simple plugin for domonstrating possibilities. It cannot catch all processes because it discovers processes in regular intervals and if process will start and end between this time, it will not be autodiscovered. + +## Usage + +zaf intall process-list + diff --git a/process-info/control b/process-info/control new file mode 100644 index 0000000..0ac27f0 --- /dev/null +++ b/process-info/control @@ -0,0 +1,17 @@ +Plugin: process-info + +Maintainer: Lukas Macura + +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[*]: {PLUGINDIR}/cpu-get.sh + +Item: discovery + Discovery of runing processes +Item-cmd-discovery: {PLUGINDIR}/cpu-get.sh + +Binary-Depends: echo ps awk sort uniq sed + +Install-bin: cpu-get.sh proc-discovery.sh + + diff --git a/process-info/cpu-get.sh b/process-info/cpu-get.sh new file mode 100755 index 0000000..33cf9fe --- /dev/null +++ b/process-info/cpu-get.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +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 + diff --git a/process-info/proc-discovery.sh b/process-info/proc-discovery.sh new file mode 100755 index 0000000..80c6086 --- /dev/null +++ b/process-info/proc-discovery.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +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}" + diff --git a/process-info/template.xml b/process-info/template.xml new file mode 100644 index 0000000..7ddb186 --- /dev/null +++ b/process-info/template.xml @@ -0,0 +1,204 @@ + + + 3.0 + 2016-03-23T09:37:42Z + + + Templates + + + + + +