Posted on 02-07-2018 09:16 AM
We are using an API script to get the Site a computer is in. That works fine. When Jamf Pro is working.
What blob of code are you using in your script that exits out if Jamf Pro is not responding.
By "not responding" we don't mean using ping, we mean Jamf Pro is not responding.
healthCheck.html
value doesn't seem to do the trick, since []
shows even if API calls fail.
Basically if API call is successful, populate EA, else leave EA value alone.
Posted on 02-07-2018 09:20 AM
If the API call fails, what data is returned? If it's null, that's easy, just exit out.
I think it comes down to how you are parsing the API response.
Posted on 02-07-2018 09:39 AM
In my experience, simply exiting the EA script does not do the trick. The problem is in how the jamf binary gathers data during an inventory collection. I have some older EAs that I have deprecated but not deleted from my Jamf instance, and what I get is that the value gets blanked out. In the scripts themselves, there is an exit 0
right at the top, but the previous values don't remain, because when the jamf binary uploads it's data collection, it must put something in the value for each EA. If it doesn't get anything, it uploads a blank value, and overwrites what was there before with a null value.
So, I get where this post is going and the problem.
@donmontalvo What I would suggest is rewriting your EA to capture a value and send it to a local file or plist on each run (in addition to echoing it back in the result tags), if it came back with something. Within your EA script, if the JSS isn't responding, grab the value from the file/plist instead and use that within the <result></result>
tags. So that way, if it can't grab an updated string, it uses the previously gotten value stored on disk.
Hope that helps.
Posted on 02-07-2018 10:15 AM
@mm2270 that makes sense. So basically...
Testing...
Posted on 02-07-2018 10:40 AM
Yeah, pretty much. Sounds like you're already writing info into a local file. Maybe it can just pick up that value if it has trouble pulling something via the API.
Taking a step back a moment though, it just occurred to me, in what situation are you seeing a case where the EA script can't connect to your Jamf Pro instance, but it's still running a recon? Or do you have a separate ongoing policy calling a script to get those values? I guess what I'm asking is, if your JSS isn't available, how would EAs even be run in the first place?
Posted on 03-12-2018 01:30 AM
@mm2270 sorry for the late response. This can happen if the computer is in the DMZ (we cripple API).