I've done this with using Splunk Web Framework and Javascript. It can be a pain since you also have to manage all the splunk instance of your splunk panel/charts. Each instance is identified by its id if you plan on refreshing data. Here is a simple example for ideas.
require([
"splunkjs/mvc",
"splunkjs/mvc/utils",
"splunkjs/mvc/tokenutils",
"underscore",
"jquery",
"splunkjs/mvc/simplexml",
"splunkjs/mvc/headerview",
"splunkjs/mvc/footerview",
"splunkjs/mvc/simplexml/dashboardview",
"splunkjs/mvc/simplexml/dashboard/panelref",
"splunkjs/mvc/simplexml/element/chart",
"splunkjs/mvc/simplexml/element/event",
"splunkjs/mvc/simplexml/element/html",
"splunkjs/mvc/simplexml/element/list",
"splunkjs/mvc/simplexml/element/map",
"splunkjs/mvc/simplexml/element/single",
"splunkjs/mvc/simplexml/element/table",
"splunkjs/mvc/simpleform/formutils",
"splunkjs/mvc/simplexml/eventhandler",
"splunkjs/mvc/simpleform/input/dropdown",
"splunkjs/mvc/simpleform/input/radiogroup",
"splunkjs/mvc/simpleform/input/multiselect",
"splunkjs/mvc/simpleform/input/checkboxgroup",
"splunkjs/mvc/simpleform/input/text",
"splunkjs/mvc/simpleform/input/timerange",
"splunkjs/mvc/simpleform/input/submit",
"splunkjs/mvc/searchbarview",
"splunkjs/mvc/tableview",
"splunkjs/mvc/radiogroupview",
"splunkjs/mvc/multidropdownview",
"splunkjs/mvc/searchmanager",
"splunkjs/mvc/savedsearchmanager",
"splunkjs/mvc/postprocessmanager",
"splunkjs/mvc/simplexml/urltokenmodel"
// Add comma-separated libraries and modules manually here, for example:
// ..."splunkjs/mvc/simplexml/urltokenmodel",
// "splunkjs/mvc/checkboxview"
],
function(
mvc,
utils,
TokenUtils,
_,
$,
DashboardController,
HeaderView,
FooterView,
Dashboard,
PanelRef,
ChartElement,
EventElement,
HtmlElement,
ListElement,
MapElement,
SingleElement,
TableElement,
FormUtils,
EventHandler,
DropdownInput,
RadioGroupInput,
MultiSelectInput,
CheckboxGroupInput,
TextInput,
TimeRangeInput,
SubmitButton,
SearchBarView,
TableView,
RadioGroupView,
MultiDropdownView,
SearchManager) {
(function() {
// var instanceList = [];
// Splunk search managers
new SearchManager({
id: "search1",
latest_time: "now",
earliest_time: "-1h@h",
autostart: "true",
search: "| metadata type=hosts | dedup host | table host"
});
var manager = splunkjs.mvc.Components.getInstance("search1");
// gets data
manager.on('search:done', function() {
var results = manager.data('results');
results.on('data', function() {
var rows = results.data().rows
for (var i in rows) {
/*
create your charts
*/
}
});
});
}
... View more