-
Notifications
You must be signed in to change notification settings - Fork 138
Populating GSX information
Once you've configured the GSX module, you'll probably want to recheck all of your existing warranty data against Apple's API. For an individual machine, that's easy - just go to Clients > Computer Name > Show (menu in the upper-left corner) > GSX > Recheck Warranty Status. For an entire fleet, that's a fair amount of work. Let's automate this.
First, open MunkiReport, then click Listings > GSX. In the upper-left corner of the page, click the pop-up menu, then click All to display all of your Macs. In the upper-right corner of the page, click CSV. Select everything on the page, copy it to the clipboard, and paste it into a new document in your favorite text editor (TextWrangler is free, just don't use TextEdit). Save it to your Desktop as all-macs.csv
.
Next, we'll want to trim this down to just serial numbers. Open the Terminal, then paste this:
cd ~/Desktop && awk -F "\"*,\"*" '{print $2}' all-macs.csv > serials.txt
Hit enter, and you should see a new text file appear on the desktop, called serials.txt
. Open that up in your text editor, and delete the first line (called Serial Number). Save and close.
Now, make a new document in your text editor, and call it gsx_lookup_all.sh
, also saving it to your Desktop. Paste this:
#!/bin/bash
MR_BASE_URL='https://yourmunkireportserver/index.php?'
MR_LOGIN='datauser'
MR_PASSWORD='secretpassword'
COOKIE_JAR=$(curl -s --cookie-jar - --data "login=${MR_LOGIN}&password=${MR_PASSWORD}" ${MR_BASE_URL}/auth/login)
SESSION_COOKIE=$(echo $COOKIE_JAR | sed 's/.*PHPSESSID /PHPSESSID=/')
while read serial
do
curl -s --cookie "$SESSION_COOKIE" ${MR_BASE_URL}/module/gsx/recheck_gsx/"$serial" >> gsx_lookup.log
done < serials.txt
exit 0
Be sure to edit MR_BASE_URL
, MR_LOGIN
, and MR_PASSWORD
for your server information.
Open the Terminal, then paste the following:
chmod +x ~/Desktop/gsx_lookup_all.sh
Hit enter to make the script executable. Then, finally, run the script:
~/Desktop/gsx_lookup_all.sh
Although it won't output anything to the Terminal, you can follow along in the log file, gsx_lookup.log
.
After it's all done, you'll want to go back to MunkiReport > Listings > GSX and manually Recheck Warranty Status for any Macs that had errors.
- General Upgrade Procedures
- How to Upgrade Versions
- Troubleshooting Upgrades
- Migrating sqlite to MySQL