Dashboards & Visualizations

Single Value Button going to red/amber/green based on dynamic threshold value

adityapavan18
Contributor

Hi

I have a scenario where i have to put a single value button showing a avg response time that would go red/amber/green on going on/off a threshold.

This is easy and can be done using range if there is a constant threshold value.

Now in my scenario, the threshold value is not constant and needs to be changed with time, and the single value button will go red/amber/green based on the threshhold value at that point of time.

How do i specify threshold based on time?

Can this be done in splunk dashboards.Please suggest

santosh_hb
Explorer

Hi, I am a newbie in Splunk. Currently, I am also working on the same issue as above i.e. the threshold value is dynamic and keeps changing with time. I need to display red, green and amber based on the threshold value. i.e. if the latency is 20% of threshold then red icon should be displayed, if the latency is 50% of threshold then green icon should be displayed and if the latency is 120% of threshold then amber icon should be displayed.
As, I am new to .css and .js, I am unable to understand the above code. Can anyone please share the entire code (i.e. xml code, .css and .js code). It will be of much help for me.
Currently, I have created a sample .csv file that contains the following fields:
Ex: data_hour (1/1/13 8:00 AM), Latency (secs): 1.25, Threshold: 1
Thanks in advance.

0 Karma

linu1988
Champion

Please use the application.css and .js file to acheive the goal. Have a column where it shows normal/warning/critical using eval statement.

In my case i am using .SimpleResultsTable module where i will do exchange for image for a value.

App.css:
.SimpleResultsTable td.Normal {
background-image: url(images/normal.gif/png); [depends on browser]
background-repeat:no-repeat;
background-position:5px 3px;
}

.js file:

onResultsRendered: function() {
this.forEachCellInColumn("State", function(tdElement) {
if (tdElement.text()=="Started") {
tdElement.text("").addClass("Normal");
} else {
tdElement.text("").addClass("Warning");
}
});
}
Add these codes, which will work on a dashboard.

adityapavan18
Contributor

Thnx a lot. Look-up way should do the trick thnx

0 Karma

linu1988
Champion

It depends what is your requirements are like! If your threshold values are varying with time, create a lookup / using eval statement find the exact threshold value for that Hour. I will give an example

eval threshold=case(date_hour =9 threshold, "3", date_hour =11, "5")|eval State=case(value <= threshold, "Normal", value >= threshold*1.2, "warning", value >= threshold*1.5, "Critical")|Table State

then as i mentioned above replace the codes and place a image with relevant color to appserver/static/images folder. it will do the job what you want

0 Karma

adityapavan18
Contributor

My doubt is that i dont have a constant threshold value.The threshold value changes with time? how do you factor that into that?? example at 9:00 AM the threshold value is 3 it will go to amber at 120% of 3 and red at 150%3 ..where the i need the threshold to be changed to 5 at 11:00 AM now the amber state with will more than 120% of 5 and so ..

0 Karma

linu1988
Champion

if you do a simple view on a dashboard, you will be able to use "simpleresultstable" module for displaying your eval field value. So i am not sure which i should explain? The .js file will replace the value with image on the go.

0 Karma

adityapavan18
Contributor

Thnks. But could you elaborate/explain the solution u gave.

0 Karma
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...