DX Infrastructure Management

Expand all | Collapse all

How starting 2 process in specific order when a process it's down

Jump to Best Answer
  • 1.  How starting 2 process in specific order when a process it's down

    Posted 7 days ago
    Hi all.
    I have a challenge. We need monitoring a process of an application and when this process it's down somehow run a .bat that stop and start two processes in order.

    I'm thinking of doing this with process probe and when the process it's down, with the probe execute the .bat and from here start the process down and another process necessary for my application.

    My question is, can I use process probe for this monitoring?. If isn't possible with process probe, exist other strategy for this monitoring?

    Process in monitoring ----->
    Can I to use the "Command path" or "Command arguments" or "Start directory" for starting a .bat?

    This is the command for start the lines of the .bat -----> "C:\Users\Administrator\Documents\pruebas.bat" I don't know if need another parameter for to execute the .bat

    That are the lines of the .bat ----->
    net stop "Automate Enterprise 11 Execution Server"
    net start "Automate Enterprise 11 Execution Server"
    net stop "Automate Enterprise 11 Management Server"
    net start "Automate Enterprise 11 Management Server"


  • 2.  RE: How starting 2 process in specific order when a process it's down

    Posted 7 days ago
    I do not see why just changing the command path to the full path of your batch files would not work.
    Have you tried that?
    Did you run into a problem?

    ------------------------------
    Gene Howard
    Principal Support Engineer
    Broadcom
    ------------------------------



  • 3.  RE: How starting 2 process in specific order when a process it's down

    Posted 7 days ago
    Hi @Gene Howard It's working with ​"Command path", but I see that this isn't functional because this enters a loop. I will try explain.

    processA ----> Monitoring with processes probe.
    processB ----> Monitoring with processes probe.

    When down processA, the .bat should start the process in order, first processA and after.processB
    If processB it's down, the .bat  should start in order too, first processA and after.processB

    I'm thinking in other strategy, monitoring both processes with the processes probe and when them down with AO, create a filter "Action type = script" to execute a script that connect to the server and execute the .bat.
    The problem is that i don't know how can be this script i don't know anything of Perl and I don't know how is the parameter for connect to server

    What do you think?
    If you know how can be this script please help me.

    Thanks for all.



  • 4.  RE: How starting 2 process in specific order when a process it's down

    Posted 6 days ago
    so yes if you have two profiles set up and both stoping and starting each other I would expect this to fail.
    Your idea of using nas is a good one.
    I would suggest nas in conjunction with nexec.
    An example of this would be the below KB
    https://ca-broadcom.wolkenservicedesk.com/external/article?articleId=9658

    ------------------------------
    Gene Howard
    Principal Support Engineer
    Broadcom
    ------------------------------



  • 5.  RE: How starting 2 process in specific order when a process it's down

    Posted 6 days ago
    Hi Gene
    Thanks for you comments, I appreciate.

    The link that you send me all images i can't see. Is possible send me the information directly to my email (mechagarreta@netreadysolutions.com) or other link that working fine?



  • 6.  RE: How starting 2 process in specific order when a process it's down

    Posted 6 days ago
    if you scroll to the very bottom of the kb you will see the attached zip files with the images in them for you to review.

    ------------------------------
    Gene Howard
    Principal Support Engineer
    Broadcom
    ------------------------------



  • 7.  RE: How starting 2 process in specific order when a process it's down

    Posted 6 days ago
    Thank you very much @Gene Howard
    I am see the procedure but I don't how connect it to server for execute the .bat. My intention is with processes probe generate alarm when process it's down and with NAS execute script that connect to server and run the .bat. Is possible this?

    Thanks again for all


  • 8.  RE: How starting 2 process in specific order when a process it's down
    Best Answer

    Posted 6 days ago
    1) install nexec on the same machine as the process probe.
    2) set up a profile in nexec to execute the batch file and test it.
    3) when the process alarm comes in for either of the processes have an AO profile that executes a script to call the batch file.

    I would make sure this is done on overdue say 2 minutes or something. the batch file will cause the other profile to send an alarm and you do not want to execute the same script again immediately. You may have to play around with the timing.

    Please are some good threads on using nexec with nas
    https://community.broadcom.com/communities/community-home/digestviewer/viewthread?MID=741091#bm278ca8f3-9ce2-4912-b26d-f7f2ae442603
    https://community.broadcom.com/communities/community-home/digestviewer/viewthread?MID=769105#bm760f76c4-8071-4577-9e76-be9ce203cd82

    ------------------------------
    Gene Howard
    Principal Support Engineer
    Broadcom
    ------------------------------



  • 9.  RE: How starting 2 process in specific order when a process it's down

    Posted 6 days ago
    Thanks @Gene Howard
    I am test this solution and I think I only need a little to achieve the goal.
    I need you help one more time. I am testing this script I found at the community CA, written by @RowanCollis but not working for me, I don't know what is bad.




  • 10.  RE: How starting 2 process in specific order when a process it's down

    Posted 5 days ago
    HI I would need you to post the full LUA script for me to review.
    many Lua scripts can not be run or tested from the editor because the do a get call for an alarm which of course fails in the editor.
    If you have a get alarm in the first couple of lines this is probably your issue and why you are getting a null value.
    You will need to create the alarm and test it.
    Put in lots of print statements and monitor the nas.log file to understand if it is working or not.

    ------------------------------
    Gene Howard
    Principal Support Engineer
    Broadcom
    ------------------------------



  • 11.  RE: How starting 2 process in specific order when a process it's down

    Posted 5 days ago
    @Gene Howard hello... Thanks againg.
    Well I have this configuration.
    1) I generate an alarm from process probe, like this ---->

    2) I have configured a filter on the NAS from the processes probe

    3) This is the LUA script that call the nexec probe when the alarm is true----->
    nimAddr = "/"..al.domain.."/"..al.hub.."/"..al.robot.."/nexec"
    args = pds.create()
    profile = "test-script"
    pds.putString(args,"profile",profile)
    reply,rc = nimbus.request(nimAddr,"run_profile",args)
    if rc ~= NIME_OK then
    print("fire nexec script: ERROR on run profile to "..nimAddr.." (error "..rc..")")
    else
    print("fire nexec script worked!!!")
    end

    4) This is the configuration of nexec probe ----> I tested this configuration and working good

    I hope that you can help me, many many thanks





  • 12.  RE: How starting 2 process in specific order when a process it's down

    Posted 5 days ago
    My friend, this is the logs in loglevel 5 on the nas

    Oct 11 10:41:30:178 [140635943184192] nas: ****************[ Starting ]****************
    Oct 11 10:41:30:178 [140635943184192] nas: nas 9.06, Oct 19 2018
    Oct 11 10:41:30:178 [140635943184192] nas: Copyright 2013, CA. All rights reserved.
    Oct 11 10:41:30:296 [140635943184192] nas: No longer checking for restricted hub license
    Oct 11 10:41:30:296 [140635943184192] nas: NAS Services called using mode: 1
    Oct 11 10:41:30:297 [140635943184192] nas: Scripting license is available.
    Oct 11 10:41:30:305 [140635815053056] nas: maint: Successful registration to: maintenance_mode
    Oct 11 10:41:30:359 [140635764696832] nas: The Activity-Logger is not initialized...
    Oct 11 10:41:30:363 [140635943184192] nas: corrInitialize: Last Alive Time: 1570808460
    Oct 11 10:41:30:374 [140635943184192] nas: nsInitialize stats: 1 elements in 101 blocks
    Oct 11 10:41:30:426 [140635781482240] nas: nisInitialize: NOT enabling batch mode
    Oct 11 10:41:30:429 [140635781482240] nas: _nisQueueDatabaseCreate: Dropped old NIS_QUEUE table from nisqueue.db
    Oct 11 10:41:30:562 [140635013117696] nas: Successfully attached to HUB.
    Oct 11 10:41:30:678 [140635781482240] nas: nisInitialize completed
    Oct 11 10:41:50:462 [140635281553152] nas: (AO) failed to execute script 'ScriptTest', error: scripts/ScriptTest:1: attempt to index global 'al' (a nil value)
    Oct 11 10:42:55:656 [140635281553152] nas: (AO) failed to execute script 'ScriptTest', error: scripts/ScriptTest:1: attempt to index global 'al' (a nil value)


  • 13.  RE: How starting 2 process in specific order when a process it's down

    Posted 5 days ago
    the problem is your first line.
    You have called a variable called al but have not populated it and are trying to use it but it has null values:
    nimAddr = "/"..al.domain.."/"..al.hub.."/"..al.robot.."/nexec"

    that is why you are getting the below error.
    Oct 11 10:41:50:462 [140635281553152] nas: (AO) failed to execute script 'ScriptTest', error: scripts/ScriptTest:1: attempt to index global 'al' (a nil value)

    the first thing in your script need to populate the current alarm into a variable.
    This can be done with a line such as
    ----Get information from alarm---
    al = alarm.get()

    this would then populate the al variable and then in the next line you would not get the error trying to build the address.

    ------------------------------
    Gene Howard
    Principal Support Engineer
    Broadcom
    ------------------------------



  • 14.  RE: How starting 2 process in specific order when a process it's down

    Posted 5 days ago
    As Gene mentioned before this is because you are testing a script which is meant to be triggered by an alarm, but there is no alarm in the script editor, so the "al" variable (which represents the alarm object) is 'nil' or does not exist.

    To truly test this script you would have to have the AO in place, and then send a test alarm which matches the conditions so that it triggers the script.




  • 15.  RE: How starting 2 process in specific order when a process it's down

    Posted yesterday
    Thanks @Gene Howard and @Jason Allen for your help.

    Gene with ​  ​this line (al = alarm.get()), the nexec probe it's working from call AO nas. Thanks.