CA Service Management

  • 1.  Automate the CA SDM Recycle Procedure

    Posted Aug 06, 2017 04:17 AM

    Hello,

     

    In our site CA Service Desk Manager is in Advanced availability configuration(AA) with

    6 Application servers,

    3 servers facing users and

    other 3 used for web service transactions.

     

    On weekly schedule, the entire application is recycled manually by analysts. I would like to automate the application recycle procedure. please advise on design to automate the recycle process if someone have achieved already.

     

    Thank you,

    Venkat



  • 2.  Re: Automate the CA SDM Recycle Procedure

    Posted Aug 07, 2017 09:14 AM

    Hi Venkat,

    When you are doing this manually, are you doing all the servers at once, or are you doing a rolling-restart by failing over from the BG to the SB, and then quiescing the app servers one at a time and bringing them back up?   If you take a weekly outage to do the recycle and you do it all at once, then because you are on AA, its not super hard to automate it.  You can basically simply have a batch file that kicks off with a scheduled task on each server to recycle service desk.  You can use the pdm_halt -w command to stop it, and then a "net start pdm_daemon_manager" command to start it.  The order that they are started with AA is not such a problem as it is with conventional so it should work.  If you want to do a specific order, then I would script it about 5 mins apart on each machine.

    Hope this helps.

    Jon I.



  • 3.  Re: Automate the CA SDM Recycle Procedure

    Posted Aug 08, 2017 03:32 AM

    Thank you Jon, At present, we are following failing over procedure from the BG to the SB and then restarting the application server each one at time.

    • The Restart procedure consists the following checks
    • Login to ServiceDesk on port 8080 - Confirm successful login on each App and BG server.
    • A delay of 3 minutes between each application services restart.
    • A Overall Status of the SDM services has to sent to the email. 

    the above is my objective.

     

    We have PAM in our site, Will recommend to develop the script in python or any advise on it.

     

    Thank you

    Venkat



  • 4.  Re: Automate the CA SDM Recycle Procedure

    Posted Aug 08, 2017 09:50 AM

    Hi Venkat - I dont have any idea on how to have the system send an email on the status, that part you will have to research on your own.  You basically can script your procedure using batch files and just schedule it to run on each machine at the time interval that you want it to.  I cant provide you much advice on how to create the script or what language to use - its not something that is within the scope of support.  There may be other folks out here that do something similar to what you are looking to do, and they may be willing to share their info with you.

    Thanks,

    Jon I.



  • 5.  Re: Automate the CA SDM Recycle Procedure
    Best Answer

    Posted Aug 08, 2017 02:53 PM

    Hi CodeGeek,

     

    Here's an example of how to accomplish the first three goals with PowerShell.  You can use the send email operator in PAM to accomplish the fourth. Input this code into a "Run Script" operator and check the box "Post output to logs".  This saves the output to the operator and can be used in a following Send Email operator.

    Once you've saved this process you can create a schedule in PAM that fires this process once a week.

     

    The variables at the top of the script need to be adjusted to match your environment.

     

     

    <######################################################################
    Service Desk Manager Variables
    ######################################################################>
    $sdm_bg_srvr = "background_fqdn"
    $sdm_sb_srvr = "standby_fqdn"
    $sdm_app_srvrs = @("app_fqdn1","app_fqdn2","app_fqdn3","app_fqdn4","app_fqdn5","app_fqdn6")
    $service = "CA Service Desk Manager Server"
    $WebServiceProtocol = 'http://'
    $WebServiceString = ':8080/axis/services/USD_R11_WebService?wsdl'
    [String]$Login = 'webservice_user'
    [String]$Password = 'webservice_password'

    #####Restart Background and Standby Services#####
    if(!(Test-Connection -Cn $sdm_bg_srvr -BufferSize 16 -Count 1 -ea 0 -quiet)){
         Write-Host "Unable to contact $sdm_bg_srvr" -ForegroundColor Red
    }
    elseif(!(Test-Connection -Cn $sdm_sb_srvr -BufferSize 16 -Count 1 -ea 0 -quiet)){
         Write-Host "Unable to contact $sdm_sb_srvr" -ForegroundColor Red
    }
    else{
         Write-Host "Promoting $sdm_sb_srvr to the Background Server" -ForegroundColor Green
         icm -cn $sdm_sb_srvr -ScriptBlock {pdm_server_control -b}
        
         Write-Host "Suppress Version Control on $sdm_bg_srvr" -ForegroundColor Green
         icm -cn $sdm_bg_srvr -ScriptBlock {pdm_server_control -v}
         Write-Host "Wait 10 seconds before starting Services on $sdm_bg_srvr" -ForegroundColor Green
         Start-Sleep -s 10

         $getsvc = Get-Service -cn $sdm_bg_srvr -name $service
         $statusBG = $getsvc.Status

         if($statusBG -eq "Stopped"){
              (get-service -ComputerName $sdm_bg_srvr -name $service).Start()
              "_________________________________________________"
              Write-Host "$service is Starting on $sdm_bg_srvr" -ForegroundColor Green
         }
         else{
              Write-Host "$sdm_bg_srvr $service service is already $statusBG" -ForegroundColor Yellow
         }
        Write-Host "Wait 2 minutes for services to start on $sdm_bg_srvr" -ForegroundColor Green
        Start-Sleep -s 60
         Write-Host "Promoting $sdm_bg_srvr to the Background Server" -ForegroundColor Green
         icm -cn $sdm_bg_srvr -ScriptBlock {pdm_server_control -b}
        
         Write-Host "Wait 10 seconds before starting Services on $sdm_sb_srvr" -ForegroundColor Green
         Start-Sleep -s 10
        
         $getsvc = Get-Service -cn $sdm_sb_srvr -name $service
         $statusSB = $getsvc.Status

         if($statusSB -eq "Stopped"){
              (get-service -ComputerName $sdm_sb_srvr -name $service).Start()
              Write-Host "$service is Starting on $sdm_sb_srvr" -ForegroundColor Green
         }
         else{
              Write-Host "$sdm_sb_srvr $service service is already $statusSB" -ForegroundColor Yellow
         }
         "_________________________________________________"
    #####Restart Application Services#####    
         ForEach($srvr in $sdm_app_srvrs){
              if(!(Test-Connection -Cn $srvr -BufferSize 16 -Count 1 -ea 0 -quiet)){
                   Write-Host "Unable to contact $srvr" -ForegroundColor Red
              }
              else{
                   $getsvc = Get-Service -cn $srvr -name $service
                   $status = $getsvc.Status

                   if($status -eq "Running"){
                        (get-service -ComputerName $srvr -name $service).Stop()
                        Write-Host "$service is Stopping on $srvr `n" -ForegroundColor Green
                   }
                   else{
                        Write-Host "$srvr $service service is already $status `n" -ForegroundColor Yellow
                   }
                   Write-Host "Wait 2 minutes before starting Services on $srvr" -ForegroundColor Green
                   Start-Sleep -s 120
                   $getsvc = Get-Service -cn $srvr -name $service
                   $status = $getsvc.Status

                   if($status -eq "Stopped"){
                        (get-service -ComputerName $srvr -name $service).Start()
                        Write-Host "$service is Starting on $srvr `n" -ForegroundColor Green
                   }
                   else{
                        Write-Host "$srvr $service service is already $status `n" -ForegroundColor Yellow
                   }
                   Write-Host "Wait 3 minutes before checking web service on $srvr" -ForegroundColor Green
                   Start-Sleep -s 180
                  
                   # WebService connection
                   $URI = $WebServiceProtocol + $srvr + $WebServiceString
                   #Write-Host "URI: " $URI
                   $WebService = New-WebServiceProxy -uri $URI -Namespace WebServiceProxy -ErrorAction Stop

                   # Connection to Service Desk
                   $SID = $WebService.login($Login, $Password)
                   #Write-Host "SID: " $SID
                   $CountPri = $($WebService.doQuery($SID, "pri", "delete_flag = 0"))
                   #There should only be six priority values as this table can't be added to
                   if($CountPri.listLength -eq 6){
                        Write-Host "Successful webservice connection to $srvr" -ForegroundColor Green
                        Write-Host "`t" $CountPri.listLength " Priorities values found" -ForegroundColor Green
                   }
                   else{
                        Write-Host "Failed webservice query on $srvr" -ForegroundColor Red
                   }
                   $WebService.logout($SID)
                   "_________________________________________________"
              }
         }
    }


  • 6.  Re: Automate the CA SDM Recycle Procedure

    Posted Aug 09, 2017 08:40 AM

    Excellent. Thank you, I will start testing in my site.

     

    Regards,

    Venkat



  • 7.  Re: Automate the CA SDM Recycle Procedure

    Posted Aug 08, 2017 03:21 PM

    Yeah the best way is to do a script batch to manage the recycle of Service Desk.  With schedule task you can delay the start, also you can find some dos utility to send email when the script complete the operation.