Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Monitoring Splunk

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- Splunk Answers
- :
- Splunk Administration
- :
- Monitoring Splunk
- :
- How to calculate the free disk capacity in MB?

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

jip31

Contributor

07-18-2018
02:03 AM

hello

I use this code `in order to calculate the free disk space but I also need to know the capacity disk in MB. I am unable to find a counter for this. The value has to be displayed in the "x" variable. Could you help me, please?

```
| join type=outer host [search index="perfmon" sourcetype="perfmon:logicaldisk" instance=c: counter="Free Megabytes" | eval Disk_Available_Space =round(Value, 0). " MBytes /x" ]
```

1 Solution

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

FrankVl

Ultra Champion

07-18-2018
02:11 AM

Doesn't perfmon also have a `% Free Space`

counter that you can use for this?

You can use the combination of those 2 counters to calculate the total space, for example (tune this to exactly what you need)

```
search index="perfmon" sourcetype="perfmon:logicaldisk" instance=c: counter="Free Megabytes" OR counter="% Free Space"
| eval perc_free = if(counter="% Free Space",Value,null)
| eval mb_free = if(counter="Free Megabytes",Value,null)
| stats latest(mb_free) as mb_free latest(perc_free) as perc_free by instance,host
| eval total_space = mb_free / (perc_free) * 100
```

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Re: How to calculate the free disk capacity in MB?

jip31

Contributor

07-18-2018
02:21 AM

% Free Space dont give me directly the total space...

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Re: How to calculate the free disk capacity in MB?

FrankVl

Ultra Champion

07-18-2018
03:00 AM

See my updated answer for how you can combine the 2 counters to calculate that.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Re: How to calculate the free disk capacity in MB?

jip31

Contributor

07-18-2018
04:30 AM

Perfect thanks

last question i want mb free band total space in a same field seperated by \

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Re: How to calculate the free disk capacity in MB?

FrankVl

Ultra Champion

07-18-2018
04:37 AM

`.total_space`

to concatenate the total_space field to the string you already generated.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Re: How to calculate the free disk capacity in MB?

jip31

Contributor

07-18-2018
04:55 AM

yes but i done this and it dont works

```
eval Disk_Available_Space =round(Value, 0). " MBytes /.total_space" | table Disk_Available_Space
```

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Re: How to calculate the free disk capacity in MB?

FrankVl

Ultra Champion

07-18-2018
05:00 AM

You need to take that part outside of the quotes.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Re: How to calculate the free disk capacity in MB?

jip31

Contributor

07-18-2018
05:26 AM

sorry but i dont succeed

in my field i Something like this :`mb*free "MB" / total*space "MB"

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Re: How to calculate the free disk capacity in MB?

FrankVl

Ultra Champion

07-18-2018
05:35 AM

Can you please stop posting comments as answers. I can convert them to comments, but it is easier if you post them as a comment right away 🙂

Given that the data is in the fields mb*free and total*space. This should work to print it as you want:

```
| eval Disk_Available_Space = round(mb_free,0)."MB / ".round(total_space,0)."MB"
```