Automic Workload Automation

Expand all | Collapse all

Workaround: Windows AE automated patching causes agents to not reconnect

  • 1.  Workaround: Windows AE automated patching causes agents to not reconnect

    Posted 04-18-2021 10:32 AM

    Problem
    We still allow our non-production windows AE server to be patched automatically, after which we have to repair the MQSVC table before all of the agents can reconnect.

    Workaround
    The ServiceManagerDialog has a command line interface.  I've assigned a PowerShell script to run at server shutdown time that tells AE services to come down gracefully via this interface.  I added a 15 second pause as well to give them some time to complete their shutdowns.


    To assign this PowerShell script to run at server shutdown, I went into GPEDIT WindowsSettings/Scripts/Shutdown/Properties/PowerShellScripts



    ------------------------------
    Pete Wirfs
    SAIF Corporation
    Salem Oregon USA
    ------------------------------


  • 2.  RE: Workaround: Windows AE automated patching causes agents to not reconnect

    Posted 04-22-2021 12:05 PM
    We are looking into the exact method for our Windows production environment.  Can you possibly share your PowerShell script!  :-)


  • 3.  RE: Workaround: Windows AE automated patching causes agents to not reconnect

    Posted 04-22-2021 12:24 PM
    Edited by Pete Wirfs 04-22-2021 12:26 PM
    Well, it's not very elegant, so I'm not very proud of this script.  I hard coded a lot of stuff that should have been put into reusable functions, and some of the parameters should have been dynamically derived from the server.  But I didn't want to spend a whole lot of time worrying about form when I only cared about function, and I hard-coded everything to get the job done quickly.

    It does write a nice logfile though.  That helps me to see after the fact that it worked, and how many times it worked.  Our patch cycles typically invoke two reboots.

    So here it is;

    cls
    # ****** WHEN INVOKED BY SERVER SHUTDOWN, THIS SCRIPT WILL SHUTDOWN UC4 WP/CP SERVICES GRACEFULLY
    # ****** Add it to shutdown settings here: GPEDIT WindowsSettings/Scripts/Shutdown/Properties/PowerShellScripts
    # ****** Pete Wirfs, April 2021.

    # Derive log file location and name
    $MyPath = $PSScriptRoot
    $MyName = $MyInvocation.MyCommand.Name
    $MyName = $MyName.replace(".ps1",".log")
    $LogFile = $MyPath + '\' + $MyName
    write-host 'Log file will be written to "'$LogFile'"'

    write-output "$(get-date) ." | out-file $LogFile -append
    write-output "$(get-date) AE Shutdown script invoked" | out-file $LogFile -append

    # Shutdown of JWP
    write-output "$(get-date) Stopping JWP" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'UC4 JWP' -m Close

    # Shutdown of JCP
    write-output "$(get-date) Stopping JCP" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'UC4 JCP' -m Close


    # Shutdown of WP1
    write-output "$(get-date) Stopping WP1" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'UC4 WP1' -m Close

    # Shutdown of WP2
    write-output "$(get-date) Stopping WP2" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'UC4 WP2' -m Close

    # Shutdown of WP3
    write-output "$(get-date) Stopping WP3" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'UC4 WP3' -m Close

    # Shutdown of WP4
    write-output "$(get-date) Stopping WP4" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'UC4 WP4' -m Close

    # Shutdown of WP5
    write-output "$(get-date) Stopping WP5" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'UC4 WP5' -m Close

    # Shutdown of CP1
    write-output "$(get-date) Stopping CP1" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'UC4 CP1' -m Close

    # Shutdown of CP2
    write-output "$(get-date) Stopping CP2" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'UC4 CP2' -m Close

    # Shutdown of FTP
    write-output "$(get-date) Stopping FTP" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'FTP' -m Close

    # Shutdown of ORACLEDB
    write-output "$(get-date) Stopping ORACLEDB" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'ORACLEDB' -m Close

    # Shutdown of VARSERVICE
    write-output "$(get-date) Stopping VARSERVICE" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'VARSERVICE' -m Close

    # Shutdown of SQLDB
    write-output "$(get-date) Stopping SQLDB" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'SQLDB' -m Close

    # Shutdown of UC4DEV_AGENT
    write-output "$(get-date) Stopping UC4DEV_AGENT" | out-file $LogFile -append
    E:\Automic\ServiceManagerDialog\bin\UCYBSMCL.EXE -c STOP_PROCESS -h UC4APP01DEV:8871 -n AE_DEV_123 -s 'UC4DEV_AGENT' -m Close

    $WaitSeconds = 15
    write-output "$(get-date) $WaitSeconds second pause" | out-file $LogFile -append
    for($i = $WaitSeconds ; $i -gt 0 ; $i--)
    {
    Write-Progress -Activity "SHUTTING DOWN AE - `n Waiting for" -status "`$i equals $i seconds"
    sleep 1
    }

    write-host "we be finished"
    write-output "$(get-date) AE Shutdown script finished" | out-file $LogFile -append


    ------------------------------
    Pete Wirfs
    SAIF Corporation
    Salem Oregon USA
    ------------------------------



  • 4.  RE: Workaround: Windows AE automated patching causes agents to not reconnect

    Posted 05-18-2021 07:47 PM
    I wanted to follow up on the script.  Thanks for providing this information.  I am currently on AE 12.3.4 HF1.  We were on 12.2.2 HF3.  In the older version, the SMDi would show the process name the same as the name defined in the SMC/SMD file.  since 12.3.4, the process name no longer is displayed.  It displays a DEV#WPnnn.  If i stop any process and start it again, it could take the same process name or it could assign a new process name.

    We were told to stop various processes but leave one of each running.  So, if i have 3 JWP, I stop 2 of the JWP and circle back around and stop the remaining processes leaving the PWP for last, if it was on this AE server.  We have two AE servers.

    The problem with the CYBSMCL command is that it doesn't tell me which of the process is the PWP so I can leave that last to stop.

    We did determine that using the following query, you can determine which server has the PWP.

    select MQSRV_Type, MQSRV_Name, AH_Info, HOST_HostName, AH_ProcessId
    from MQSRV, AH, HOST
    where
    mqsrv_type = 4
    and mqsrv_name = ah_info
    and ah_oh_idnr = HOST_OH_Idnr
    and HOST_HOSTname = 'AESERVER'
    and AH_TimeStamp4 is null

    The AH_Processid will have the id number that will match the return results from CYBSMCL that will list the processes; ucybsmcl -c GET_PROCESS_LIST -h localhost -n SND | find "UC4 WP" you can match the AH_Processid to the ProcID, store that information and use the CYBSMCL to stop all the process but leaving the PWP for last.

    using the CYBSMCL, you can get the process ID and use that to