Alert Action using tcl

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Alert Action using tcl

  • Creator
    Topic
  • #49395
    Keith McLeod
    Participant

      I want to be able to create an Alert action using tcl.  I would like to use a tcl proc that accepts arguments. What is required to call a tclproc in the alert action location?  My experimentation has allowed me to code in the tcl acttion pane with no newlines and commands separated by ‘;’.  I have not yet been successful in using the same commands in a single proc never mind accepting an argument.  What is the trick?  Thanks…

    Viewing 1 reply thread
    • Author
      Replies
      • #61775
        Charlie Bursell
        Participant

          I do this all the time and pass arguments.  For example, when using the Alerts Package I wrote.  In the action line I do something like:

          package require alerts; alerts::prototStat “%A” 1

          Where the first command loads the package and the second command calls a routine in the package namespace called protoStat and passes 2 arguments.  The first argument is %A which is the string that the alert engine would have displayed on the screen for this alert.  The second argument is simply a flag I use within the procedure.

          FWIW, you can also pass %F which is the temporary file name containing the same message as in %A.  I put %A in quotes since it contains spaces and I want to be sure it is read as a single argument.

        • #61776
          LeeAnne Kardas
          Participant

            srhs_alert_opening is a script that I developed to generate alerts for 1 or more I.P. Addresses and within the Alert Configurator you set it up like this:

            {VALUE pstat} {SOURCE hemocare_ob_hds_r1} {MODE actual} {WITH -1} {COMP {== opening}} {FOR {nmin 5}} {WINDOW {* * 7-16 * * 1-5}} {HOST {}} {ACTION

            {{exec {srhs_alert_opening hemocare_ob_hds_r1 10.0.6.105 10.0.6.115}}}}

            #!/bin/sh

            #

            exec tcl “$0” “$@”

            set curdatetime [clock seconds]

            set curdate [clock format $curdatetime -format %m/%d/%Y]

            set curtime [clock format $curdatetime -format %H:%M:%S]

            set alertflag n

            foreach element $argv {

              if {[cequal $alertflag n]} {

                 set threadname $element

              }

              if {[cequal $alertflag y]} {

                 set alert “exec hciguimsg -error -message “$threadname:  $curdate $curtime Clinical Application Interface Down. nnPlease Contact the Integ

            ration Analyst On Call.” -title “DEV – Protocol Error” -bell 360 -display $element:0.0 &”

                 eval $alert

              }

              set alertflag y

            }

        Viewing 1 reply thread
        • The forum ‘Cloverleaf’ is closed to new topics and replies.