1
0
mirror of https://github.com/limosek/zaf-plugins.git synced 2025-01-21 07:25:56 +01:00

fsx: precache is working now and discovering most direcories usage

This commit is contained in:
Lukas Macura 2016-04-14 10:00:20 +02:00
parent 290cf520a9
commit 1ae74f8da9

View File

@ -4,7 +4,7 @@ Description::
Plugin which will make deeper look into directory structure using discovery Plugin which will make deeper look into directory structure using discovery
:: ::
Version: 0.3 Version: 0.4
Url: https://raw.githubusercontent.com/limosek/zaf-plugins/master/fsx Url: https://raw.githubusercontent.com/limosek/zaf-plugins/master/fsx
Web: https://github.com/limosek/zaf-plugins/ Web: https://github.com/limosek/zaf-plugins/
Maintainer: Lukas Macura <lukas@macura.cz> Maintainer: Lukas Macura <lukas@macura.cz>
@ -20,9 +20,9 @@ Sudo: /usr/bin/find %, {PLUGINDIR}/%sh %
# Cron for info about busy directories # Cron for info about busy directories
# This is only example to get disk usage of common /var dirs # This is only example to get disk usage of common /var dirs
#Cron:: Cron::
#0 * * * * (zabbix zaf precache 'fsx.pathinfo_du[asroot,/var/]' && zaf precache 'fsx.pathinfo_du[asroot,/var/mail]' && zaf precache 'fsx.pathinfo_du[asroot,/var/lib]') >/dev/null 2>/dev/#null 0 */8 * * * root zaf precache fsx >/dev/null 2>/dev/null
#:: ::
Item discovery: Item discovery:
Description:: Description::
@ -38,8 +38,8 @@ Description::
Parameters: {asroot|aszabbix} directory mask maxdepth type sort maxobjects Parameters: {asroot|aszabbix} directory mask maxdepth type sort maxobjects
Type: string Type: string
Testparameters: aszabbix,/tmp/,%,10,d,name/+,0 aszabbix,/tmp/,%,10,d,du/+,10 asroot,/var/lib/dpkg/,%,1,d,name/-,10 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 Precache: asroot,/var/,%,100,d,du/-,100
Cache: 3600 Cache: 86400
Script:: Script::
#!/bin/sh #!/bin/sh
@ -72,8 +72,8 @@ name)
eval find "$dir" $depth $type $mask | sort $so | $head | zaf_discovery '{#PATH}' eval find "$dir" $depth $type $mask | sort $so | $head | zaf_discovery '{#PATH}'
;; ;;
du) du)
zaf_dbg find "$dir" $depth $type $mask \| xargs du \| sort -n $so \| $head \| zaf_discovery '{#PATH}' zaf_dbg find "$dir" $depth $type $mask -print0 \| xargs -0 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}' eval find "$dir" $depth $type $mask -print0 | xargs -0 du | sort -n $so | tr '\t' ' ' | cut -d ' ' -f 2 | $head |zaf_discovery '{#PATH}'
;; ;;
esac esac
:: ::