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. (SOLVED) System.Shutdown with delay

(SOLVED) System.Shutdown with delay

Scheduled Pinned Locked Moved Support
6 Posts 2 Posters 32.2k 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.
  • L
    L
    Lars.Weimar
    wrote on last edited by
    #1

    Hi
    We observe a UPS System so we created an event to shutdown a Windows System. I use the Object Tool "&Shutdown system" to shutdown the node with the Windows agent, if the power fails. This works verry well.

    But how can I delay the shutdown? I´ll shutdown the system with a delay of 5 Minutes and another System with a delay of 8 Minutes.

    Any Idea?

    Sincerly Lars

    1 Reply Last reply
    0
    • V
      V
      Victor Kirhenshtein
      wrote on last edited by
      #2

      Hello!

      You can define custom action which will call shutdown command with timeout option. For example, to be able to shutdown Windows system with delay, you could:

      1. define new custom action in agent:
      Action = System.ShutdownWithDelay:shutdown.exe /t $1
      

      This will add new action called System.ShutdownWithDelay which will accept one argument - delay in seconds.

      1. If you need to call this action automatically from event processing policy, create actions on server with different delays:

      Name: Shutdown_5min
      Action: System.ShutdownWithDelay 300

      Name: Shutdown_8min
      Action: System.ShutdownWithDelay 480

      1. If you need to call this action manually via object tools, create new tools of type "action":

      Name: Shutdown_5min
      Action: System.ShutdownWithDelay 300

      Name: Shutdown_8min
      Action: System.ShutdownWithDelay 480

      Hope this helps!

      Best regards,
      Victor

      1 Reply Last reply
      0
      • L
        L
        Lars.Weimar
        wrote on last edited by
        #3

        Wow, fast reply  🙂

        Step 2 - 3 --> OK and checked.

        Step 1 ?

        How can I define a new custom action in agent?
        I install the agent on my machine. The agent create a directory in c:\NetXMS
        Is it possible to use the "Agent Configurations" at Server?

        Lars

        1 Reply Last reply
        0
        • V
          V
          Victor Kirhenshtein
          wrote on last edited by
          #4

          @lars.weimar said in (SOLVED) System.Shutdown with delay:

          Step 1 ?

          How can I define a new custom action in agent?
          I install the agent on my machine. The agent create a directory in c:\NetXMS

          You should edit agent's configuration file, usually C:\NetXMS\etc\nxagentd.conf and add line mentioned in previous post. You can edit agent's configuration directly from management console by right-clicking node object and selecting "Edit agent configuration" menu. After configuration file change you should restart agent.

          Best regards,
          Victor

          1 Reply Last reply
          0
          • L
            L
            Lars.Weimar
            wrote on last edited by
            #5

            Sorry, it doesen´t work. I added the line above, but the system doesn´t shut down. If I tried the embedded "System.Shutdown" it works fine. The System shutdown immediately.

            I tried the following Setings in nxagentd.conf:

            #
            # NetXMS agent configuration file
            # Created by agent installer at Wed Jul 15 10:58:04 2009
            #
            #System Shutdown with delay
            Action = System.ShutdownWithDelay:shutdown.exe /t $1
            MasterServers = 192.168.5.250
            LogFile = C:\NetXMS\netxms.log
            FileStore = C:\NetXMS\var
            SubAgent = winperf.nsm
            SubAgent = wmi.nsm
            SubAgent = ups.nsm
            

            In Action Properties:
            Clipboard01.jpg

            In Event Procesing Policy Editor:
            Action "Shutdown_1min"

            The Log-File of Client after Power Fail:

            [20-Jul-2009 08:04:58] Log file opened
            [20-Jul-2009 08:04:58] Subagent "WINNT.NSM" loaded successfully
            [20-Jul-2009 08:05:41] Counter set B is empty, collector thread for that set will not start
            [20-Jul-2009 08:05:41] Counter set C is empty, collector thread for that set will not start
            [20-Jul-2009 08:05:41] Subagent "winperf.nsm" loaded successfully
            [20-Jul-2009 08:05:41] Subagent "wmi.nsm" loaded successfully
            [20-Jul-2009 08:05:41] Subagent "ups.nsm" loaded successfully
            [20-Jul-2009 08:05:42] Listening on socket 0.0.0.0:4700
            [20-Jul-2009 08:05:43] NetXMS Agent started
            
            1 Reply Last reply
            0
            • L
              L
              Lars.Weimar
              wrote on last edited by
              #6

              Ok, I found the error.

              My functional agent config:

              #System Shutdown with delay
              EnableActions = yes
              Action = System.ShutdownWithDelay:shutdown.exe -s -c "PowerFail" -t $1
              Action = System.ShutdownAbort:shutdown.exe -a
              

              I added the abort command for Shutdown.

              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