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!

Index This | Forward, I’m heavy; backward, I’m not. What am I?

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

A Guide To Cloud Migration Success

As enterprises’ rapid expansion to the cloud continues, IT leaders are continuously looking for ways to focus ...

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...