Splunk Search

Alerting on free space AND % free space - Windows-based systems

jmo1
Path Finder

   We are collecting perfmon information - "Free Megabytes" and "% Free Space".  All is well in the collection on these items.  We have an alerts that alerts us when free space is less than 10 "Free Megabytes".  Again, all is well.

   I now need to modify the alert to report any hosts where "Free Megabytes" is less than 10 AND "% Free Space" is than 20.  (Numbers are just an example).  I trying but haven't gotten it to work.  Here is what I have in my testing...

 

 

sourcetype="Perfmon:Free Disk Space" instance!=_Total counter="% Free Space" Value<20 [ search host=* sourcetype="Perfmon:Free Disk Space" instance!=_Total counter="Free Megabytes" Value<10000 | return host ] | table host, instance, Value

 

 

 

Two concerns..

1.  I need to look at all hosts all drives but not _Total (which combines)

2.  I need to alert only if "Free Megabytes" < 10 and "% Free Space" <20

 

Any help would be appreciated.

Labels (1)
0 Karma
1 Solution

jmo1
Path Finder

Answering my own question..

  In order to get it to return all hits, you need to supply a count.  So rather than

return host

 

I need to add a 'count'.  I used 1000 as a safe number, it doesn't appear to matter if you don't have 1000 items, so guess big.

return 1000 host

 

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

What does "haven't gotten it to work" mean?  Do you get errors?  If you get no results, have you confirmed there should be results?

At first glance, the query looks like it should work so you should verify you have data that meet the search criteria.

BTW, including an index name in the query will help improve performance.

---
If this reply helps you, Karma would be appreciated.
0 Karma

jmo1
Path Finder
Spoiler
Thanks for the response. I think part of my logic is sound, but if I run the following...

sourcetype="Perfmon:Free Disk Space" instance!=_Total counter="% Free Space" Value>0 [ search host=* sourcetype="Perfmon:Free Disk Space" instance!=_Total counter="Free Megabytes" Value>0 | return host ] | table host, instance, Value​


Which says basically, return all hosts/drives where Free Megabytes > 0 and % Free Space >0, which should return everything.  I get the return from a single host.

How do I get it to iterate through all of the hosts?  

And thanks for the index suggestion.

0 Karma

jmo1
Path Finder

Answering my own question..

  In order to get it to return all hits, you need to supply a count.  So rather than

return host

 

I need to add a 'count'.  I used 1000 as a safe number, it doesn't appear to matter if you don't have 1000 items, so guess big.

return 1000 host

 

0 Karma
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...