Splunk Search

Adding Values from Different Graphs Together

andresvelazq
Explorer

Hello,

Still rather new at Splunk, I have 4 hosts that I need to add the values of 3 different graphs I obtained from Analytics. I'm not entirely sure how to do that, I tried putting all those together and opening search to see if I could work out how to add the values, but I'm just pretty lost on this.

So is there a way to do this? If so, how?

Labels (3)
0 Karma
1 Solution

andresvelazq
Explorer

figured it out, replaced the avg from to4kawa's post to sum, removed the eval hosts line and did the timechart by host instead of hosts

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust
More information is needed. How were the 3 graphs produced? What does the data look like? What should the results look like? Can you share your current queries?
---
If this reply helps you, Karma would be appreciated.
0 Karma

andresvelazq
Explorer

Sorry about that, the content of the search is this (changed index and host names):

| mstats avg(_value) prestats=true WHERE metric_name="logicaldisk.disk_writes/sec" AND index="indexname" AND host="host*" span=10s BY host
| timechart avg(_value) span=10s agg=max limit=5 useother=false BY host
| fields - _span*
| rename * AS "* - logicaldisk.disk_writes/sec"
| rename "_time - logicaldisk.disk_writes/sec" AS _time
| append [
| mstats avg(_value) prestats=true WHERE metric_name="logicaldisk.disk_reads/sec" AND index="indexname" AND host="host*" span=10s BY host
| timechart avg(_value) span=10s agg=max limit=5 useother=false BY host
| fields - _span*
| rename * AS "* - logicaldisk.disk_reads/sec"
| rename "_time - logicaldisk.disk_reads/sec" AS _time
]
| selfjoin keepsingle=true _time
| append [
| mstats avg(_value) prestats=true WHERE metric_name="logicaldisk.disk_transfers/sec" AND index="indexname" AND host="host*" span=10s BY host
| timechart avg(_value) span=10s agg=max limit=5 useother=false BY host
| fields - _span*
| rename * AS "* - logicaldisk.disk_transfers/sec"
| rename "_time - logicaldisk.disk_transfers/sec" AS _time
]
| selfjoin keepsingle=true _time

The original graphs were grabbed from the Analytics tab next to search, shows the reads, writes, and transfers per second for each of 4 hosts. I'd like to add the values obtained from each of the three graphs and have one graph with 4 lines showing the sums of the information for each server. The statistics table is mostly empty, left most column lists the times. There are 12 columns, each named one of the 4 hosts, followed by read/write/transfer per second. The rows only have 3 values in each, just the amount of reads/writes/transfers at that time for a specific host.

Is that enough info?

0 Karma

to4kawa
Ultra Champion

| mstats avg(_value) prestats=true WHERE (metric_name="logicaldisk.disk_writes/sec" OR   metric_name="logicaldisk.disk_reads/sec"   OR  metric_name="logicaldisk.disk_transfers/sec" )AND index="indexname" AND host="host*" span=10s BY host metric_name

| eval hosts=host." - ".metric_name

|timechart avg(_value) span=10s agg=max limit=5 useother=false BY hosts
| fields - _span*

0 Karma

andresvelazq
Explorer

figured it out, replaced the avg from to4kawa's post to sum, removed the eval hosts line and did the timechart by host instead of hosts

0 Karma

andresvelazq
Explorer

thank you, that's a much cleaner form for the search, but how would I go about adding the read, write, and transfers for each host? 

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...