Posted on 03-05-2021 03:36 PM
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.
Posted on 09-10-2021 07:52 AM
I would like to know also..
Posted on 10-20-2021 02:44 PM
I would like this option as well
Posted on 03-09-2022 10:08 AM
me also, any news on this?
Posted on 04-08-2022 09:42 AM
I created a custom Extension Attribute and then used a smart group with the EA as the criteria to monitor this. Hope this helps.
Posted on 04-26-2022 07:05 AM
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!
Posted on 04-26-2022 07:08 AM
#!/bin/sh
used=`df -h /System/Volumes/Data/ | tail -n +2 | awk '{print $5}'`
echo "<result>"$used"</result>"
Posted on 04-26-2022 07:09 AM
#!/bin/sh
used=`df -h /System/Volumes/Data/ | tail -n +2 | awk '{print $5}'`
echo "<result>"$used"</result>"
Posted on 04-26-2022 07:12 AM
I'm still getting zero. Am I doing something else wrong here?
Posted on 04-26-2022 07:18 AM
Don't forget it is an Extension, not a script... also I used String and not integer in my setup as shown here:
Posted on 04-26-2022 07:22 AM
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!
Posted on 04-26-2022 07:28 AM
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.
Posted on 04-26-2022 07:37 AM
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?
Posted on 04-26-2022 09:21 AM
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.
Posted on 04-26-2022 09:34 AM
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.
Posted on 04-26-2022 10:00 AM
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.
Posted on 11-30-2022 02:25 PM
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.
03-15-2023 04:41 AM - edited 03-15-2023 04:43 AM
Based on the previous code (thanx to everyone) we created an EA showing the actual free GBs
#!/bin/sh
cap=`df -h /System/Volumes/Data/ | tail -n +2 | awk '{print $4}'`
unit=$(echo "$cap" | awk '{print substr($0, length($0)-1, length($0))}')
mod_cap=$(echo "$cap" | awk '{print substr($0, 1, length($0)-2)}')
if [ "$unit" == "Ti" ]
then
mod_cap=$(echo "1000 * $mod_cap" | bc)
fi
echo "<result>"$mod_cap"</result>"
11-14-2023 03:57 PM - edited 11-14-2023 04:02 PM
@michaelhusar sadly this doesn't work as expected when free space is below 1GB, as you then start seeing larger numbers because it doesn't handle MB. =/ Not sure if just adding:
if [ "$unit" == "Mi" ]
then
mod_cap=$(echo "$mod_cap / 1000" | bc)
fi
Would resolve...
Yes, altered to:
#!/bin/sh
cap=$(df -h /System/Volumes/Data/ | tail -n +2 | awk '{print $4}')
unit=$(echo "$cap" | awk '{print substr($0, length($0)-1, length($0))}')
mod_cap=$(echo "$cap" | awk '{print substr($0, 1, length($0)-2)}')
if [ "$unit" == "Ti" ]
then
mod_cap=$(echo "1000 * $mod_cap" | bc)
fi
if [ "$unit" == "Mi" ]
then
mod_cap=$(echo "scale=2; $mod_cap / 1000" | bc)
fi
echo "<result>"$mod_cap"</result>"