[hobbit] to test the non-existence of a dir
Husemann, Harald
Harald.Husemann at materna.de
Wed Apr 1 14:30:28 CEST 2009
Hi,
nice that you got it, :-).
You had to wait a little because of the inner communication flow of Hobbit:
When a client for which you've updated client-local.cfg connects the
server to send its report, the server tells the client that there's a
new part in client-local.cfg for it.
The client downloads the new config, and applies it to its local
configuration, which is read in the NEXT run of the client.
So, it can take something between 10 and 20 mins (two poll cylces)
before you get the new report.
@Hobbit-gurus: I hope I haven't mixed up things in this description, :-)
hh
dOCtoR MADneSs schrieb:
> dOCtoR MADneSs a écrit :
>> Husemann, Harald a écrit :
>>> Hi,
>>>
>>> two remarks:
>>>
>>> Did you use backticks (`) around the command?
>>> And, I made a mistake with the "|", this is not necessary.
>>>
>>> So, the right format for the entry in client-local.cfg is:
>>>
>>> file:`find / -type d -name "*_FIXED_PART_*"`
>>>
>>> (refer to the manpage of client-local.cfg for it)
>>>
>>> HTH,
>>>
>>> hh
>>>
>>> dOCtoR MADneSs schrieb:
>>>> Husemann, Harald a écrit :
>>>>> Hi,
>>>>>
>>>>> hm, first was comes in mind (not tested):
>>>>>
>>>>> - use a find command in client-local.cfg, like
>>>>> 'find / -name "*_FIXED_PART_1*" |'
>>>>> - use a regex along with noexist in hobbit-clients.cfg, like:
>>>>> FILE %.*_FIXED_PART_1.* red noexist
>>>>>
>>>>> That should do the trick...
>>>>>
>>>>> hh
>>>>>
>>>>> dOCtoR MADneSs schrieb:
>>>>>> Josh Luthman a écrit :
>>>>>>> Off the top of my head I think you want something like,
>>>>>>>
>>>>>>> if {-d /this/subdir}
>>>>>>> echo BBVAR=green
>>>>>>> else
>>>>>>> echo BBVAR=red
>>>>>>>
>>>>>>> I'm sure I'm missing a lot, not looking at it right now. Pretty
>>>>>>> sure -d tests directories.
>>>>>>>
>>>>>>> Josh Luthman
>>>>>>> Office: 937-552-2340
>>>>>>> Direct: 937-552-2343
>>>>>>> 1100 Wayne St
>>>>>>> Suite 1337
>>>>>>> Troy, OH 45373
>>>>>>>
>>>>>>> Those who don't understand UNIX are condemned to reinvent it,
>>>>>>> poorly.
>>>>>>> --- Henry Spencer
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Mar 31, 2009 at 10:29 AM, dOCtoR MADneSs
>>>>>>> <doctor at makelofine.org <mailto:doctor at makelofine.org>> wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> Xymon allow me to test the non existence of file or
>>>>>>> directory. But
>>>>>>> I'd like a more complex test. In my case, I don't want any
>>>>>>> directory named _FIXED_PART_anything in a whole tree.
>>>>>>> Example :
>>>>>>>
>>>>>>> I've
>>>>>>> /toto/_FIXED_PART_1 -> test is red
>>>>>>> /toto/a/sub/directory/_FIXED_PART_hello_world -> test is red
>>>>>>>
>>>>>>> So, is there a "normal" way to use "files" test included in
>>>>>>> xymon ?
>>>>>>>
>>>>>>> Regards,
>>>>>>> Damien
>>>>>>>
>>>>>>> To unsubscribe from the hobbit list, send an e-mail to
>>>>>>> hobbit-unsubscribe at hswn.dk <mailto:hobbit-unsubscribe at hswn.dk>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> A shell script should look like this :
>>>>>>
>>>>>> find $TREE -type d -name _FIXED_PART_\*
>>>>>> if [ $? -eq 0 ] ; then
>>>>>> BBVAR=red
>>>>>> else
>>>>>> BBVAR=green
>>>>>> fi
>>>>>>
>>>>>> But i prefer to use integrated "files" test
>>>>>>
>>>>>>
>>>>>> To unsubscribe from the hobbit list, send an e-mail to
>>>>>> hobbit-unsubscribe at hswn.dk
>>>>>>
>>>>>>
>>>>>>
>>>> Tks for your help, but your trick didn't work.
>>>>
>>>> I added
>>>> file:'find / -type d -name "*_FIXED_PART_*" |'
>>>> to my host section in client-local.cfg
>>>> then I added
>>>> FILE %.*_FIXED_PART_.* red noexist
>>>> to my host section in hobbit-clients.cfg
>>>>
>>>> but nothing happens when i created a directory called
>>>> _FIXED_PART_test in /tmp (no alert or anything)
>>>> in files test, i've the following :
>>>>
>>>> &green 'find / -type d -name "*_FIXED_PART_*" |'
>>>> <https://www.makelofine.org/xymon-cgi/bb-hostsvc.sh?CLIENT=stan&SECTION=file:%27find%20/warez%20-type%20d%20-name>
>>>>
>>>>
>>>> When I click on the link, i've :
>>>> <No data>
>>>>
>>>>
>>>>
>>>>
>>>> When I manually execute :
>>>> find /-type d -name "*_FIXED_PART_*"
>>>> I can see /tmp/_FIXED_PART_test
>>>>
>>>>
>>>>
>>>> To unsubscribe from the hobbit list, send an e-mail to
>>>> hobbit-unsubscribe at hswn.dk
>>>>
>>>>
>>>>
>> Ok for the "|", but, can you remind me the usage of "%" in regex ? I
>> think it should be ^ instead in :
>> FILE %.*_FIXED_PART_.* red noexist
>> no ?
>>
>> To unsubscribe from the hobbit list, send an e-mail to
>> hobbit-unsubscribe at hswn.dk
>>
>>
> Now it's almost working !
> I just had to wait a little
> Thank you for your help !
>
> To unsubscribe from the hobbit list, send an e-mail to
> hobbit-unsubscribe at hswn.dk
>
>
>
--
Harald Husemann
Netzwerk- und Systemadministrator
Operation Management Center (OMC)
MATERNA GmbH
Information & Communications
Westfalendamm 98
44141 Dortmund
Geschäftsführer: Dr. Winfried Materna, Helmut an de Meulen, Ralph Hartwig
Amtsgericht Dortmund HRB 5839
Tel: +49 231 9505 222
Fax: +49 231 9505 100
www.annyway.com <http://www.annyway.com/>
www.materna.com <http://www.materna.com/>
More information about the Xymon
mailing list