Posted on 01-07-2015 09:45 AM
Here's the issue.. we have a ton of reporting being done that is based off of the two fields 'Last Inventory Update' and 'Last Check-in' being actual date/times. The fact that they say things like 'Yesterday, just a minute ago, Today at...' etc, is a show stopper for what we're doing. I don't want to have to instruct my reporting team to write new formulas that can take 'about a minute ago' from info that was exported from my JSS and turn it into a meaningful date. That seems to me as a band-aid, because who knows what other sayings may appear there in the future?
Does anyone know of a way to tweak that to have it return an actual date/time instead of the cutesie 'about a minute ago' type thing? I've looked through 'Inventory Collection' and 'Computer Inventory Display' under 'Computer Management and couldn't find anything there. I'm sure I could write an EA to accomplish this, but again that seems like a workaround for something that should just be there to start with.
Honestly this is one of those things that makes the JSS feel a bit less like a robust enterprise solution, and more like a 'mom and pop' type tool.
Thanks in advance
Bill
Posted on 01-07-2015 10:50 AM
The data "is" there in the database. The web app simply interprets it for you in a more user friendly way.
You could query the database directly, or use API.
Here is an example of how you could use API --
#!/bin/bash
#############################################
########### Edit this stuff ################
#############################################
# Edit this list as needed
# Spaces in the name must be replaced with "%20"
# Each line in list must end with a space and a ""
computerList="
computer1-example
computer%202-example-with%20space
"
jssURL=https://myserver.mydomain.suffix:8443
outputFile=$(/usr/bin/dirname $0)/jssComputers.csv
############################################# #############################################
# Authenticate
read -p "Please enter your JSS user account: " jssUser
read -p "Please enter your JSS user password: " -s jssPassword
echo ""
# Initialize output file
echo "Computer Name,Last Inventory,Last Contact" > $outputFile
# MAIN
for computer in $computerList
do
response=$(curl $jssURL/JSSResource/computers/name/$computer --user "$jssUser:$jssPassword")
computerName=$(echo $response | xpath '//computer/general/name' 2>&1 | awk -F'<name>|</name>' '{print $2}')
computerReportDate=$(echo $response | xpath '//computer/general/report_date' 2>&1 | awk -F'<report_date>|</report_date>' '{print $2}')
computerContactDate=$(echo $response | xpath '//computer/general/last_contact_time' 2>&1 | awk -F'<last_contact_time>|</last_contact_time>' '{print $2}')
echo -e "
-------------------------"
echo $computerName,$computerReportDate,$computerContactDate| tee -a $outputFile
echo -e "-------------------------
"
done
Posted on 01-07-2015 10:55 AM
So what this does is create a CSV output on your desktop with the values you are looking for. (I think)
If you want to pull this for all computers instead of a few that are specified in the script - it probably wouldn't be too hard to rewrite that.
Posted on 01-07-2015 11:13 AM
Or throw an extra vote into this Feature Request: https://jamfnation.jamfsoftware.com/featureRequest.html?id=2705 just for good measure.
Its listed now as Planned, so hopefully sometime soon this will change. I understand this is a matter of personal opinion and needs, but for me, It was frankly, never a good idea to include human friendly date interpretation to those fields. It should be absolute and not relative, or at the very least it should "switch" to absolute date format when running a report.
I've never liked relative date formats even in OS X's Finder back when it was introduced and I still don't care for it. Its often one of the first "features" I turn off in OS X when I get a new Mac.
Posted on 01-07-2015 11:18 AM
@jcompton that's awesome info. I knew the real data was in the DB, though I was hoping to avoid writing a script to pull something out that seemingly should already be in the JSS. So I was hoping there was a check box I was just missing somewhere. Thank you very much!
Posted on 01-07-2015 11:21 AM
@mm2270 We're definitely on the same page. it's fine to make that type of thing an option, though JAMF and other companies need to realizes that to many of us if we can't easily report on it, it doesn't matter if we can technically do it.
That being said, I'll head over and throw my support behind that Feature Request right now. :)
Posted on 01-07-2015 11:44 AM
I voted up too. Just b/c you "can" do it with API, doesn't mean it shouldn't be easier.
Posted on 01-07-2015 11:46 AM
I couldn't possibly agree more, @jcompton