Hi everyone. I need an help to insert in a Modal View one splunk visualization contained in Event Timeline App.
I wrote this code with splunk dev help
ticketModalTest.js
require([
You missed # . 🙂
Just confirm el: $('#modalVizualizationTest'), in below block.
var myViz = new customViz({
id: "myViz",
managerid: search7.name,
drilldown: "none",
el: $('#modalVizualizationTest'),
showPager: false,
"link.openSearch.visible": "false",
"link.exportResults.visible": "false",
"link.inspectSearch.visible": "false",
"refresh.link.visible": "false",
"showLastUpdated": false
}).render();
Thanks
KV
▄︻̷̿┻̿═━一
If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.
You missed # . 🙂
Just confirm el: $('#modalVizualizationTest'), in below block.
var myViz = new customViz({
id: "myViz",
managerid: search7.name,
drilldown: "none",
el: $('#modalVizualizationTest'),
showPager: false,
"link.openSearch.visible": "false",
"link.exportResults.visible": "false",
"link.inspectSearch.visible": "false",
"refresh.link.visible": "false",
"showLastUpdated": false
}).render();
Thanks
KV
▄︻̷̿┻̿═━一
If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.
Dashboard XML
<form hideFilters="true" script="loadLabels.js,multiselectAllRemove.js, ticketModalTest.js" theme="light">
<init>
<!-- https://colorbrewer2.org/#type=qualitative&scheme=Paired&n=12 -->
<set token="qualitativePaired">[0xa6cee3,0x1f78b4,0xb2df8a,0x33a02c,0xfb9a99,0xe31a1c,0xfdbf6f,0xff7f00,0xcab2d6,0x6a3d9a,0xffff99,0xb15928]</set>
<set token="red_green">[0xe31a1c,0x33a02c]</set>
<set token="green_red">[0x33a02c,0xe31a1c]</set>
<set token="form.tok_weeks">-7w@w1</set>
<set token="form.tok_stats">max</set>
</init>
<label>Execution Statistics Clone</label>
<search id="base_execution_statistics">
<query>
index=optimus_execution_statistics_idx
| stats latest(script_name) as script_name latest(execution_status) as execution_status latest(execution_started) as execution_started latest(execution_ended) as execution_ended latest(category_name) as category_name latest(execution_host) as execution_host by _time execution_id
</query>
<earliest>-30d@d</earliest>
<latest>now</latest>
<sampleRatio>1</sampleRatio>
</search>
<fieldset submitButton="false" autoRun="true"></fieldset>
<row depends="$ghost_boo$">
<panel>
<html>
<style>
#modalVizualization {
display: flex; !important;
}
#modalVizualization4 {
display: flex; !important;
}
#nousage .ccat-default_category {
fill: rgb(66, 150, 58) !important;
stroke: rgb(66, 150, 58) !important;
}
#usage .ccat-default_category {
fill: rgb(173, 47, 47) !important;
stroke: rgb(173, 47, 47) !important;
}
#compare .ccat-Free {
fill: rgb(66, 150, 58) !important;
stroke: rgb(66, 150, 58) !important;
}
#compare .ccat-Used {
fill: rgb(173, 47, 47) !important;
stroke: rgb(173, 47, 47) !important;
}
#table1 h3.dashboard-element-title {
color:white !important;
}
</style>
</html>
</panel>
</row>
<row>
<panel>
<title>Execution Statistics Filters</title>
<input type="dropdown" token="tok_time_range">
<label>Time Range</label>
<choice value="-2d@d">2 Days</choice>
<choice value="-7d@d">7 Days</choice>
<choice value="-30d@d">30 Days</choice>
<initialValue>-2d@d</initialValue>
<default>-2d@d</default>
<change>
<condition>
<unset token="tok_overlap_time"></unset>
</condition>
</change>
</input>
</panel>
</row>
<row>
<panel>
<title>Usage Trend</title>
<input type="dropdown" token="tok_choice">
<label>Metric</label>
<choice value="Active VMs">Active VMs</choice>
<choice value="License Usage">License Usage</choice>
<default>Active VMs</default>
<initialValue>Active VMs</initialValue>
<change>
<condition>
<unset token="tok_overlap_time"></unset>
</condition>
</change>
</input>
<chart id="ticket_modal_1">
<search base="base_execution_statistics">
<query>| where _time >= relative_time(now(), "$tok_time_range$")
| stats values(execution_ended) as execution_ended values(eval(execution_id."|".execution_host."|".execution_started."|".execution_ended)) as fullid by _time execution_started execution_id execution_host
| streamstats time_window=1h values(eval(execution_id."|".execution_host."|".execution_started."|".execution_ended)) as prev_fullid
| mvexpand prev_fullid
| rex field=prev_fullid "(?<prev_execution_id>.*)\|(?<prev_execution_host>.*)\|(?<prev_execution_started>.*)\|(?<prev_execution_ended>.*)"
| fields - fullid prev_fullid
| table execution_started execution_ended execution_id execution_host _time *
| where strptime(prev_execution_ended,"%Y-%m-%d %H:%M:%S") >= _time
| eval overlap = case(execution_id=prev_execution_id,0,execution_started=prev_execution_ended AND execution_host=prev_execution_host,0,execution_started >= prev_execution_started AND execution_started <= prev_execution_ended,1,1=1,0)
| stats sum(overlap) as overlap values(execution_host) as execution_host by execution_id _time
| timechart span=10m max(overlap) as "Max Overlap" dc(execution_id) as "Active Scripts" dc(execution_host) as "Active VMs"
| eval "License Usage" = if(isnull('Max Overlap'),0,'Max Overlap' + 1)
| eval "Limit" = `number_of_licenses`
| eval "Limit Reached" = if('$tok_choice$'>='Limit','$tok_choice$',null)
| fields _time "$tok_choice$" "Limit Reached"
| where _time >= relative_time(now(), "$tok_time_range$")</query>
</search>
<option name="charting.axisLabelsX.majorLabelStyle.overflowMode">ellipsisNone</option>
<option name="charting.axisLabelsX.majorLabelStyle.rotation">0</option>
<option name="charting.axisLabelsY.majorUnit">1</option>
<option name="charting.axisTitleX.visibility">collapsed</option>
<option name="charting.axisTitleY.visibility">collapsed</option>
<option name="charting.axisTitleY2.visibility">visible</option>
<option name="charting.axisX.abbreviation">none</option>
<option name="charting.axisX.scale">linear</option>
<option name="charting.axisY.abbreviation">none</option>
<option name="charting.axisY.scale">linear</option>
<option name="charting.axisY2.abbreviation">none</option>
<option name="charting.axisY2.enabled">0</option>
<option name="charting.axisY2.scale">inherit</option>
<option name="charting.chart">line</option>
<option name="charting.chart.bubbleMaximumSize">50</option>
<option name="charting.chart.bubbleMinimumSize">10</option>
<option name="charting.chart.bubbleSizeBy">area</option>
<option name="charting.chart.nullValueMode">gaps</option>
<option name="charting.chart.showDataLabels">none</option>
<option name="charting.chart.sliceCollapsingThreshold">0.01</option>
<option name="charting.chart.stackMode">default</option>
<option name="charting.chart.style">shiny</option>
<option name="charting.drilldown">all</option>
<option name="charting.layout.splitSeries">0</option>
<option name="charting.layout.splitSeries.allowIndependentYRanges">0</option>
<option name="charting.legend.labelStyle.overflowMode">ellipsisEnd</option>
<option name="charting.legend.mode">standard</option>
<option name="charting.legend.placement">bottom</option>
<option name="charting.lineWidth">2</option>
<option name="charting.seriesColors">$green_red$</option>
<option name="height">250</option>
<option name="refresh.display">progressbar</option>
<option name="trellis.enabled">0</option>
<option name="trellis.scales.shared">1</option>
<option name="trellis.size">medium</option>
<drilldown>
<condition></condition>
</drilldown>
</chart>
</panel>
</row>
</form>
SplunkBase App
https://splunkbase.splunk.com/app/4370/