Splunk Search

how to edit my search to set an alert when disk usage is 60% and above?

vijaykumartcs
Explorer

There are c/d/e/f/p disk in servers, i want to set alert for the servers whose drive utilization is 60% and above..

i'm using

index=xyz sourcetype=abc host= OR host= disk=* | stats avg(diskused) as DiskUsage by host |where Diskusage > 60

but in result its not showing the disk,...
its giving
host and Diskusage info..

i need "host" "Disk(c:/D:/E:/F:/P:)" and Diskusage information in stats..

please help..

0 Karma
1 Solution

Richfez
SplunkTrust
SplunkTrust

You need to add "disk" into your search too.

index=xyz sourcetype=abc host= OR host= disk=* | stats avg(diskused) as DiskUsage by host, disk |where Diskusage > 60

Give that a try and see if it's better. T

Though do you want the avg() of how much is used or the max() that was used? You could also check into latest() to get the latest value of it. There are lots of stats functions available.

View solution in original post

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi vijaykumartcs,
have you seen Splunk Distributed Monitoring Console?
in the default alerts there is the "DMC Alert - Near Critical Disk Usage" that probably can guide you to solve your problem, something like this:

index=xyz sourcetype=abc host= OR host= disk=*
| eval free = if(isnotnull(available), available, free) 
| eval usage = capacity - free 
| eval pct_usage = floor(usage / capacity * 100) 
| where pct_usage > 60 
| stats first(fs_type) as fs_type first(capacity) AS capacity first(usage) AS usage first(pct_usage) AS pct_usage by splunk_server, mount_point 
| eval usage = round(usage / 1024, 2) 
| eval capacity = round(capacity / 1024, 2) 
| rename splunk_server AS Instance mount_point as "Mount Point", fs_type as "File System Type", usage as "Usage (GB)", capacity as "Capacity (GB)", pct_usage as "Usage (%)"

Bye.
Giuseppe

0 Karma

Richfez
SplunkTrust
SplunkTrust

You need to add "disk" into your search too.

index=xyz sourcetype=abc host= OR host= disk=* | stats avg(diskused) as DiskUsage by host, disk |where Diskusage > 60

Give that a try and see if it's better. T

Though do you want the avg() of how much is used or the max() that was used? You could also check into latest() to get the latest value of it. There are lots of stats functions available.

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...