Dashboards & Visualizations

Get values from options visalizations

mark8awar
New Member

Hi all

I'm new in Splunk and I would like to know if it's possible to get the values set in an visalization option. For example, in a Single Value visualization I set the color and range in the option panel, and I see these values in the XML as follows:

    <option name="rangeColors">["0x53a051","0xf8be34","0xdc4e41","0xdc4e41"]</option>
    <option name="rangeValues">[95,100,120]</option>

Is it possible to get the values in the arrays so I can use them in a token somewhere else in my dashboard?

Thanks

0 Karma

niketnilay
Legend

@mark8awar following could be some of your options:

Option 1. Use Splunk JS Extension to assign arrays as token include the JS file your dashboards and then use the tokens in your Dashboard to set chart configurations.
Option 2. Push the JS code for above mentioned approach, to dashboard.js, so that every dashboards in your app will already have the JS file included by default and you just need to use the token to set the Chart configurations as per your needs.
Option 3. Create a pre-built Panel with an independent search to set the token/s as per your need. Include the pre-built panel to your dashboards so that tokens can be used for Chart configuration.
Option 4. Add an init section in each dashboard to set the required arrays as tokens to be used in your dashboards.

Option 1, requires a new JS file to be created and included in all your dadhboards.
Option 2, does not need dashboard.js to be explicitly included all your dashboard, but you must ensure that your code does not break or lead to performance issues in your existing app (all other dashboards).
Option 3, does not require JS approach however, you must ensure prebuilt-panel is hidden as it does not have any UI component. It is just used to set initialization tokens, through one point of configuration.
Option 4. will require init section to be manually created/updated/deleted for each dashboard in case your threshold changes.

Please weigh in your option and you should be able to find all 4 approach in Splunk Docs and Splunk Answers.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Register for .conf21 Now! Go Vegas or Go Virtual!

How will you .conf21? You decide! Go in-person in Las Vegas, 10/18-10/21, or go online with .conf21 Virtual, 10/19-10/20.