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. Actions for services

Actions for services

Scheduled Pinned Locked Moved Support
7 Posts 3 Posters 59.8k 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
    lindeamon
    wrote on last edited by
    #1

    hi,

    i want to create a template action which will start a service if it was stopped.
    i will create an event for that and event configuration corresponded.
    what i can't figure out is what are the variables i need to use ? i have tried understanding it from the on-line tutorials but no luck there.
    i want to create it to run via the agent, unless running it from the server is preferred.

    10x,
    Lindeamon

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

      Hi!

      First, you have to create action on agent, like this:

      Action = StartService:net start $1
      

      Then you can create action object on server, which will execute agent's action "StartService" on node where service was stopped. You can set node address to %a (it will expand to node's IP address), and action to

      StartService %6
      

      assuming that you have service name entered into instance field in appropriate DCI.

      Then execute this action from event processing policy in reaction to service stopped event.

      Best regards,
      Victor

      1 Reply Last reply
      0
      • L
        L
        lindeamon
        wrote on last edited by
        #3

        hi victor,

        so i have to assume that every action that i want the agent to run should be configured both on the agent and the server ?
        what type of actions i would typically run on the server ? could i have solved this problem by running a command on the server with reference to the malfunctioned node, assuming that the server is windows and it can run the "sc" command ?
        can i have a reference to the $1 and %6 uses ? where and when to use them ?
        i hope you will find the time to make some order in the help section to include all of this so we will not have to bother you with the little things.

        Best Regards,
        Lindeamon

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

          Hi,

          The parameters available in event processing are listed here:
          http://wiki.netxms.org/wiki/UM:Event_Processing#Macros_for_Event_Processing

          You can use up to 99 variables linked to a particular event with the macros %1, %2, ..., %99

          I can't seem to find any documentation of parameters for actions, but the principle is the same as parameters for ExternalParameter which are described in a stickied thread in the forums:
          https://www.netxms.org/forum/configuration/agent-config-(action-externalparam)/msg3136/#msg3136

          Hope this helps,

          Kind regards,
          bdefloo

          1 Reply Last reply
          0
          • L
            L
            lindeamon
            wrote on last edited by
            #5

            10x bdefloo,

            thank you for your help.
            i was aware of this possibilities but it is always good to refresh my memory.
            still there is one thing that i do not understand: why %6 ? what %1 refer too ?
            what happens if i have 2 parameters to pass ?

            Regards,
            Lindeamon

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

              Hi!

              All %number macros refers to event-specific event's parameters. They can have different meaning for different events. For example, for threshold violation events %6 refers to "instance" attribute, and for event created from SNMP trap it will be varbind mapping #6. For well-known events you can see exact parameter meaning in event description.

              Best regards,
              Victor

              1 Reply Last reply
              0
              • L
                L
                lindeamon
                wrote on last edited by
                #7

                hi victor,

                i have played with this for a while and finally i have solved the problem.
                i have discovered that the $x in the "action...." can be even a word. for ex. if %2 is "State of xxxxxx" then the $3 will be xxxxxx
                maybe there is a way to simplify the process ? what will happen when i decide to pass %1 instead of %2 ? will i have to run the agent in debug mode again to discover what params does it get ?

                Best Regards,
                Lindeamon

                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