Cloverleaf Alerts – Passing variables into tcl script

Clovertech Forums Cloverleaf Cloverleaf Alerts – Passing variables into tcl script

  • Creator
    Topic
  • #120266
    Erik Mueller
    Participant

      I seem to have some unusual behaviour with the variables in the alerts on Cloverleaf 19.1 running on RHEL.

       

      When I create an e-mail alert, with the following message:

      A: %A

      F: %F

      G: %G

      N: %N

      R: %R

      V: %V

       

      In the e-mail I receive, I can see the alert variables are translated:

      A: Thread status of his_client has been down  for 1335 minutes

      F: /tmp/fileowuFQv

      G:

      N: his_Client_BH_Status_WARN

      R: 266

      V: {his_client down}

       

      However, when I am trying to pass the %N and %V variables into a tcl script using the Alert Action “exec” i.e.:

      tcl /cloverleaf/cis19.1/integrator/site_l2_erik/tclprocs/Cloverleaf_Alerts.tcl %N %V %A

      they are not all being translated before they are being passed to the tcl script:

      From the tcl script:

      puts $logfile “This is argv: |$argv|”

      outputs this to the logfile:

      This is argv: |%N %V Thread status of his_client has been down for 1335 minutes|

      As you can see %A is being translated to “Thread status of his_client has been down  for 1335 minutes”

      Any ideas why %N and %V are not being translated to “his_Client_BH_Status_WARN” and “{his_client down}” respectively when they are passed to the tcl script?

      I have used a similar script successfully and all variables were translated, but that was on a Cloverleaf 6.1 version running on windows.

      Thanks,

      Erik

    Viewing 3 reply threads
    • Author
      Replies
      • #120270
        Levy Lazarre
        Participant

          Hi Erik,

          I believe that your issue may be due to “exec” not properly parsing the command line arguments.

          I do something similar in Unix (AIX) but I quote the arguments when I pass them to the script, like this:

          bcAlert.tcl “%A” “%N” “%P” “%T” “%V”

          I believe this is the right thing to do because some of those arguments (like %A) contain whitespace so they must be quoted for proper interpretation.

          So try:   Cloverleaf_Alerts.tcl “%N”  “%V”  “%A”

          I hope this helps.

           

          • #120271
            Erik Mueller
            Participant

              Hi,

               

              Thanks. I know I need to have the variables between quotation marks to avoid tcl thinking they are lists, but even so, it should still work without quotation marks.

               

              I have added quotation marks and am testing again

               

              Erik

          • #120275
            Erik Mueller
            Participant

              Hi,

               

              I tested with quotation marks but still not translating with the “exec” command.

               

              Erik

               

            • #120276
              Levy Lazarre
              Participant

                Hi Erik,

                I have a question about your configuration (Alert Properties Actions pane)

                When you select the “exec” action and you click on the “List” button to open the
                “Select Command” dialog box, does your script appear in the list of available
                commands to be run when the alert is fired?

                In my own experience, manually typing the location of the script did not work
                because of User Access Control restricting exec. So what I ended up doing:

                1. Place the alerting script in the $HCIROOT/usercmds directory
                2. Make the script executable on the command line

                After that I could select the script from the “List” -> “Select Command” dialog
                box, under the Category “User-Defined Commands” and just added the alert
                variables, so the “Alert Action:” Command simply appeared as:
                myAlert.tcl “%A” “%N” “%P” “%T” “%V”

                and the Actions pane:
                exec {myAlert.tcl “%A” “%N” “%P” “%T” “%V”}

                • #120279
                  Erik Mueller
                  Participant

                    Hi,

                     

                    No, my script does not appear when clicking on the list command.

                     

                    I tested the same script with the same alert configuration on a Cloverleaf 6.1 running on Windows and it works fine. %N and %V are translated using the exec command.

                     

                    That leads me to conclude, the issue is either with Cloverleaf 19.1 or with RHEL.

                     

                    Unfortunately, I don’t have a Cloverleaf 19.1 running on Windows or a Cloverleaf 6.1 running on RHEL to test my idea.

                     

                    I will log a support ticket with Infor.

                    Erik

                • #120469
                  Erik Mueller
                  Participant

                    Good afternoon,

                     

                    I am not getting anywhere with this ticket with Infor and was wondering if somebody could do me a favour and test on one of their test systems please, ideally, one running CIS 19.1.1.0 on Windows or a 6.1.2.1 running on RHEL.

                     

                    I have tested using the “exec” command on

                    Linux: tcl /cloverleaf/cis19.1/integrator/site_l2_erik/tclprocs/Cloverleaf_Alerts.tcl “%N” “%V” “%A”

                    Windows: hcitcl E:\Cloverleaf\cis6.1\integrator\site_master\tclprocs\Cloverleaf_Alerts.tcl “%N” “%V” “%A”

                    and have the following results:

                    CIS Version OS Success/Failure
                    19.1.1.0 RHEL 3.10.0-1160.81.1.el7.x86_64 Failure
                    6.1.2.1 Windows server 2012 Success
                    20.1.1.0 Windows Server 2019 Success

                    I can see from the alerts.log, that %N and %V are not being translated in Linux, but are on Windows.

                    Linux: Action: tcl /cloverleaf/cis19.1/integrator/site_l2_erik/tclprocs/Cloverleaf_Alerts.tcl “%N” “%V” “Thread status of his_client has been down for 1460 minutes”

                    Windows: Action: hcitcl E:/Cloverleaf/cis6.1/integrator/site_master/tclprocs/Cloverleaf_Alerts.tcl “AuditArchitecture_BH_Status_WARN” “{AuditArchitecture down} ” “Thread status of AuditArchitecture has been down for 4920000 seconds”

                     

                    Thanks,

                    Erik

                Viewing 3 reply threads
                • You must be logged in to reply to this topic.