Posted on 03-03-2018 07:44 AM
I am trying to create a smart group that will show me Macs that have been booted for more than 7 days. Many times, my team gets support tickets from users that would not have been necessary if they had rebooted their Macs at least once a week. I love that Macs can stay booted for a really long time. My record is 92 days, but to get there, I had to put up with some quirks and minor issues. I just wanted to see how long I could go between reboots. I don't want my users doing this, so I want to create a smart group for Macs that are booted up longer than 7 days, and then display a message asking them to please reboot soon. I have found extension attributes that will show me the up time, or last reboot, but when I go to create the smart group, the operator shows only is, is not, like, and not like. What I need it to show is something like "more than X days ago". Does anyone know how I get this? Maybe I'm using the wrong extension attributes?
Solved! Go to Solution.
Posted on 03-03-2018 04:44 PM
When adding the Extension Attribute, be sure to set the Data Type drop down menu to "Integer" instead of "String. Jamf Pro supports evaluating more than and less than tests with integers and dates.
This lets you choose "more than" or "less than" in your Smart Group.
For completeness, here's my EA script for uptime:
#!/bin/sh
dayCount=$( uptime | awk -F "(up | days)" '{ print $2 }' )
if ! [ "$dayCount" -eq "$dayCount" ] 2> /dev/null ; then
dayCount="0"
fi
echo "<result>$dayCount</result>"
exit 0
Posted on 03-03-2018 04:44 PM
When adding the Extension Attribute, be sure to set the Data Type drop down menu to "Integer" instead of "String. Jamf Pro supports evaluating more than and less than tests with integers and dates.
This lets you choose "more than" or "less than" in your Smart Group.
For completeness, here's my EA script for uptime:
#!/bin/sh
dayCount=$( uptime | awk -F "(up | days)" '{ print $2 }' )
if ! [ "$dayCount" -eq "$dayCount" ] 2> /dev/null ; then
dayCount="0"
fi
echo "<result>$dayCount</result>"
exit 0
Posted on 04-20-2024 03:08 PM
Hi William, I found your information online and I saw on the Jamf community platform how you share great solutions to people. I am reaching out to you because I just failed my Jamf 200 TEST and I can remembers some questions which made me fail the test, and I was wondering if you are available for a paid 1-2hrs session to just go over the questions with you, hopefully you virtual instances of JAMF for practical purpose, please let me know if this is possible, I really appreciate !
My email: Born2rebuild@gmail.com I look forward to hearing back from you either on here or via my email, thanks again
Posted on 03-03-2018 06:39 PM
Thanks @talkingmoose ! I totally forgot about that. I need to work with extension attributes more.