Closed jarrodCoombes closed 4 years ago
I think most of this section should be passing messages in debug mode.
You should see either: "DEBUG:The payload for the snipe update is:" or "DEBUG:Skipping the payload, because it already exits." or "DEBUG:Skipping the payload, because it already exists, or the Snipe key we're mapping to doesn't." or "DEBUG: Found the field, and the value needs to be updated from {} to {}"
I don't see any of these in the log snipits you posted. Can you try searching for them and paste the relevent bits when you run it with jamf2snipe -d
?
None of that shows up at all for the asset records. I was actively looking for some indication of it attempting to update in Snipe. What I pasted is a complete start to finish for each identified asset, all 14 of them have the exact same lines.
That said, I will give it another go and report back.
Bizarrely I just ran it, and it actually did pull and sync the data, but only for 2 out of the 14 macbooks I am working with.
The word "payload" does not appear in the debug output at all.
Here is the complete output, sanitised. There are now 15 computers as we enrolled another this morning. The new one was created in Snipe, but like the others, none of the fields are being updated.
$ ./jamf2snipe -c -d
INFO:root:Searching for a valid settings.conf file.
DEBUG:root:Checking for a settings.conf in /opt/jamf2snipe ...
INFO:root:Great, we found a settings file. Let's get started by parsing all fo the settings.
INFO:root:The configured JAMFPro base url is: https://
INFO:root:Starting to Update Inventory
INFO:root:Processing entry 1 out of 15 - JAMFID: 6 - NAME:
INFO:root:Processing entry 2 out of 15 - JAMFID: 15 - NAME:
INFO:root:Processing entry 3 out of 15 - JAMFID: 16 - NAME:
INFO:root:Processing entry 4 out of 15 - JAMFID: 17 - NAME:
INFO:root:Processing entry 5 out of 15 - JAMFID: 21 - NAME:
INFO:root:Processing entry 6 out of 15 - JAMFID: 23 - NAME:
INFO:root:Processing entry 7 out of 15 - JAMFID: 26 - NAME:
INFO:root:Processing entry 8 out of 15 - JAMFID: 27 - NAME:
INFO:root:Processing entry 9 out of 15 - JAMFID: 28 - NAME:
INFO:root:Processing entry 10 out of 15 - JAMFID: 30 - NAME:
INFO:root:Processing entry 11 out of 15 - JAMFID: 31 - NAME:
INFO:root:Processing entry 12 out of 15 - JAMFID: 32 - NAME:
INFO:root:Processing entry 13 out of 15 - JAMFID: 33 - NAME:
INFO:root:Processing entry 14 out of 15 - JAMFID: 34 - NAME:
INFO:root:Processing entry 15 out of 15 - JAMFID: 35 - NAME:
$ _
From this line you should have also had some addtional text in your output that I'm not seeing here either. Does that line exist in your local copy?
Yes, it is in there, same line number and everything. I downloaded the script by just curling: https://raw.githubusercontent.com/ParadoxGuitarist/jamf2snipe/34b740d1178d855111b1f88fa814407f7e04ad9d/jamf2snipe
So i am 99.9999% sure I have the right script and version.
I also just checked, the Jamf server and Snipe server both have the same local time, not sure if that is relevant, but since that line deals with time stamps I figured it was worth checking.
Hang on a second. Reading this code, that section compares the update time in Jamf to the update time in Snipe, and if you have a device that has not checked in for some time with Jamf, then that date will almost certainly be older than the update date in Snipe if you are adding the asset way after it was deployed.
So I ran the script for the first time on say April 20th, but the last time the computer checked in and update was say April 10th, then it will always fail that check, since April 10 is older than April 20th.
Have I got that right?
This could explain why I now have three random devices that have those fields imported.
Got it. If I force an inventory update on the computer, it changes the last inventory date in the JSS, which is then newer than the modified date in Snipe, and therefore it pulls and syncs the data.
I would suggest a few things around this, and I will submit them as feature requests:
INFO:root:Jamf check in date is older than Snipe modification date so there is nothing to sync, force an inventory update to rectify if this is incorrect
or something like that.
I am running:
jamf2snipe -c
Initial run works perfectly, created all the records with the right category, manufacturer, fieldsets etc.
Subsequent runs do not update the records with the info specified in the settings.conf file. There are no errors given. The account that was used to create the API token has been confirmed as able to edit any of the assets.
Debug output of from one item from Jamf:
INFO:root:Processing entry 14 out of 14 - JAMFID: 34 - NAME: <ComputerName> DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): <JSS URL> DEBUG:urllib3.connectionpool:https://<JSS UR>:8443 "GET /JSSResource/computers/id/34 HTTP/1.1" 200 26860 DEBUG:root:Got back a valid 200 response code. DEBUG:root:Returning: <snip - All JAMF info, looks correct> DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): <SNIPE-IT URL> DEBUG:urllib3.connectionpool:https://<SNIPE-IT URL>:443 "GET /api/v1/hardware/byserial/<Mac Serial Number> HTTP/1.1" 200 1469
Computer settings in the settings.conf file:
[computers-api-mapping] name = general name _snipeit_mac_address_1 = general mac_address _snipeit_os_version_6 = hardware os_version _snipeit_cpu_8 = hardware processor_type _snipeit_ram_9 = hardware total_ram
Checked and double checked, the custom field IDs are correct as well as the JSS side of things is also correct.
Running it on an Ubuntu 18.04 server (the snipe-it server) with Python 3.6