2010-01-27 Sancho Lerena <slerena@artica,es>
* plugins/files_indir: New agent to detect if files in a specified directory are less than in previous run. Return two modules. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2311 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
99c4675455
commit
88877cd126
pandora_agents/unix
|
@ -1,3 +1,8 @@
|
||||||
|
2010-01-27 Sancho Lerena <slerena@artica,es>
|
||||||
|
|
||||||
|
* plugins/files_indir: New agent to detect if files in a specficied
|
||||||
|
directory are less than in previous run. Return two modules.
|
||||||
|
|
||||||
2009-12-15 Ramon Novoa <rnovoa@artica.es>
|
2009-12-15 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
* pandora_agent: Removed debugging code.
|
* pandora_agent: Removed debugging code.
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Syntax:
|
||||||
|
#
|
||||||
|
# Directory_Name : Directory to check
|
||||||
|
|
||||||
|
if [ -z "$1" ]
|
||||||
|
then
|
||||||
|
echo "You need too pass target directory to monitor"
|
||||||
|
echo "Plugin will report CRITICAL if previous number"
|
||||||
|
echo "of files in directory is greater than actual number"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
DIRE=$1
|
||||||
|
DIRETMP=`echo $DIRE | md5sum | awk '{ print $1 }'`
|
||||||
|
DIRETMP=/tmp/$DIRETMP
|
||||||
|
|
||||||
|
CURRENT=`ls -la ${DIRE} | wc -l`
|
||||||
|
|
||||||
|
if [ -e $DIRETMP ]
|
||||||
|
then
|
||||||
|
ANTERIOR=`cat $DIRETMP`
|
||||||
|
else
|
||||||
|
ANTERIOR=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $ANTERIOR -gt $CURRENT ]
|
||||||
|
then
|
||||||
|
DISPARA=0
|
||||||
|
else
|
||||||
|
DISPARA=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $CURRENT > $DIRETMP
|
||||||
|
|
||||||
|
echo "<module>
|
||||||
|
<name><![CDATA[FS_$DIRE]]></name>
|
||||||
|
<description>Number of files in directory</description>
|
||||||
|
<type>generic_proc</type>
|
||||||
|
<data>$DISPARA</data>
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<module>
|
||||||
|
<name><![CDATA[NumFiles_FS_$DIRE]]></name>
|
||||||
|
<description>Number of files</description>
|
||||||
|
<type>generic_data</type>
|
||||||
|
<data>$CURRENT</data>
|
||||||
|
</module>"
|
||||||
|
|
Loading…
Reference in New Issue