mirror of
https://github.com/limosek/zaf-plugins.git
synced 2025-01-21 07:25:56 +01:00
Updated fsx plugin with precache and testparms
This commit is contained in:
parent
2c80379ec5
commit
290cf520a9
@ -4,7 +4,7 @@ Description::
|
||||
Plugin which will make deeper look into directory structure using discovery
|
||||
::
|
||||
|
||||
Version: 0.2
|
||||
Version: 0.3
|
||||
Url: https://raw.githubusercontent.com/limosek/zaf-plugins/master/fsx
|
||||
Web: https://github.com/limosek/zaf-plugins/
|
||||
Maintainer: Lukas Macura <lukas@macura.cz>
|
||||
@ -26,32 +26,56 @@ Sudo: /usr/bin/find %, {PLUGINDIR}/%sh %
|
||||
|
||||
Item discovery:
|
||||
Description::
|
||||
Discovery of files or directories. Enter % instead of * in mask. If first argument is "asroot", sudo will be used. It must be configured.
|
||||
Discovery of files or directories.
|
||||
{asroot|aszabbix} - which permissions to use. Sudo must be installed for asroot
|
||||
directory - directory to scan
|
||||
mask - mask to search. Use % instead of * in mask. Like '%' to find all objects, '%.txt' to find all .txt files
|
||||
maxdepth - depth to search. 1 means only one directory, not subdirs
|
||||
type - Type of objects to find (f=file,d=dir,l=link)
|
||||
sort - how to sort results (name/[+-], du/[+-])
|
||||
maxobjects - maximum objects to find. 0 means no limit.
|
||||
::
|
||||
Parameters: asroot directory mask depth type
|
||||
Parameters: {asroot|aszabbix} directory mask maxdepth type sort maxobjects
|
||||
Type: string
|
||||
Testparameters: aszabbix,/tmp/,%,10,d,name/+,0 aszabbix,/tmp/,%,10,d,du/+,10 asroot,/var/lib/dpkg/,%,1,d,name/-,10
|
||||
Precache: aszabbix,/tmp/,%,10,d,name/+,0 asroot,/var/,%,100,d,du/-,100
|
||||
Cache: 3600
|
||||
Script::
|
||||
#!/bin/sh
|
||||
|
||||
case $1 in
|
||||
asroot)
|
||||
asroot|root)
|
||||
shift; exec sudo -E -n $0 "$@";;
|
||||
aszabbix)
|
||||
aszabbix|zabbix)
|
||||
shift;;
|
||||
esac
|
||||
. $ZAF_LIB_DIR/preload.sh
|
||||
|
||||
[ -z "$1" ] && zaf_err "Directory must be entered."
|
||||
[ "$#" -lt 6 ] && zaf_err "Bad parameters!"
|
||||
dir="$1"
|
||||
mask="-name '$(echo $2|tr '%' '*')'"
|
||||
depth="-maxdepth $3"
|
||||
if [ -n "$4" ]; then
|
||||
type="-type $4"
|
||||
type="-type $4"
|
||||
sort="$(echo $5|cut -d '/' -f 1)"
|
||||
sortorder="$(echo $5|cut -d '/' -f 2)"
|
||||
[ "$sortorder" = "-" ] && so="-r"
|
||||
maxobjects=$6
|
||||
if [ "$maxobjects" -gt 0 ]; then
|
||||
head="head -n $maxobjects"
|
||||
else
|
||||
head="cat"
|
||||
fi
|
||||
|
||||
eval find "$dir" $depth $type $mask | zaf_discovery '{#PATH}'
|
||||
|
||||
case $sort in
|
||||
name)
|
||||
zaf_dbg find "$dir" $depth $type $mask \| sort $so \| $head \| zaf_discovery '{#PATH}'
|
||||
eval find "$dir" $depth $type $mask | sort $so | $head | zaf_discovery '{#PATH}'
|
||||
;;
|
||||
du)
|
||||
zaf_dbg find "$dir" $depth $type $mask \| xargs du \| sort -n $so \| $head \| zaf_discovery '{#PATH}'
|
||||
eval find "$dir" $depth $type $mask | xargs du | sort -n $so | tr '\t' ' ' | cut -d ' ' -f 2 | $head |zaf_discovery '{#PATH}'
|
||||
;;
|
||||
esac
|
||||
::
|
||||
/Item
|
||||
|
||||
@ -64,6 +88,7 @@ Description::
|
||||
::
|
||||
Parameters: asroot discovered_path
|
||||
Type: character
|
||||
TestParameters: aszabbix,/tmp/
|
||||
Script::
|
||||
#!/bin/sh
|
||||
|
||||
@ -90,6 +115,7 @@ Description::
|
||||
::
|
||||
Parameters: asroot discovered_path
|
||||
Type: integer
|
||||
TestParameters: aszabbix,/tmp/
|
||||
Cache: 3600
|
||||
Script::
|
||||
#!/bin/sh
|
||||
@ -114,6 +140,7 @@ Description::
|
||||
::
|
||||
Parameters: asroot discovered_path
|
||||
Type: integer
|
||||
TestParameters: aszabbix,/tmp/
|
||||
Cache: 600
|
||||
Script::
|
||||
#!/bin/sh
|
||||
|
147
fsx/template.xml
147
fsx/template.xml
@ -31,11 +31,11 @@
|
||||
<items/>
|
||||
<discovery_rules>
|
||||
<discovery_rule>
|
||||
<name>ZAF fsx discovery of /var (under zabbix user)</name>
|
||||
<name>ZAF fsx discovery of biggest directories in /var</name>
|
||||
<type>7</type>
|
||||
<snmp_community/>
|
||||
<snmp_oid/>
|
||||
<key>fsx.discovery[aszabbix,/var/,%,1,d]</key>
|
||||
<key>fsx.discovery[{$FSX_USER},/var/,%,100,d,du/-,100]</key>
|
||||
<delay>300</delay>
|
||||
<status>0</status>
|
||||
<allowed_hosts/>
|
||||
@ -69,7 +69,7 @@
|
||||
<snmp_community/>
|
||||
<multiplier>0</multiplier>
|
||||
<snmp_oid/>
|
||||
<key>fsx.pathinfo_du[aszabbix,{#PATH}]</key>
|
||||
<key>fsx.pathinfo_du[{$FSX_USER},{#PATH}]</key>
|
||||
<delay>600</delay>
|
||||
<history>90</history>
|
||||
<trends>365</trends>
|
||||
@ -119,7 +119,7 @@
|
||||
<snmp_community/>
|
||||
<multiplier>0</multiplier>
|
||||
<snmp_oid/>
|
||||
<key>fsx.pathinfo_items[aszabbix,{#PATH}]</key>
|
||||
<key>fsx.pathinfo_items[{$FSX_USER},{#PATH}]</key>
|
||||
<delay>600</delay>
|
||||
<history>90</history>
|
||||
<trends>365</trends>
|
||||
@ -168,145 +168,6 @@
|
||||
<graph_prototypes/>
|
||||
<host_prototypes/>
|
||||
</discovery_rule>
|
||||
<discovery_rule>
|
||||
<name>ZAF fsx discovery of /var (under root user, sudo needed)</name>
|
||||
<type>7</type>
|
||||
<snmp_community/>
|
||||
<snmp_oid/>
|
||||
<key>fsx.discovery[asroot,/var/,%,1,d]</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>Discover directories under /var</description>
|
||||
<item_prototypes>
|
||||
<item_prototype>
|
||||
<name>Path {#PATH} disk usage</name>
|
||||
<type>7</type>
|
||||
<snmp_community/>
|
||||
<multiplier>0</multiplier>
|
||||
<snmp_oid/>
|
||||
<key>fsx.pathinfo_du[asroot,{#PATH}]</key>
|
||||
<delay>600</delay>
|
||||
<history>90</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>Filesystems</name>
|
||||
</application>
|
||||
<application>
|
||||
<name>fsx</name>
|
||||
</application>
|
||||
<application>
|
||||
<name>ZAF</name>
|
||||
</application>
|
||||
</applications>
|
||||
<valuemap/>
|
||||
<logtimefmt/>
|
||||
<application_prototypes/>
|
||||
</item_prototype>
|
||||
<item_prototype>
|
||||
<name>Path {#PATH} items</name>
|
||||
<type>7</type>
|
||||
<snmp_community/>
|
||||
<multiplier>0</multiplier>
|
||||
<snmp_oid/>
|
||||
<key>fsx.pathinfo_items[asroot,{#PATH}]</key>
|
||||
<delay>600</delay>
|
||||
<history>90</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>Filesystems</name>
|
||||
</application>
|
||||
<application>
|
||||
<name>fsx</name>
|
||||
</application>
|
||||
<application>
|
||||
<name>ZAF</name>
|
||||
</application>
|
||||
</applications>
|
||||
<valuemap/>
|
||||
<logtimefmt/>
|
||||
<application_prototypes/>
|
||||
</item_prototype>
|
||||
</item_prototypes>
|
||||
<trigger_prototypes/>
|
||||
<graph_prototypes/>
|
||||
<host_prototypes/>
|
||||
</discovery_rule>
|
||||
|
||||
</discovery_rules>
|
||||
<macros/>
|
||||
<templates/>
|
||||
|
Loading…
Reference in New Issue
Block a user