Dashboards & Visualizations

How can I create a panel that calculates everything and changes the panel color based on the value of Percent Users Online?

albinortiz
Engager

Greetings,

I have a code that calculates a percentage based on the value of two other panels I have. What I want to do is, Instead of having 3 different panels (ie. 1 for Total Registered Users, 1 for Total Online Users, and 1 for the Percent of Users Online), I want to have 1 panel that calculates everything and changes the panel color based on the value of Percent Users Online. The panel needs to display the Total Online Users.

alt text

0 Karma

493669
Super Champion

Try this run anywhere search:

<dashboard>
  <label>singlevalue</label>
  <row>
    <panel>
      <single>
        <search>
          <query>index=_internal|eval percentage="90"|table percentage </query>
          <earliest>-15m</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="colorBy">value</option>
        <option name="colorMode">none</option>
        <option name="drilldown">none</option>
        <option name="numberPrecision">0</option>
        <option name="rangeColors">["0x65a637","0x6db7c6","0xf7bc38","0xf58f39","0xd93f3c"]</option>
        <option name="rangeValues">[0,30,70,100]</option>
       <option name="useColors">1</option>
       </single>
    </panel>
  </row>
</dashboard>

albinortiz
Engager

Alright so I was looking at your code piece and it does what it is intended however, I am running into something I don't quite understand.

Here is the code I am using:

Index=winevents | dedup host
| stats count as TotalActiveHosts
| append [ ldapsearch search = "(objectClass = computer)" attrs = "cn, operatingSysem, operatingSystemVersion"
| lookup dnslookup clienthost AS cn
| search (operatingSystem = "Win*")
| stats count as TotalWinClients
| append [ makeresults
| eval Percent = round ((TotalActiveHosts/TotalWinClients) * 100, 1) ]

So here's my issue: I want to be able to display the TotalActiveHosts and change its color based on the percentage that is being calculated.

Maybe this gives you a clearer picture. All the help I can get is greatly appreciated.

0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...