Posted on 05-31-2018 01:14 PM
Each morning we have our helpdesk guy walking around our office to check 200+ iPads to make sure the ones with low battery are plugged in for charging. This is done manually and is not efficient.
Is there an existing python script that will query all the iPads' battery level? We would like to gather this info and then implement with Nagios to alert the NOC of any iPad batteries that are below a certain threshold (i.e. < 20%). I have no python experience so any help is appreciated. My attempted script is the following but I'm stuck at this point.
import json
import requests
print ("Fetching ipad record from JSS...")
print ("")
response = requests.get('https://myjss.com/JSSResource/mobiledevices', headers={'Accept': 'application/json'}, auth=('user', 'password'))
print (response.json())
"#print ('The current battery level is:' + ['mobile_device']['general']['battery_level'])"
Posted on 05-31-2018 07:05 PM
Have you tried a smart group or even an advanced search? Querying the API could be intensive. Either way the data is only as current as the devices last inventory.