DX Unified Infrastructure Management

  • 1.  Dirscan Limitations on File size monitoring

    Posted Jan 03, 2019 11:33 AM

     

    Hi All,

    Currently DIRSCAN probe has a limitation where it cant isolate one file, the most current file to monitor for file size and alarm on it only.  Unlike the LOGMON probe which will monitor to the most current file and only alarm on information found in that file, the DIRSCAN probe will only look at ALL files individually and if any and all files meet a size requirement for every single poll it will generate a new alarm.  This is a particular problem when files are date time stamped as shown in image above, and with every poll a new alarm is generated for each of these files and an email alert is associated with each of these files.  Like in the example above we have a monitor set up to generate an alert when the files exceeds 50mb, and send an email. So every 60 seconds all the circled files will send another email, which is unacceptable. We only want to be alerted on the most current file. I will be opening an IDEA for an enhancement request, but who knows when that will happen. Does anyone out there currently have a work around for this?

     

    TIA



  • 2.  Re: Dirscan Limitations on File size monitoring

    Broadcom Employee
    Posted Jan 04, 2019 10:53 AM

    I would suggest creating a simple script or batch file to check the file name based on the current date and then report the size of the file.

    Us logmon to execute the script or batch file and read the response and alarm accordingly.



  • 3.  Re: Dirscan Limitations on File size monitoring

    Posted Jan 08, 2019 02:10 PM

    Hi Gene,

    That's easy for you to say. I'm no good at scripting. If the batch file has more than one or two lines in it  I'm lost.



  • 4.  Re: Dirscan Limitations on File size monitoring
    Best Answer

    Broadcom Employee
    Posted Jan 08, 2019 03:11 PM
      |   view attached

    So below is a sample windows batch file that checks the local directory to see if the file exists.

    if it does it than checks it to see if the file is over a certain limit and returns a string.

     

    rem setup variables for use
    @echo off
    setlocal
    rem size is in bytes the below value is 75 Megabytes
    set maxbytesize=75000000

     

    Rem first section to get current date in yyyy-dd-mm format
    set mydate=%date:~10,4%-%date:~4,2%-%date:~7,2%
    rem uncommecnt below line for testing.
    rem echo  %mydate%

     

    rem Set the file name
    set FileName=ECS_%mydate%.log
    rem echo %FileName%

     

    rem check if the file exists:
    if exist %FileName% (
        rem echo file exists
        call :setsize %FileName%
        goto :check
        
    ) else (
        echo file doesn't exist
    )

     

    :check
    if %size% lss %maxbytesize% (
            echo File is less than %maxbytesize% bytes
        ) else (
            echo File is greater than %maxbytesize% bytes
        )
        goto :eof

     

    Rem Filesize check
    :setsize
    set size=%~z1
    rem echo %size%
    goto :eof

     

    I have attached the file as well.

    you may need to play with path and location information but this should get your started.

    you can have logmon call this file and it will return one of two values

    file does not exist

     

    file is greater than  XXXXX bytes

     

    so you can setup watcher profiles to alarm for either of those cases.

    Attachment(s)

    zip
    filecheck.bat.zip   524 B 1 version


  • 5.  Re: Dirscan Limitations on File size monitoring

    Posted Jan 08, 2019 03:26 PM

    Thank You Gene. Appreciate all your help.



  • 6.  Re: Dirscan Limitations on File size monitoring

    Posted Jan 11, 2019 07:49 PM

    Thanks Gene. With this script I was able to assist Patrick and we made some minor alterations and got it working using logmon. 



  • 7.  Re: Dirscan Limitations on File size monitoring

    Posted Jan 12, 2019 12:39 PM

    Will this script work anymore or just for 1-time use. I wanted to use on my app developer programming purpose on mobdro apk to test whether it is working or not.



  • 8.  Re: Dirscan Limitations on File size monitoring

    Posted Jan 14, 2019 11:53 AM

    The intended use of the script is to enable the use of the UIM logmon probe to check the size of the current file in a directory where the file name contains the current date and the directory also contains all the past files. When used with the logmon probe, it will execute repeatedly (on a configured interval) checking the file size and alarm if the exceeds the set size threshold. The script itself, just outputs a message string to STDOUT and the logmon probe has a rule that will generate the alarm if it sees the "File is greater than" string. Short answer is yes, the script can be executed more than once (and is with the logmon probe). However, I'm not sure about use the way you wish to use it.