Monitoring file size on Windows with PowerShell client
list Colin Coe
Hi all
I'm trying to monitor a couple of files on a bunch of Windows clients.
/etc/xymon/analysis.cfg
HOST=%winclnt.*
FILE C:\users\user.domain\Documents\Timing.log SIZE>500M
yellow
FILE C:\users\user.domain\Documents\Timing.log SIZE>1G red
FILE C:\users\user.domain\Documents\Trace.log SIZE>500M
yellow
FILE C:\users\user.domain\Documents\Trace.log SIZE>1G red
/etc/xymon/client-local.cfg
file:C:\users\user.domain\Documents\Timing.log SIZE>1G red
file:C:\users\user.domain\Documents\Trace.log SIZE>500M yellow
Looking at the man page for client-local.cfg, its colon (:) delimited. How
do I specify the file path for Windows clients?
Thanks
CC
list Japheth Cleaver
▸
On Tue, March 29, 2016 8:11 pm, Colin Coe wrote:
Hi all
I'm trying to monitor a couple of files on a bunch of Windows clients.
/etc/xymon/analysis.cfg
HOST=%winclnt.*
FILE C:\users\user.domain\Documents\Timing.log SIZE>500M
yellow
FILE C:\users\user.domain\Documents\Timing.log SIZE>1G red
FILE C:\users\user.domain\Documents\Trace.log SIZE>500M
yellow
FILE C:\users\user.domain\Documents\Trace.log SIZE>1G red
/etc/xymon/client-local.cfg
file:C:\users\user.domain\Documents\Timing.log SIZE>1G red
file:C:\users\user.domain\Documents\Trace.log SIZE>500M yellow
Looking at the man page for client-local.cfg, its colon (:) delimited.
How
do I specify the file path for Windows clients?
The fields in client-local.cfg (once the appropriate [section] is found)
are, strictly speaking, arbitrary and interpreted by the client, so this,
in the immediate case, would be a WinPS question. As you've noted, the
analysis.cfg section is what's used back in xymond_client, which is
space-delimited and can do quote-wrapping or regular expressions.
I think a quoted string (' ... ') might be the best syntax addition here
(for both logfetch and WinPS). Adding normal escapability using the
expected method of backslashes would IMO make the Windows path even
worse...
Another option is to use `exec` commands to 'ECHO filename' (or DIR /B),
or a glob-like wildcard, but I'm not certain if WinPS supports either.
HTH,
-jc
list Colin Coe
Many thanks, I've got it working now. On Thu, Mar 31, 2016 at 12:19 AM, J.C. Cleaver <user-87556346d4af@xymon.invalid>
▸
wrote:
On Tue, March 29, 2016 8:11 pm, Colin Coe wrote:Hi all I'm trying to monitor a couple of files on a bunch of Windows clients. /etc/xymon/analysis.cfg HOST=%winclnt.* FILE C:\users\user.domain\Documents\Timing.log SIZE>500M yellow FILE C:\users\user.domain\Documents\Timing.log SIZE>1G red FILE C:\users\user.domain\Documents\Trace.log SIZE>500M yellow FILE C:\users\user.domain\Documents\Trace.log SIZE>1G red /etc/xymon/client-local.cfg file:C:\users\user.domain\Documents\Timing.log SIZE>1G red file:C:\users\user.domain\Documents\Trace.log SIZE>500M yellow Looking at the man page for client-local.cfg, its colon (:) delimited. How do I specify the file path for Windows clients?The fields in client-local.cfg (once the appropriate [section] is found) are, strictly speaking, arbitrary and interpreted by the client, so this, in the immediate case, would be a WinPS question. As you've noted, the analysis.cfg section is what's used back in xymond_client, which is space-delimited and can do quote-wrapping or regular expressions. I think a quoted string (' ... ') might be the best syntax addition here (for both logfetch and WinPS). Adding normal escapability using the expected method of backslashes would IMO make the Windows path even worse... Another option is to use `exec` commands to 'ECHO filename' (or DIR /B), or a glob-like wildcard, but I'm not certain if WinPS supports either. HTH, -jc