Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. Automatically Restarting a Program with GUI

Automatically Restarting a Program with GUI

Scheduled Pinned Locked Moved Support
6 Posts 2 Posters 47.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B
    B
    bquiggle
    wrote on last edited by
    #1

    I have NetXMS setup to alert me if a particular program stops running but I'd also like it to restart the program automatically when it detects that it is not. I was able to configure this action successfully but NetXMS is running as a service so it restarts the program as a background process. I need the program's GUI to be presented to the logged in user. I understand this is possible by setting up a subagent running it as the logged in user and connecting it to the main agent running as a service but it isn't clear to me how to do this exactly. The documentation only mentions it briefly. Can anyone offer clarification on creating a subagent running as a different user? Is there a better way to restart a program with a GUI than this method?

    1 Reply Last reply
    0
    • A
      A
      Alex Kirhenshtein
      wrote on last edited by
      #2

      Sample config:

      LogFile=c:\netxms\logs\nxagentd.log
      
      [EXT:XYZ]
      LogFile=c:\netxms\logs\nxagentd.xyx.log
      
      Action=StartApp:c:\...\app.exe
      

      Core agent (which runs as service) will read main section, and second instance of the agent will read EXT: section instead.
      Second instance should be started in the user's session with additional command line arguments: -G EXT:XYZ -H
      -G should match EXT: section in the config file and -H will hide agent's console window from user.

      You can add agent to autostart using reg command (or in any other way):

      reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v NetXMSExternalAgent /t REG_SZ /d "C:\NetXMS\bin\nxagentd.exe -c C:\NetXMS\etc\nxagentd.conf -G EXT:XYZ -H" /f
      
      1 Reply Last reply
      0
      • B
        B
        bquiggle
        wrote on last edited by
        #3

        That worked! Thanks for the help!

        1 Reply Last reply
        0
        • B
          B
          bquiggle
          wrote on last edited by
          #4

          A quick follow-up question: can I use a single event processing item to monitor and restart multiple different programs on the same node?

          I want to ensure that program A and B are always running. Is it possible to use filtering scripts in event processing to filter out actions based on certain criteria? Can I use the same processing item to say "if program A stops, run action to restart program A and do NOT run action to restart program B" or do I need to create two different processing items for this?

          1 Reply Last reply
          0
          • A
            A
            Alex Kirhenshtein
            wrote on last edited by
            #5

            There are multiple ways to do that, I'd probably use instance in action name:

            1. configure 2 actions on the agent: StartA, StartB
            2. Create 2 DCIs - Process.Count(A) and Process.Count(B) with threshold "< 1" on both (or any other way how you detect that process is down), set instance to "A" and "B" respectively (in thresholds tab, will be used in action name) and some activation event (can be the same).
            3. handle this event in EPP with "Execute command on remote node via agent" action, as agent action name put something "Start%<instance>"

            Screenshot 2021-01-07 at 01.39.47.png

            Screenshot 2021-01-07 at 01.40.23.png

            Screenshot 2021-01-07 at 01.40.47.png

            1 Reply Last reply
            0
            • B
              B
              bquiggle
              wrote on last edited by
              #6

              Calling for the instance as a variable in the action is what I was missing. That did the trick, thanks!

              1 Reply Last reply
              0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              Powered by NodeBB Contributors
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups