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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...