monitor

  • 09 Jan

    Q&A 40: Is it possible to create a file timestamp monitor job

    Q: Is it possible to create a file timestamp monitor job. I mean, is there a way to setup a job that states that if there has not been a file with a timestamp of less than say 2 hours to send an alarm?

    A: Yes this is possible. We added some screenshots to get you started.

    • Be sure the Function is set to ‘Copy Files’ (which is default).

    Limagito File Mover Function Setup

    • Please add the directory you want to monitor as WIN Source. In our example we’ll use ‘C:\Test\In\’.

    Limagito File Mover Source Selection

    • We are going to monitor .pdf files in this example so we added  *.pdf  as Filename Include Filter.

    Limagito File Mover Filename Filter Setup

    • Our goal is to check if there are files available younger than 2 hours:

    Limagito File Mover Filedate Filter Setup

    • As Destination we added a simple Pascal Script to give us some information:

    Limagito File Mover Destination Selection

    Begin
      psExitCode:= 1;
      // ... add your code here
      psLogWrite(1, '', 'File Found: ' + psFilePath + psFileName);
    End.

    Limagito File Mover Pascal Script

    • Next step is to setup the ‘On No File Found’ Rule Event:
      • Enable ‘On No File Found’ Rule Event
      • Enable Mail
      • Setup Mail Message
      • Setup Common SMTP (Server which will send the Mail Message)

    Limagito File Mover Rule Events

      • Mail Message Setup

    Limagito File Mover Email Setup

      • Setup Common SMTP (Server which will send the Mail Message). We are using the Google SMTP to send the Mail Message.

    Limagito File Mover SMTP Server Setup

    • We added a Pascal Script which will add information in the log when the event is triggered.
    Begin
      // ... add your code here
      psLogWrite(1, '', 'We did not find any file younger than 2 hours');
    End.

    Limagito File Mover Rule event Pascal Script

    • If you don’t want to send the email event ‘On No File Found’ with each scan then please enable ‘Error event Memory’ in the Options Tab. When this option is enable AND ‘No File Was Found’ then we’ll send the email only once. The ‘Error Event Memory’ will reset itself when a file was found again.

    • RunTime Log Result when no file younger than 2 hours was found:

    Limagito File Mover RunTime Log Result

    • Email Result when no file younger than 2 hours was found:

    Limagito File Mover Email Message

    If you need any help with this ‘file timestamp monitor’ request, please let us know.

    Best Regards,

    Limagito Team

    By Limagito-Team Q&A WIN ,
  • 06 Dec

    Q&A 33: Can we create a job to monitor disabled rules

    Q: Monitor disabled rules. Our company purchased Limagito products and used it for several years, and I am very happy to have such a useful product. I want to ask a technical question. Several of our colleagues manage all the built rules together, but sometimes we accidentally turn it off and forget to turn it on. I would like to ask if there is any way to scan all RULES in limagito and find that its status is “Disable”, so we can create a job to monitor this and send a mail to notify us. Looking forward to your help, and wish you all good health.
    A: In version v2020.12.6.0 we added Pascal Script as Source. This new option makes it possible for us to achieve your request. Let’s get started.

    • Select PScript (Pascal Script) as Source:

    Limagito File Mover Pascal Script as Source

    Add the following Pascal Script (Copy / Paste):

    Var
      tmpInfo: String;
      tmpList: TStringList;
    Const
      ctFileName = 'Disabled_Rules.txt';
    Begin
      // Init Var
      psClearSourceFiles; // Clear SourceFiles Listing
      psExitCode:= 1;
      // We'll use a TStringList that we'll fill with Disabled Rules Data
      tmpList := TStringList.Create;
      Try
        Try
          // Function psGetDisabledRuleList(Const aIncGroupname, 
          // aIncRuleName, aIncRuleID: Boolean; Const aDelimiter, aQuoteChar: Char): String;
          // Request for All Disabled Rules using Tab(#9) as Delimiter
          // Include Groupname, RuleName and RuleID
          tmpInfo := psGetDisabledRuleList(True, True, True, #9, #0);
          If tmpInfo <> '' Then
          Begin
            // We'll use psVSA paramter in our email setup later
            psVSA := tmpInfo
            // Add to List
            tmpList.add(tmpInfo);
            // Save List To File
            tmpList.SaveToFile(psRuleTempPath + ctFileName);
            // Add To SourceFiles List
            psAddToSourceFiles(psRuleTempPath + ctFileName);
          End;
        Except
          psLogWrite(1, '', 'Save File ' + psRuleTempPath + ctFileName + ' Exception');
        End;
      Finally
        tmpList.Free;
      End;
    End.

    Limagito File Mover Pascal Script Disabled Rules

    — Begin Update Post (15th of January 2023) —

    First le me start by stating how much we enjoy working with your software in past months, Setting it up and configuring the rules was super easy and intuitive.

    We had some issue with tracking rules that were disabled by mistake. After browsing your Q&A I’ve found ‘Q&A 33: Can we create a job to monitor disabled rules’

    Which works great, our only remaining issues is that we have a lot of disabled test rule, the fill the report. Is there a way to generate the same report but to exclude certain rules from it?

    Thank you very much for your kind words. I’ve added an alternative Pascal Script. This will exclude those rules who have the ctExclude word in their description. In my example it would exclude all rule that have the word  “test”  in their description. The ctExlude Const is not case sensitive.
    Var
      iList: Integer;
      tmpEntry, tmpInfo: String;
      tmpList: TStringList;
    Const
      ctExclude = 'test';
      ctFileName = 'Disabled_Rules.txt';
    Begin
      // Init Var
      psClearSourceFiles; // Clear SourceFiles Listing
      psExitCode:= 0;
      // We'll use a TStringList that we'll fill with Disabled Rules Data
      tmpList := TStringList.Create;
      Try 
        Try
          // Function psGetDisabledRuleList(Const aIncGroupname,
          // aIncRuleName, aIncRuleID: Boolean; Const aDelimiter, aQuoteChar: Char): String;
          // Request for All Disabled Rules using Tab(#9) as Delimiter
          // Include Groupname, RuleName and RuleID
          tmpInfo := psGetDisabledRuleList(True, True, True, #9, #0);
          If tmpInfo <> '' Then
          Begin
            // Add to List
            tmpList.Text := tmpInfo;
            // Filter
            For iList := (tmpList.Count-1) Downto 0 Do
            Begin
              tmpEntry := tmpList.Strings[iList];
              If Pos(AnsiLowerCase(ctExclude), AnsiLowerCase(tmpEntry)) <> 0 Then
                tmpList.Delete(iList);    
            End;
            If tmpList.Count <> 0 Then
            Begin
              // We'll use psVSA paramter in our email setup later
              psVSA := tmpList.Text;
              // Add to List
              tmpList.add(tmpInfo);
              // Save List To File
              tmpList.SaveToFile(psRuleTempPath + ctFileName);
              // Add To SourceFiles List
              psAddToSourceFiles(psRuleTempPath + ctFileName);
            End;
          End;
        Except
          psLogWrite(1, '', 'Save File ' + psRuleTempPath + ctFileName + ' Exception');
        End;
        If tmpList.Count <> 0 Then
          psExitCode := 1;
      Finally
        tmpList.Free;
      End;
    End.

    — End Update Post (15th of January 2023) —

    It also possible to request all Enabled Rules. In this case you need to replace

    tmpInfo := psGetDisabledRuleList(True, True, True, #9, #0);

    by

    tmpInfo := psGetEnabledRuleList(True, True, True, #9, #0);
    • Add SMTP as Destination:

    Limagito File Mover SMTP as Destination

    • SMTP as Destination  Setup:

    We added %VSA parameter which also contains the Disabled Rule(s). Option ‘Include Source File as Attachment’ is also enabled so the text file containing the Disabled Rule information will be attached to the email.

    Limagito File Mover SMTP as Setup

    • RunTime Log Result:

    Limagito File Mover Pascal Script as Source RunTime Log

    • Received Email Result:

    If you need any help with this ‘job to monitor disabled rules ’, please let us know.

    Best Regards,

    Limagito Team

    By Limagito-Team Pascal Script Q&A ,
  • 01 May

    Q&A 5: Would it be possible to monitor and send alert when file mover failed?

    Q: I was wondering if it would be possible to monitor and send alert when file mover failed?

    A: Yes this is possible using our Rule Events option

    Please open the Rule Events Setup:

    In this example we’ll only enable email for the ‘On Error’ event. Important, if you want to use other events then you’ll need to do a seperate setup for them.

    • Enable ‘On Error’
    • Enable ‘Enable Mail’
    • Use Common SMTP (we will use the Common SMTP setup in this example)

    Click the button next to the SMTP Setup selector and setup your SMTP. We are using gmail smtp in this example but you are free to choose.

    Click the button left from the ‘Enable Mail’ checkbox and setup the email event message.

    Finally click the test button (red marked button) and check the result in the log window.

    Please remember:

    • The email setup has to be done for each Event seperately (On Succes, On Error, ..).
    • You can use a Common SMTP setup so you only need to setup this once.
    • Each Moving Rule will use their own Event settings.

    If you need help, please let us know.

    Regards,

    Limagito Team

    By Limagito-Team Q&A , ,
1 2
SEARCH