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. ConfigurableQuery is probably not working properly

ConfigurableQuery is probably not working properly

Scheduled Pinned Locked Moved Support
5 Posts 2 Posters 40.4k 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.
  • S
    S
    saksham.adyso
    wrote on last edited by
    #1

    If I create a configuration for the Query parameter, everything works correctly. NetXMS connects to the database and the DCI returns the correct value. If I change the same Query parameter to a ConfigurableQuery parameter (and modify its value according to the documentation) and modify the metric to the query name and put a value in parentheses to replace the ? in the query, an empty result set is always returned. I have verified this on three drivers (mssql, mysql and pgsql). If I separately validate the query in another application, everything works correctly.

    Configuration sample
    ConfigurableQuery = Database.Data:id1:Custom data:SELECT `name` FROM `test` WHERE `description` LIKE "?";

    1 Reply Last reply
    0
    • F
      F
      Filipp Sudanov
      wrote on last edited by
      #2

      You can try to run agent with DebugLevel = 6 in it's config - actual query and detail of execution should be visible in the log. Pls share the log part related to execution of the query.

      1 Reply Last reply
      0
      • S
        S
        saksham.adyso
        wrote on last edited by
        #3

        It seems that ? is not going to be replaced by a metrics argument.
        2025.04.07 13:24:03.180 *D* [comm.cs.1          ] Requesting metric "Database.Data(foo)"
        2025.04.07 13:24:03.180 *D* [dbquery            ] H_DirectQueryConfigurable: Executing query "SELECT `name` FROM `test` WHERE `description` LIKE "?";" in database "id1"

        1 Reply Last reply
        0
        • F
          F
          Filipp Sudanov
          wrote on last edited by
          #4

          Try removing quotes around the question mark:

          ConfigurableQuery = Database.Data:id1:Custom data:SELECT `name` FROM `test` WHERE `description` LIKE ?;

          1 Reply Last reply
          0
          • S
            S
            saksham.adyso
            wrote on last edited by
            #5

            Quotes removed:
            2025.04.08 10:13:13.718 *D* [comm.cs.1          ] Requesting metric "Database.Data(foo)"
            2025.04.08 10:13:13.718 *D* [dbquery            ] H_DirectQueryConfigurable: Executing query "SELECT `name` FROM `test` WHERE `description` LIKE ?;" in database "id1"
            Result is fine.
            But if I add my own text to the value (e.g. LIKE %?), an error is logged You have an error in your SQL syntax.
            The metric only works when I put the whole condition in the metric brackets (it must not be in the configuration file).

            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