Monitoring Splunk

How do you create an alert for disk usage?

maryamchar
Explorer

Hello,
Is there a way to have a query in a dashboard that sends me notification when the storage space reaches a certain amount such as 70 % of storage used?

I know there is a way in the setting to enable that by going to Monitor console and alert setup -> DMC alert -> near critical disk usage. But i want to have a query instead in a dashboard that sends me an alarm too.

I'm using Splunk Enterprise search and reporting.

Thank you in advance!

Tags (1)
0 Karma

twh1
Communicator

Hi @maryamchar ,
You can use the below query to set-up the alert.

index=foo "search string"  | where stoarge_field > 70
0 Karma

maryamchar
Explorer

Thank you! It didn't work for me even when i changed the % from 70 to 20

0 Karma

skoelpin
SplunkTrust
SplunkTrust

If you want the alert then why not just grab the SPL from the DMC and create an alert off it?

0 Karma

maryamchar
Explorer

Because that's part of setting it didn't show me the SPL. So i'm trying to write an SPL like the DMC and create alert. Is there any easy other way ?? Thank you!

0 Karma

skoelpin
SplunkTrust
SplunkTrust

Here ya go. You just need to include your host value

(index=_introspection sourcetype=splunk_disk_objects component=Partitions "data.mount_point"="/opt/splunk" host=<YOUR HOST> ) 
| eval free=if(isnotnull('data.available'),'data.available','data.free'), usage=round((('data.capacity' - free) / 1024),2), capacity=round(('data.capacity' / 1024),2) 
| timechart minspan=10min latest(capacity) as Capacity Median(usage) as Usage
0 Karma

maryamchar
Explorer

Thank you! it did not show any results 😞 is there another way to check ?

0 Karma

skoelpin
SplunkTrust
SplunkTrust

Did you change host=<YOUR HOST> to your host value?

It works on my end when I change it to a host in my env

0 Karma

maryamchar
Explorer

Yes i did change it to my host and still didn't give me any results. Thank you for help

0 Karma

avoelk
Communicator

this is an old topic but, for everyone who is searching for this, there are two possible reasons why this search doesn't function:

- difference in mount_point

- forgot to put in a host value

 

for me it was both. it works

0 Karma

skoelpin
SplunkTrust
SplunkTrust

Post your query...

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...