Monitoring Splunk

how to change graph color to Red, Green and Yellow based on some condition

yagnaprasad
New Member

index=osnixscript sourcetype=cpu host=* | multikv fields pctIdle | eval Percent_CPU_Load = 100 - pctIdle | timechart span=5m avg(Percent_CPU_Load) by host

i  have modified above query into below and added conditions based on criteria to change the color of the graph..


index=osnixscript sourcetype=cpu host=* | multikv fields pctIdle | eval Percent_CPU_Load = 100 - pctIdle | timechart span=5m avg(Percent_CPU_Load) by host | eval Threshold_Color=case(Percent_CPU_Load>0 AND Percent_CPU_Load>2, "Normal", Percent_CPU_Load>2 AND Percent_CPU_Load <=8, "Warning", Percent_CPU_Load > 8 AND Percent_CPU_Load < 90, "Critical")

i have added code in the xml with <option name="charting.fieldColors">{"Normal":0xFF0000,"Warning":0xFFFF00, "Critical":0x73A550}</option>

I couldn't be able to see the change in graph colors based on the conditions defined in the query. Can someone please look into the query and correct me with changes required to fix this issue. Thanks in Advance

 

 

 

 

Labels (1)
0 Karma

yagnaprasad
New Member

I am looking for graph color change if we put condition for ex: if(cpuusage <40) then the graph color should be in "Green". if (cpuusage >40 and cpuusage <75) then graph color should be in "Yellow". if cpuusage > 75 then the graph color should be in Red. Please suggest us with the changes needs to be done w.r.to query and source code (xml changes required). Please help us. Thanks in Advance.

0 Karma
Get Updates on the Splunk Community!

Splunk AI Assistant for SPL | Key Use Cases to Unlock the Power of SPL

Splunk AI Assistant for SPL | Key Use Cases to Unlock the Power of SPL  The Splunk AI Assistant for SPL ...

Buttercup Games: Further Dashboarding Techniques (Part 5)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...

Customers Increasingly Choose Splunk for Observability

For the second year in a row, Splunk was recognized as a Leader in the 2024 Gartner® Magic Quadrant™ for ...