mirror of
https://github.com/limosek/zaf-plugins.git
synced 2025-10-31 17:47:37 +01:00
Reworked plgins
This commit is contained in:
8
psx/README.md
Normal file
8
psx/README.md
Normal file
@@ -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
|
||||
|
||||
36
psx/control.zaf
Normal file
36
psx/control.zaf
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
Plugin: psx
|
||||
Description::
|
||||
Plugin which will make deeper look to processess and their usage.
|
||||
::
|
||||
|
||||
Version: 0.1
|
||||
Url: https://raw.githubusercontent.com/limosek/zaf-plugins/master/psx
|
||||
Web: https://github.com/limosek/zaf-plugins/
|
||||
Maintainer: Lukas Macura <lukas@macura.cz>
|
||||
Install-bin: cpu-get.sh proc-discovery.sh
|
||||
|
||||
# Dependencies
|
||||
Depends-dpkg: dash curl
|
||||
Depens-opkg: busybox curl
|
||||
Depends-rpm: curl
|
||||
Depends-bin: curl ps
|
||||
|
||||
Item cpu:
|
||||
Parameters: process_name
|
||||
Description::
|
||||
This item will return cpu usage of given process.
|
||||
In zabbix, it will be prefixed automaticaly by plugin name (psx.cpu)
|
||||
::
|
||||
Cmd: {PLUGINDIR}/cpu-get.sh $1
|
||||
/Item
|
||||
|
||||
Item discovery:
|
||||
Description::
|
||||
Discovery of runing processes
|
||||
::
|
||||
Cmd: {PLUGINDIR}/proc-discovery.sh
|
||||
/Item
|
||||
|
||||
|
||||
|
||||
6
psx/cpu-get.sh
Executable file
6
psx/cpu-get.sh
Executable file
@@ -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
|
||||
|
||||
12
psx/proc-discovery.sh
Executable file
12
psx/proc-discovery.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "${ZAF_PKG}" = "opkg" ]; then
|
||||
AWK='{ print $2" "$5; }'
|
||||
PS="w"
|
||||
else
|
||||
AWK='{ print $1" "$11; }'
|
||||
PS="--no-headers caux"
|
||||
fi
|
||||
|
||||
ps $PS | awk "$AWK" | sort | uniq | sed -e 's/\//\\\//g' -e '$s/.$//' | zaf_discovery '{#PSNAME}' '{#PSUSER}'
|
||||
|
||||
204
psx/template.xml
Normal file
204
psx/template.xml
Normal file
@@ -0,0 +1,204 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<zabbix_export>
|
||||
<version>3.0</version>
|
||||
<date>2016-03-23T09:37:42Z</date>
|
||||
<groups>
|
||||
<group>
|
||||
<name>Templates</name>
|
||||
</group>
|
||||
</groups>
|
||||
<templates>
|
||||
<template>
|
||||
<template>Template Zaf processinfo</template>
|
||||
<name>Template Zaf processinfo</name>
|
||||
<description/>
|
||||
<groups>
|
||||
<group>
|
||||
<name>Templates</name>
|
||||
</group>
|
||||
</groups>
|
||||
<applications>
|
||||
<application>
|
||||
<name>Process Statistics</name>
|
||||
</application>
|
||||
</applications>
|
||||
<items/>
|
||||
<discovery_rules>
|
||||
<discovery_rule>
|
||||
<name>Process Discovery</name>
|
||||
<type>0</type>
|
||||
<snmp_community/>
|
||||
<snmp_oid/>
|
||||
<key>ps.discovery</key>
|
||||
<delay>300</delay>
|
||||
<status>0</status>
|
||||
<allowed_hosts/>
|
||||
<snmpv3_contextname/>
|
||||
<snmpv3_securityname/>
|
||||
<snmpv3_securitylevel>0</snmpv3_securitylevel>
|
||||
<snmpv3_authprotocol>0</snmpv3_authprotocol>
|
||||
<snmpv3_authpassphrase/>
|
||||
<snmpv3_privprotocol>0</snmpv3_privprotocol>
|
||||
<snmpv3_privpassphrase/>
|
||||
<delay_flex/>
|
||||
<params/>
|
||||
<ipmi_sensor/>
|
||||
<authtype>0</authtype>
|
||||
<username/>
|
||||
<password/>
|
||||
<publickey/>
|
||||
<privatekey/>
|
||||
<port/>
|
||||
<filter>
|
||||
<evaltype>0</evaltype>
|
||||
<formula/>
|
||||
<conditions/>
|
||||
</filter>
|
||||
<lifetime>30</lifetime>
|
||||
<description>Discovers running processes via ps.
|
||||
Returns the {#PSNAME} and {#PSUSER} discovery macros which return the process name and owning user respectively.</description>
|
||||
<item_prototypes>
|
||||
<item_prototype>
|
||||
<name>CPU usage of $1 processes owned by $2</name>
|
||||
<type>0</type>
|
||||
<snmp_community/>
|
||||
<multiplier>0</multiplier>
|
||||
<snmp_oid/>
|
||||
<key>proc.cpu[{#PSNAME},{#PSUSER}]</key>
|
||||
<delay>60</delay>
|
||||
<history>14</history>
|
||||
<trends>365</trends>
|
||||
<status>0</status>
|
||||
<value_type>0</value_type>
|
||||
<allowed_hosts/>
|
||||
<units>%</units>
|
||||
<delta>0</delta>
|
||||
<snmpv3_contextname/>
|
||||
<snmpv3_securityname/>
|
||||
<snmpv3_securitylevel>0</snmpv3_securitylevel>
|
||||
<snmpv3_authprotocol>0</snmpv3_authprotocol>
|
||||
<snmpv3_authpassphrase/>
|
||||
<snmpv3_privprotocol>0</snmpv3_privprotocol>
|
||||
<snmpv3_privpassphrase/>
|
||||
<formula>1</formula>
|
||||
<delay_flex/>
|
||||
<params/>
|
||||
<ipmi_sensor/>
|
||||
<data_type>0</data_type>
|
||||
<authtype>0</authtype>
|
||||
<username/>
|
||||
<password/>
|
||||
<publickey/>
|
||||
<privatekey/>
|
||||
<port/>
|
||||
<description/>
|
||||
<inventory_link>0</inventory_link>
|
||||
<applications>
|
||||
<application>
|
||||
<name>Process Statistics</name>
|
||||
</application>
|
||||
</applications>
|
||||
<valuemap/>
|
||||
<logtimefmt/>
|
||||
<application_prototypes/>
|
||||
</item_prototype>
|
||||
<item_prototype>
|
||||
<name>Memory usage of $1 processes owned by $2</name>
|
||||
<type>0</type>
|
||||
<snmp_community/>
|
||||
<multiplier>0</multiplier>
|
||||
<snmp_oid/>
|
||||
<key>proc.mem[{#PSNAME},{#PSUSER},,]</key>
|
||||
<delay>60</delay>
|
||||
<history>14</history>
|
||||
<trends>365</trends>
|
||||
<status>0</status>
|
||||
<value_type>3</value_type>
|
||||
<allowed_hosts/>
|
||||
<units>B</units>
|
||||
<delta>0</delta>
|
||||
<snmpv3_contextname/>
|
||||
<snmpv3_securityname/>
|
||||
<snmpv3_securitylevel>0</snmpv3_securitylevel>
|
||||
<snmpv3_authprotocol>0</snmpv3_authprotocol>
|
||||
<snmpv3_authpassphrase/>
|
||||
<snmpv3_privprotocol>0</snmpv3_privprotocol>
|
||||
<snmpv3_privpassphrase/>
|
||||
<formula>1</formula>
|
||||
<delay_flex/>
|
||||
<params/>
|
||||
<ipmi_sensor/>
|
||||
<data_type>0</data_type>
|
||||
<authtype>0</authtype>
|
||||
<username/>
|
||||
<password/>
|
||||
<publickey/>
|
||||
<privatekey/>
|
||||
<port/>
|
||||
<description/>
|
||||
<inventory_link>0</inventory_link>
|
||||
<applications>
|
||||
<application>
|
||||
<name>Process Statistics</name>
|
||||
</application>
|
||||
</applications>
|
||||
<valuemap/>
|
||||
<logtimefmt/>
|
||||
<application_prototypes/>
|
||||
</item_prototype>
|
||||
<item_prototype>
|
||||
<name>Number of $1 processes owned by $2</name>
|
||||
<type>0</type>
|
||||
<snmp_community/>
|
||||
<multiplier>0</multiplier>
|
||||
<snmp_oid/>
|
||||
<key>proc.num[{#PSNAME},{#PSUSER},,]</key>
|
||||
<delay>60</delay>
|
||||
<history>14</history>
|
||||
<trends>365</trends>
|
||||
<status>0</status>
|
||||
<value_type>3</value_type>
|
||||
<allowed_hosts/>
|
||||
<units/>
|
||||
<delta>0</delta>
|
||||
<snmpv3_contextname/>
|
||||
<snmpv3_securityname/>
|
||||
<snmpv3_securitylevel>0</snmpv3_securitylevel>
|
||||
<snmpv3_authprotocol>0</snmpv3_authprotocol>
|
||||
<snmpv3_authpassphrase/>
|
||||
<snmpv3_privprotocol>0</snmpv3_privprotocol>
|
||||
<snmpv3_privpassphrase/>
|
||||
<formula>1</formula>
|
||||
<delay_flex/>
|
||||
<params/>
|
||||
<ipmi_sensor/>
|
||||
<data_type>0</data_type>
|
||||
<authtype>0</authtype>
|
||||
<username/>
|
||||
<password/>
|
||||
<publickey/>
|
||||
<privatekey/>
|
||||
<port/>
|
||||
<description/>
|
||||
<inventory_link>0</inventory_link>
|
||||
<applications>
|
||||
<application>
|
||||
<name>Process Statistics</name>
|
||||
</application>
|
||||
</applications>
|
||||
<valuemap/>
|
||||
<logtimefmt/>
|
||||
<application_prototypes/>
|
||||
</item_prototype>
|
||||
</item_prototypes>
|
||||
<trigger_prototypes/>
|
||||
<graph_prototypes/>
|
||||
<host_prototypes/>
|
||||
</discovery_rule>
|
||||
</discovery_rules>
|
||||
<macros/>
|
||||
<templates/>
|
||||
<screens/>
|
||||
</template>
|
||||
</templates>
|
||||
</zabbix_export>
|
||||
Reference in New Issue
Block a user