Splunk Search

How to create a drop-down to show counter information based on host?

idab
Path Finder

Hi everyone,

Need help with my XML below. I need to create a drop-down to display certain data based on the host and counter fields.

I can't figure out how to make the drop-down display the Avg. Disk sec/Transfer and Avg. Disk Bytes/Transfer for a host when selected on the same dashboard, even though the search works properly when running as a report. My search question is how do I create the search to display the Avg. Disk sec/Transfer and Avg. Disk Bytes/Transfer for a selected host on the drop-down?

code Here:

<form>
  <label>DEMO </label>
  <fieldset submitButton="true" autoRun="true">
    <input type="dropdown" token="host" searchWhenChanged="true">
      <label>Host</label>
      <search>
        <query>| metadata type=hosts index=* | table host</query>
        <earliest>-4h@m</earliest>
        <latest>now</latest>
      </search>
      <fieldForLabel>host</fieldForLabel>
      <fieldForValue>host</fieldForValue>
    </input>
    <input type="time" token="disk">
      <label>select time</label>
      <default>
        <earliest>-4h@m</earliest>
        <latest>now</latest>
      </default>
    </input>
    <panel>
      <title> IOPS Latency</title>
      <chart>
        <search>
          <query>index=perfmon counter="Avg. Disk sec/Transfer"  Host="*" collection=LogicalDisk earliest=-1m [search index=perfmon counter="*"  Host="*"   collection=LogicalDisk earliest=-1m | stats max(Value) as latency by host | sort 10 -Value | fields host ]  | eval dataValue= "avg disk sec/transfer:" + tostring(round(Value,3)*1000)  | makemv delim="," allowempty=true dataValue  | mvexpand dataValue  | eval part=split(dataValue,":")  | eval category = Host + ":" + mvindex(part,0)  | eval dataPoint = tonumber(mvindex(part,1))  | timechart span=1s latest(dataPoint) by category
</query>
0 Karma
1 Solution

jensonthottian
Contributor

It seems you have'nt used the token for the host selected in your search string .

use --Host="$host$" --instead of Host="*" ,throughout both the search strings.

View solution in original post

jensonthottian
Contributor

It seems you have'nt used the token for the host selected in your search string .

use --Host="$host$" --instead of Host="*" ,throughout both the search strings.

idab
Path Finder

Thanks jensothian. 😉

0 Karma

somesoni2
SplunkTrust
SplunkTrust

If this has resolved your issue, do remember to accept the answer by clicking on the tick mark Accept button/link below the answer.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...