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. Parsing webpage result

Parsing webpage result

Scheduled Pinned Locked Moved Support
5 Posts 3 Posters 16.3k 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.
  • E
    E
    Egert143
    wrote on last edited by
    #1

    Hello

    Is it possible to parse webpage output into dci result?

    for example if webpage returned data like:

    {
      "cluster_name" : "test",
      "status" : "green",
      "timed_out" : false,
      "number_of_nodes" : 2,
      "number_of_data_nodes" : 2,
      "active_primary_shards" : 0,
      "active_shards" : 0,
      "relocating_shards" : 0,
      "initializing_shards" : 0,
      "unassigned_shards" : 0,
      "delayed_unassigned_shards" : 0,
      "number_of_pending_tasks" : 0,
      "number_of_in_flight_fetch" : 0,
      "task_max_waiting_in_queue_millis" : 0,
      "active_shards_percent_as_number" : 100.0
    }
    

    how would i get "status = good" out of it ?

    1 Reply Last reply
    0
    • T
      T
      tfines
      wrote on last edited by
      #2

      In short, yes.  So you can take advantage of existing Nagios probes or other scripts you've written.  But you'll have to write your script.

      Download the manual and see section 6.9 and 6.10 for using "external metrics".

      Here are two easy examples you can add to your nxagentd.conf file to try it out:
      # Windows examples
      # Get number of files in a directory (C:\ here)
      ExternalParameterShellExec = AAFileCount:dir C:\ | find /c /v ""

      # See what directory the agent runs in by default
      ExternalParameterShellExec = AAWhatDirIsTheAgentIn:cd

      After you add the lines restart the agent.

      (I named them AA-whatever so they'd be at the top of the list.  )

      On the nxmc right-click the node, and select Data Collection Configuration.
      Click the New Parameter button.
      Click Select
      Choose either of the above parameters, then click Query.  If you've done it right, it will come back with values.
      You can then have NetXMS do different things based on the values, like it does with any other data point.

      1 Reply Last reply
      0
      • E
        E
        Egert143
        wrote on last edited by
        #3

        Thanks for the reply, i managed to make litle powershell script for task at hand.

        Egert

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

          Hi,

          starting with 3.2 you can also define web service and use it for data collection. For example you can define web service named TestService with correct URL and authentication options and then create DCI with origin "web service". As parameter you should use service_name:path_to_element. For example, to access number_of_pending_tasks element:

          TestService:/number_of_pending_tasks
          

          Best regards,
          Victor

          1 Reply Last reply
          0
          • E
            E
            Egert143
            wrote on last edited by
            #5

            Thats exactly what i needed, many thanks! 🙂

            Egert

            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