[Xymon] How to verify DIR content with wildcards on a Windows host?
Anaïs RABINOIT
Anais.RABINOIT at somei.fr
Thu May 3 10:29:10 CEST 2018
Hi,
Thanks for your time,
I use BBWin as Windows client, but here the host is in central mode, so the configuration come from the Xymon server itself. I try to keep it that way, without adding an external script on each windows hosts or modify the BBWin config on each, since it hasn't only one host concerned ...
I tried the wildcard version first, it didn't work, then i saw this on the manpage client-local.cfg:
FILE CONFIGURATION ENTRIES
A file monitoring entry is used to watch the meta-data of a file: Owner, group, size, permissions, checksum etc. It looks like this:
file:/var/log/messages[:HASH]
The file:FILENAME line defines the filename of the file to monitor. As with the "log:" entries, a filename enclosed in backticks means a command which will generate the filenames dynamically. The optional [:HASH] setting defines what type of hash to compute for the file: md5, rmd160, sha1, or sha256, sha512, sha224, or sha384. By default, no hash is calculated.
NOTE: If you want to check multiple files using a wildcard, you must use a command to generate the filenames. Putting wildcards directly into the file: entry will not work.
with this example with directories :
dir:`find /var/log -maxdepth 1 -type d`
So, since i've searched what command i have to use with a Windows host ...
Anaïs
________________________________
De : Beck, Zak <zak.beck at accenture.com>
Envoyé : mardi 17 avril 2018 17:52
À : Anaïs RABINOIT; xymon at xymon.com
Objet : RE: How to verify DIR content with wildcards on a Windows host?
Hi
You don’t say which Windows client you’re using (BBWin or XymonPSClient) but I don’t think either of them will understand your backtick syntax (certainly XymonPSClient does not support the use of backticks).
XymonPSClient will understand wildcards and will enter subfolders if you specify a wildcard in a directory position. Unfortunately it will not recurse so you would need an entry for each level of subfolder you may encounter.
So you may need several entries in client-local.cfg:
file:c:\temp\test\*.txt
file:c:\temp\test\*\*.txt
file:c:\temp\test\*\*\*.txt
and so on…
It may be simpler to use an external script – the external script approach can be used in either BBWin or XymonPSClient.
Zak
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of Anaïs RABINOIT
Sent: Tuesday, 17 April 2018 10:28
To: xymon at xymon.com
Subject: [External] [Xymon] How to verify DIR content with wildcards on a Windows host?
Hi everyone,
I have to check if a directory on a windows host contains files with a specific extension.
If it was a Unix/Linux host, i just have to write something like that i guess :
client-local.cfg :
file:`find /path/mydir/*.tst`
analysis.cfg :
FILE %(/path/mydir/*.tst) noexist
But how to do it for a Windows host? Is this possible ?
I tried this for example :
client-local.cfg :
file:`cmd /c "dir /b /s C:\path\mydir\*.tst"`
or
file:`cmd /c "dir /b /s \path\mydir\*.tst"`
analysis.cfg :
FILE "%C:\path\mydir\*.tst" noexist
But it doesn't work :(
Regards,
Anaïs
________________________________
This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited. Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy. Your privacy is important to us. Accenture uses your personal data only in compliance with data protection laws. For further information on how Accenture processes your personal data, please see our privacy statement at https://www.accenture.com/us-en/privacy-policy.
______________________________________________________________________________________
www.accenture.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20180503/671683a7/attachment.html>
More information about the Xymon
mailing list