Forum Discussion

Zahid_Haseeb's avatar
Zahid_Haseeb
Moderator
12 years ago

Only need to add specific word in monitoring process

Environment

OS = RHEL/Solaris

SFHA = 5.1/6.x

Query

Under monitoring process I only want the VCS see xyz name instead of a complete line in the result ps -ef |grep xyz

7 Replies

  • Under monotoring process we have to add complete process line which we got under result of ps -ef|grep process. (See a example output below)


    process.exe  /home/app/logs/process.o 5

     

    The number 5 is the verbosity of application logs. Sometimes the application support guys change the value of verbosity from 5 to 4 or 3 which results application resource faulted. (it happens sometime when the support team deploy application fixes/patches ) . So we only want to pick the process name only instead of catching a complete process line.

  • It is possible that the same binary takes different arguments to invoke different processes. It is for this purpose that the complete process line should be provided in the MonitorProcesses attribute of Application resource.

    For your use case, you can probably write a small script that will simply match the process line ignoring the last 5 or 4 or 3 and will return 100 if the process is not running and 110 if it is running. Then this script can be configured in MonitorProgram attribute of the resource.

  • Or you can use PIDFiles attribute - i.e modify you StartProgram script to create a pid file and get VCS to monitor the process in the PIDFile by specifying this PIDFile in the attribute.

    Mike

  • I am able to create a monitor program. Now the time is to remove processes from the Monitor Process attribute and define the monitor program under monitor program attribute.

    My question is that, can I do it while the Service Grroup is online ?

  • You can use:

    hares -modify app-res MonitorProcesses ""

     

    or

    hares -modify app-res MonitorProcesses -delete -keys

     

    I would freeze service group first and add MonitorProgram first.  After adding MonitorProgram, it should use BOTH MonitorProcesses and MonitorProgram, so if resource is still online after this, then MonitorProgram works and you can remove MonitorProcesses.

    Mike

     

  • One thing I noticed while using the Monitor Program. On every 24 hours close to 1:50 AM - 1:59 AM my application resource gets faulted which leads a failover. This I noticed in last two days. Eventually I removed the monitor program script and add the monitor processes and then did not see any unexpected failover.

    After discussing with the application support team, they respond that it seems one process which is monitor getting crashed. My question is why at time of using the specific process is crashing.

    Please Note: I only want to grap a specific word from the Process instead of complete process. which is not possible when using the Monitor Process. Thats why we created a Monitor Program. See the below created Monitor Program. Where USER_ABC is the user under which the process is running

    SCRIPT

    #!/usr/bin/bash

    returnval=110

    for arg in $*;
    do
        proc=`ps -ef | grep USER_ABC | grep exe |grep -v grep | grep $arg | awk '{print $8}'`
        if [ -z "$proc" ]; then
            echo $arg is not running
            returnval=100
        else
            if [ -z "`echo $proc | grep $arg`" ]; then
                echo $arg is not running
                returnval=100
            fi
        fi
    done

    exit $returnval

     

    MONITOR PROGRAM EXECUTION

    #/FOLDER/MonitorProgram.sh process1 process2 process3

    #110