Disk Usage Smart Groups

robertliebsch
Contributor

With the changes to macOS in the last two versions. I'm wondering how people are monitoring disk utilization.

The Smart Group offering of Criteria "Boot Drive Percentage Full" isn't giving real results.

I show only 3 folks with over 67% full.

However, if I go to a computers: pick a machine and check its storage I see Data 250.68 GB 75% 58.46 GB Encrypted No

Is there a way to change from Boot to Data so I can figure out who is in peril of having a computer seize due to a full disk? or a system update that is going to fail? or a BigSur upgrade that is going to tank?

Right now I feel like without using another app like Kolide (osquery) I have no idea the health of my fleet.

16 REPLIES 16

DMH2000
New Contributor III

I would like to know also..

TAMU_MarComm
New Contributor

I would like this option as well

ccsshelpdesk
New Contributor III

me also, any news on this?

Kivo
New Contributor II

I created a custom Extension Attribute and then used a smart group with the EA as the criteria to monitor this. Hope this helps. Data_Drive___Used___and_dovik_—_-zsh_—_117×40_and_Notes.pngData_Drive___85__Full__.png

Would you be able to copy and paste that here? I don't know if I'm typing it wrong or what, but it doesn't seem to be working for me.

 

Thanks so much!

DMH2000
New Contributor III

#!/bin/sh

used=`df -h /System/Volumes/Data/ | tail -n +2 | awk '{print $5}'`
echo "<result>"$used"</result>"

DMH2000
New Contributor III

#!/bin/sh

used=`df -h /System/Volumes/Data/ | tail -n +2 | awk '{print $5}'`
echo "<result>"$used"</result>"

I'm still getting zero. Am I doing something else wrong here?

Screen Shot 2022-04-26 at 9.11.07 AM.pngScreen Shot 2022-04-26 at 9.11.28 AM.png

DMH2000
New Contributor III

Don't forget it is an Extension, not a script... also I used String and not integer in my setup as shown here:2022-04-26_10-15-13.png

I do believe I changed everything to the way you have it and it still doesn't seem to work. Please let me know if I'm just blind and not seeing it!

Screen Shot 2022-04-26 at 9.21.15 AM.png

DMH2000
New Contributor III

Look under the computer's Inventory, Hardware. At the bottom you should see Extension Attributes, Data Disk Used.

You can also add a column for All Computers Search to show all computers at once.

I added the column and it is empty. I also went back into the criteria for the smart group and it changed from "less than" or "more than" to "is". How would I get it back to the less and more than?Screen Shot 2022-04-26 at 9.36.59 AM.png

Screen Shot 2022-04-26 at 9.34.50 AM.png

Kivo
New Contributor II

If you changed the data type in the Extension Attribute to string from integer that changes how you can interact with it in the smart group, that is why you now have "is" instead of the "less than" and "more than". 

I see that DMH2000 has set their extension attribute a bit differently then mine. If you would like to try mine out I have pasted it here:

#!/bin/sh

free=`df -m /System/Volumes/Data | awk '{getline; print $5}'| sed 's/%//'`

echo "<result>"${free}"</result>"

Additionally, Im not sure why you have the "less than" 80 in your smart group. I may just not understand what your aim for the smart group is but just setting the "more than" to 49 would be sufficient in showing the data drive being over full. I would suggest just for testing reasons set it up the same why that I have mine to see if it works then add additional criteria to the smart group. 

If you have any question about this please let me know, hope this is helpful for you. 

 

The reason I have that is that I also have a smart group that is "Over 80% Capacity". We use that one for a couple of other specific things that need our attention.

 

I now updated this with your parameters and it is still coming back as zero.

Kivo
New Contributor II

You could test out the command in your terminal and change the smart group to reflect the output. So if you run the command and it says "17" then change the smart group to if "more than" 16. May be a good way to see if it's working.

dovik_—_-zsh_—_127×38.png

I had this same issue. 
I was able to get the used percentage "67%" to display under the Hardware inventory of the laptop but the Smart Group was not populating. 

In my case, I had to drop the "%" from the script output since the Extension attribute is configured as an integer (number WITHOUT the % sign). 

I modified the script DMH2000  provided to the below.

 

#!/bin/sh

used=`df -h /System/Volumes/Data/ | tail -n +2 | awk '{print $5}' | cut -c 1-2`
echo "<result>"$used"</result>"

 

This is not perfect but works for me. 
If the drive gets to 100% then it will be detected as 10 but then again we would have bigger problems.