error running FTP inside alert tcl

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf error running FTP inside alert tcl

  • Creator
    Topic
  • #52964
    Peter Heggie
    Participant

      I’m trying to use the ftp package inside an alert tcl. The alert is checking if a remote file has been created and is ready for processing by Cloverleaf. Maybe I should just run this script from the command line using cron, but I want to put all my monitors in the Cloverleaf alert function, as much as possible.

      I’ve been successful at executing other tcl procs inside the monitor, but I can’t get the ftp functions to work.

      If I don’t specify a timeout, there are no messages, it just hangs. If I have a timeout specified, I get these messages:

      error     error | E: Timeout of control connection after 10 sec.!:

      error     can’t read “_ncfg_ProcessData(hcimonitord)”: no such element in array

      error         while executing

      error     “set data $_ncfg_ProcessData($proc) “

      I’ve tried just a single proc with all the FTP commands, and I’ve tried splitting it up into a ‘main’ proc and called procs within a namespace, so that I could specify an output routine on the ftp::Open call, but as far as I can tell, this output proc is not invoked.

      Can I assume that the ftp package is being pulled in via the package require ftp because I see ‘control connection’ mentioned in the error message?

      Should I just invoke an ‘exec’ statement in the tcl to call an external tcl? It would inherit the same environment though, right?

      I would appreciate any clues.

      Peter Heggie
      PeterHeggie@crouse.org

    Viewing 4 reply threads
    • Author
      Replies
      • #76093
        Jim Kosloskey
        Participant

          Peter,

          Maybe I am missing something but why not have a Fileset/FTP prtocol thread look throught the day (or at scheduled times) to see if a file is there?

          Then do whatever it is you want to do with that file.

          email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 60 years IT – old fart.

        • #76094
          Peter Heggie
          Participant

            Hi Jim,

            I need to raise an alert if the file is not there. It will only be produced once a day, and the responsible group wants to be emailed if the file is not created.

            If I use a directory tcl on the inbound protocol, is it triggered no matter if a file is there or not? If so, I still have to create an email if the file is missing. And there are two different files, with more coming in the future, so I need the process to be generic. If I use the directory tcl, I need to be able to specify the file names in a generic, consistent way.

            Peter Heggie
            PeterHeggie@crouse.org

          • #76095
            Jim Kosloskey
            Participant

              Peter,

              OK in release 5.6 Cloverleaf which we are on, an ‘error’ status is raised when there are no files to be FTP’d and there is an entry in the log that indicates no files were found as a result of the nlst command (550 No Files Found and RETR response: 550). However those values are not available for use.

              I know in a later release the FTP protocol was changed and maybe this no longer throws an error but rather provides something nice (I would think the best solution would be to provide an empty list to the dirparse UPoC then you could use a proc to see if the list were empty.

              At a previous hospital what we did to overcome this was to have a never to be delted file always resident in teh source directory. Then the thread would alwyas find one file but we would eliminate that file from the dirparse list in the dirparse UPoC and check to see if the list was then empty – if it was that meant the only file there was the default file which means the source system did not place a file.

              Fortunately we were able to do the above with virtually all of our systems so this work-around sufficed for us.

              One could always make the assumption the ‘error’ status means files not found and use that status to alert that fact. However, if there is any other error, the alert could be mis-leading.

              I don’t know what release of Cloverleaf you are on but if you are on 5.8 I would be interested in knowing if a no files found situation still raises an ‘error’ status – or what the outward indication is.

              email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 60 years IT – old fart.

            • #76096
              Peter Heggie
              Participant

                I will try the dirparse UPOC. We are on 5.8.4, and I’ll let you know how an empty directory is returned.

                As I add new monitors, like checking for messages in the error or recovery DB, or checking for successful cron jobs, I make sure to append one line to a daily monitor summary file that is emailed every morning, which will list each monitor that ran, a return code and an an error description. I only want emails for individual monitors to go out if there is an error, otherwise, everybody only gets the one summary email. To do this, my monitors need to open the summary file for append and write a record to it. So this dirparse UPOC needs to evaluate the directory for a specified list of files and report errors on each one (not found), send an email if specified with enough information to identify the problem file and append a line of data to the daily report summary file. Hopefully thats not too much activity in a dirparse UPOC.

                This is an example of the daily report summary email. The email font is fixed when it is delivered.

                Daily Batch Monitor Report – 02/28/2012

                time     interface            check for            report file                         RC status                                                      






                07:15:02 audit_purge          cron execution       /home/hci/logs/purge_audit.log      0  ok – cron file has been updated within the last 30 minutes  

                12:15:01 smatr_audit_12       cron execution       /home/hci/logs/smatr_audit_1207.log 0  ok – cron file has been updated within the last 30 minutes  

                17:15:03 smatr_audit_17       cron execution       /home/hci/logs/smatr_audit_1707.log 0  ok – cron file has been updated within the last 30 minutes  

                01:00:03 smatr_audit_00       cron execution       /home/hci/logs/smatr_audit_0050.log 0  ok – cron file has been updated within the last 30 minutes  

                01:40:04 clean_smat           cron execution       /prod/crons/smatArchive.log         0  ok – cron file has been updated within the last 500 minutes

                02:15:04 uds_ftp              cron execution       /tmp/udsftp.adt.chbthprd.ftp        0  ok – cron file has been updated within the last 500 minutes

                02:40:00 clean_local_smat     cron execution       /prod/crons/localsmatArchive.log    0  ok – cron file has been updated within the last 500 minutes

                05:50:04 smatr_audit_05       cron execution       /home/hci/logs/smatr_audit_0540.log 0  ok – cron file has been updated within the last 30 minutes  

                06:30:02 Error DB             messages queued      /tmp/hci_rpt_chonlprd_err_db        8  error – 18 msgs found in Err DB for chonlprd – see email    

                06:30:03 Error DB             messages queued      /tmp/hci_rpt_cmonlprd_err_db        0  ok – no messages found in Error DB for cmonlprd            

                06:30:03 Error DB             messages queued      /tmp/hci_rpt_chbthprd_err_db        0  ok – no messages found in Error DB for chbthprd            

                06:30:04 Recov DB             messages queued      /tmp/hci_rpt_chbthprd_rec_db        0  ok – no messages found in Recovery DB for chbthprd          

                06:40:00 save_RHIO_smat       cron execution       /home/hci/logs/saveSmatArchive.log  0  ok – cron file has been updated within the last 500 minutes

                Peter Heggie
                PeterHeggie@crouse.org

              • #76097
                Jim Kosloskey
                Participant

                  Peter,

                  If you want to email me and we can discuss this off-line.

                  email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 60 years IT – old fart.

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