ESP Workload Automation

  • 1.  DISK_MON Question

    Posted Aug 22, 2017 12:20 PM

    Looking for best approach to do the following in ESP.

    Check space on a server, if 150GB or >, kick off batch schedule, if space is < 150GB, kick of .NET program, once complete start batch schedule. Only want to do this check right before start of the batch cycle, not run in continuous.

     

    Thanks,

    Sharon



  • 2.  Re: DISK_MON Question

    Posted Aug 22, 2017 12:57 PM

    What is the OS of the server that needs to be checked?



  • 3.  Re: DISK_MON Question

    Posted Aug 22, 2017 01:51 PM

    In this case it will be Windows but I'm sure once we get this going it could be Unix down the road.


    Thank you.

    Sharon



  • 4.  Re: DISK_MON Question

    Posted Aug 22, 2017 04:25 PM

    From my understanding I do not believe DISK_MON will provide what you need/want.

     

    If I do a simple test with DISK_MON it completes and the Free Space is displayed in CSF.

     

    WOB Definition

    DISK_MON DISKMON                                   
      AGENT <Windows Agent>                     
      DISK %FileSystem                                  
      RUN ANYDAY                                       
    ENDJOB     

     

    CSF

    Job Name WT ApplName CCode P Node   Job Status                  
    DISKMON  HM DISKMON      0 COMPLETE Avail=30846230528, Used=2252                                         

     

     

    I think what may be better would be to run a NT_JOB that calls a script which would calculate the Free Space and if the Free Space is less than desired the script would exit with a non-zero exit status.  Then you could use conditional release to run the .NET job to clean-up the space.

     

    I have tested a simple Windows BAT file to display space, but Windows limitations make the math difficult.

     

    I think PowerShell may be a better solution.

     

    Is PowerShell available in your environment?

     

    Is that a solution that you would consider?

     

    If yes, let me know and I can help put something together.



  • 5.  Re: DISK_MON Question

    Posted Aug 22, 2017 04:34 PM

    It would really be better if we could find a way to manipulate the DISK_MON job type or have some process in ESP versus having to write special code as I'm trying to keep this where the entire team can support it if at all possible. I have done some testing with DISK_MON and yes I've seen the same thing as you have as the space is displayed in the Job Status, if there was some way to grab that or the monitor point and parse it out to get the percentage or value that would be great, if not we could try what you are suggesting.

     

    Thank you for your time.

    Sharon



  • 6.  Re: DISK_MON Question
    Best Answer

    Posted Aug 23, 2017 11:05 AM
      |   view attached

    I updated the PROC with the DISK_MON Workload Object with an extra Job to get the Bytes Available.

     

    The extra job OTHER uses the LCSF Command:

    LCSF (APPL EQ 'DISKMON') AND (WOBTYPE EQ 'HM')

     

    NOTE: Change APPL 'DISKMON' in the LCSF command to the name of your APPL.

     

    This will return something similar to:

    20170823 075236+0400 . . /MAIN/DISKMON.5/DISKMON STATE COMPLETE Conditions(COMPLETE) Status("Avail=30804529152, Used=2252")

    SystemStatus("Avail=30804529152, Used=2252") Jobno(240060) Agent(NT_WKSP000550DD) Account(?) ASeq(0005) Scheduled (07.49.40 WED

    23 AUG 2017) UpdatedOn(07.49.47 WED 23 AUG 2017) StartTime(07.49.46 WED 23 AUG 2017) EndTime(07.49.46 WED 23 AUG 2017) Cmpc(CC 0)

    AvgRT(6) Type(HM) Event(<PREFIX>.DISKMON)

     

    I only took the last line since that is the latest run, then parsed out Available bytes.

     

    Calculated GB by dividing by 1024, 3 times, the last division (%) only took the integer part (round down).
     

    On the system I tested with I have 28GB available on the D: drive.

     

    Ran 2 tests:

    • Test #1 - With 30GB required space
    • Test #2 - With 25GB required space

     

    The results are listed below:

                                              
    Test #1- Space NOT Available

    >>> FREEGB = 28                   
    >>> REQUIREDGB = 30
    >>> RUN .NET CLEANUP JOB.
    ***    

                                              

    Test #2 - Space Available                                                 
    >>> FREEGB = 28
    >>> REQUIREDGB = 25
    >>> REQUIRED SPACE AVAILABLE TO START BATCH JOBS.
    ***                                                                           
           

    I have attached the PROC, I left in the SAY statements but commented them out.  SEND statements should also be removed after testing is complete.

     

    This solution has only been tested on Windows but should work for Linux/UNIX without any changes.

     

    Let me know if this is what you were looking for or if you have any questions.

    Attachment(s)

    zip
    DISKMON.txt.zip   929 B 1 version


  • 7.  Re: DISK_MON Question

    Posted Aug 23, 2017 11:15 AM

    If you do not want to use the LCSF command you could use the LAP command.

     

    LAP DISKMON.46 ALL                                                        
    APPL DISKMON  GEN 46 COMPLETE                                             
      CREATED AT 11.02 ON WEDNESDAY AUGUST 23RD, 2017                         
        ENDED AT 11.02 ON WEDNESDAY AUGUST 23RD, 2017                         
               BY EVENT SCHTESP.DISKMON2                                      
      DISKMON J240187, Avail=30768541696, Used=2252                           
       PREDECESSORS: (NONE)                                                   
         SUCCESSORS: (NONE)                                                   
                                                                              
      OTHER J240188, COMPLETED, CC 0,  AT 11.02 ON WEDNESDAY AUGUST 23RD, 2017

     

    You would just need to parse differently.



  • 8.  Re: DISK_MON Question

    Posted Aug 23, 2017 11:31 AM

    Thank you, I will review. I really appreciate your help here.