Getting Data In

What is the correct syntax to change Database Monitor (dbmon-tail) in setup.xml?

pedromvieira
Communicator

What is the correct syntax to change Database Monitor (dbmon-tail) in setup.xml?

Example:

[dbmon-tail://MY_DB/mydbqueryname]

setup.xml

  <block title="My Database Monitor" endpoint="admin/dbx-monitors" entity="MY_DB%252FMYDBQUERYNAME">
0 Karma
1 Solution

pedromvieira
Communicator

I fixed it with correct URL Encoding.

URL Enconding reference:
http://www.w3schools.com/tags/ref_urlencode.asp

inputs.conf

[dbmon-tail://MYQUERY]
interval = 5
query = SELECT * FROM [MY_TABLE] {{WHERE $rising_column$ > ?}}
disabled = 0

setup.xml

  <block title="MY_DBMON" endpoint="admin/dbx-monitors" entity="dbmon%2Dtail%3A%252F%252FMY_DBQUERY">
    <input field="query">
      <label>Query</label>
      <type>text</type>
    </input>
    <input field="interval">
      <label>Schedule</label>
      <type>text</type>
    </input>    
    <input field="disabled">
      <label>Disabled</label>
      <type>bool</type>
    </input>  
  </block>  

This translates:

dbmon%2Dtail%3A%252F%252FMYDBQUERY

TO

dbmon-tail://MYQUERY

View solution in original post

0 Karma

pedromvieira
Communicator

I fixed it with correct URL Encoding.

URL Enconding reference:
http://www.w3schools.com/tags/ref_urlencode.asp

inputs.conf

[dbmon-tail://MYQUERY]
interval = 5
query = SELECT * FROM [MY_TABLE] {{WHERE $rising_column$ > ?}}
disabled = 0

setup.xml

  <block title="MY_DBMON" endpoint="admin/dbx-monitors" entity="dbmon%2Dtail%3A%252F%252FMY_DBQUERY">
    <input field="query">
      <label>Query</label>
      <type>text</type>
    </input>
    <input field="interval">
      <label>Schedule</label>
      <type>text</type>
    </input>    
    <input field="disabled">
      <label>Disabled</label>
      <type>bool</type>
    </input>  
  </block>  

This translates:

dbmon%2Dtail%3A%252F%252FMYDBQUERY

TO

dbmon-tail://MYQUERY
0 Karma

chanfoli
Builder

dbmon-tail stanzas are normally added to an inputs.conf in $SPLUNK_HOME/etc/apps/dbx/local when you create a tail input in the db connect web interface.

This section of the DBX documentation covers the basic concepts:

http://docs.splunk.com/Documentation/DBX/1.1.6/DeployDBX/Configuredatabasemonitoring#How_dbmon-tail_.... I am not sure I understand what you are trying to do with setup.xml in this context. Does this information help? If not could you elaborate a little more on what you are trying to change?

0 Karma

chanfoli
Builder

Although I do not see it documented specifically for setup.xml, if default values for query is what you are after, enclosing the text in a default element inside the query input might work.

<input field="query">
       <label>Query</label>
       <type>text</type>
       <default>SELECT something FROM something-else</default>
     </input>
0 Karma

pedromvieira
Communicator

I moved my dbmon-tail to my app folder. It's working.
I need to change the query part for each installation, because each can point to a new table and/or customer, that's why I want to do it in setup.xml.

setup.xml

  <block title="My - Database Monitor" endpoint="admin/dbx-monitors" entity="...">
    <input field="query">
      <label>Query</label>
      <type>text</type>
    </input>
    <input field="interval">
      <label>Schedule</label>
      <type>text</type>
    </input>    
    <input field="disabled">
      <label>Disabled</label>
      <type>bool</type>
    </input>  
  </block> 

input.conf

[dbmon-tail://MYQUERY]
interval = 5
query = SELECT * FROM [MY_TABLE] {{WHERE $rising_column$ > ?}}
disabled = 0
0 Karma
Get Updates on the Splunk Community!

Take the 2021 Splunk Career Survey for $50 in Amazon Cash

Help us learn about how Splunk has impacted your career by taking the 2021 Splunk Career Survey. Last year’s ...

Using Machine Learning for Hunting Security Threats

WATCH NOW Seeing the exponential hike in global cyber threat spectrum, organizations are now striving more for ...

Observability Newsletter Highlights | March 2023

 March 2023 | Check out the latest and greatestSplunk APM's New Tag Filter ExperienceSplunk APM has updated ...