Automic Workload Automation

  • 1.  Send a notification if a server process (CP / WP) goes down

    Posted Mar 03, 2017 06:23 AM
      |   view attached
    Disclaimer : this solution is not ideal, as having the AE server check its own status does not make much sense if the server itself is down. We still recommend to monitor processes via a separate monitoring tool.

    Here is a very basic solution to periodically check if your server processes are up, and send notifications if not.
    It consists of a few objects:
    • VARA.SQLI.SRV.PROC lists all server processes
    • SCRI.SRV.PROC.ALIVE checks if their statuses and executes...
    • ... CALL.MAIL.SRV.PROC.DOWN if a process is down
    • EVNT.TIME.CHECK.SRV.PROC.ALIVE runs SCRI.SRV.PROC.ALIVE at a given interval

    VARA.SQLI.SRV.PROC
    SELECT OH_NAME
    FROM OH
    WHERE OH_OTYPE='SERV'
    AND OH_DeleteFlag='0'
    ORDER BY OH_NAME

    SCRI.SRV.PROC.ALIVE
    :SET &HND# = PREP_PROCESS_VAR(VARA.SQLI.SRV.PROC)

    :PROCESS &HND#
    :SET &PROC# = GET_PROCESS_LINE (&HND#,1)
    :SET &STATUS# = SYS_SERVER_ALIVE(&PROC#)

    :IF &STATUS# = 'N'
    :  SET &SEND_NOTIF# = ACTIVATE_UC_OBJECT(CALL.MAIL.SRV.PROC.DOWN,,,,,PASS_VALUES)
    :ENDIF
    :ENDPROCESS
    Note : for
    ACTIVATE_UC_OBJECT(CALL.MAIL.SRV.PROC.DOWN,,,,,PASS_VALUES)
    to work, you need to add the variable that should be passed in Variables & Prompts > Variables:
     gfmdycewos1b.png
     

    CALL.MAIL.SRV.PROC.DOWN

    It's pretty standard, I just adjusted the recipients and the SUBJECT so it contains the process' name:
    :  PUT_ATT SUBJECT = "Alarm:Server process &PROC# is down!"

    EVNT.TIME.CHECK.SRV.PROC.ALIVE

    Adjust the interval :
    67ixng549wx0.png

    !Process Tab
    :SET &RUNCHECK# = ACTIVATE_UC_OBJECT(SCRI.SRV.PROC.ALIVE)

    I'm adding an export of the objects to this post. Please feel free to import them.
    If you are using an Oracle DB you will need to move the statements to the Oracle tab in the VARA.SQLI object.
    XML export was made under User Interface version 11.2.3+build.465. Simply adjust the <uc-export clientvers=""> tag to your version before importing the objects.

    Best regards,
    Antoine

    Attachment(s)

    xml
    monitor_srv_proc.xml   12 KB 1 version


  • 2.  Send a notification if a server process (CP / WP) goes down

    Posted Apr 21, 2017 12:35 PM
    I would be interesting in finding out what others are using outside of the AE to check the AE.




  • 3.  Send a notification if a server process (CP / WP) goes down

    Posted Apr 21, 2017 01:04 PM
    We run this PowerShell script from the windows scheduler.  It overwrites a small log file every time it runs, so you can tell when it last checked.  You set the variable $CPThreshhold to the number of expected CP's, and the variable $WPPRocess to the number of expected WPs.


    function Get-UC4Processes
    {
        Begin{
            $ServerName   = get-content env:computername
            $LogFileName  = "Get-UC4Processes.log"
            write-host "ServerName: $ServerName"
            echo       "ServerName: $ServerName" > $LogFileName

            $Server       = 'our.email.server'
            $Subject      = $ServerName + " Key Process Alert"
            $From         = "Alert_" + $ServerName + "@Saif.com"
            $CPThreshhold = 2
            $WPThreshhold = 5

            # Set process variables
            $CPProcess = Get-Process | Where ProcessName -Like "UCSrvC*"
            $WPPRocess = Get-Process | Where ProcessName -Like "UCSrvW*"

            # Capture and display the counts
            $CPCount = $CPProcess.count
            $WPCount = $WPProcess.count
            write-host "CPCount: $CPCount, expected: $CPThreshhold"
            write-host "WPCount: $WPCount, expected: $WPThreshhold"
            echo       "CPCount: $CPCount, expected: $CPThreshhold" >> $LogFileName
            echo       "WPCount: $WPCount, expected: $WPThreshhold" >> $LogFileName

        }
        Process{
            if($CPCount -lt $CPThreshhold){$Body = "UC4 CP process count of $CPCount is less than $CPThreshhold! (PowerShell script Get-UC4Processes.ps1)"; 
                Send-MailMessage -smtpServer $Server -to $To -from $From -subject $Subject -Body $Body -priority High;
                write-host "CPCount alarm email sent!";
                echo       "CPCount alarm email sent!" >> $LogFileName}else{}

            if($WPCount -lt $WPThreshhold){$Body = "UC4 WP process count of $WPCount is less than $WPThreshhold! (PowerShell script Get-UC4Processes.ps1)"; 
                Send-MailMessage -smtpServer $Server -to $To -from $From -subject $Subject -Body $Body -priority High;
                write-host "WPCount alarm email sent!";
                echo       "WPCount alarm email sent!" >> $LogFileName}else{}
            echo       "****** end of process ******"
            echo       "****** end of process ******" >> $LogFileName
        }
        End{
            
        }
    }

    Get-UC4Processes


  • 4.  Send a notification if a server process (CP / WP) goes down

    Posted May 13, 2017 08:42 AM
    Related topic:

    For Agents, refer to this post.