Closed ludolhoir closed 1 year ago
my version is python jamf2snipe --version 1.0.3
It's not getting a valid response from the snipe instance. You'll need to run this in debug and post whatever the payload coming back from your snipe-it instance is.
Just going to point out that your instance (which you said was production) is running off your local laptop on port 8000 (at least per your settings conf) . But you didn't mention running the insecure flag which it might need.
no i just test it on local snipe before production, please find below in debug mode
python jamf2snipe -d
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): 127.0.0.1:8000
DEBUG:urllib3.connectionpool:http://127.0.0.1:8000 "GET /api/v1/hardware/byserial/C02FD57WQ6L7 HTTP/1.1" 200 None
Traceback (most recent call last):
File "/Users/ludoviclhoir/Desktop/jamf2snipe-main/jamf2snipe", line 786, in
thanks by advance for your help
@ludolhoir I edited because you had some sensitive details exposed there in your post. You might want to rotate some passwords.
Anyways...
If you use postman or curl or rested against your local endpoint, what's the payload that's returned?
GET http://127.0.0.1:8000/api/v1/hardware/byserial/C02FD57WQ6L7
My SSL comment was because of :
INFO:root:SSL Verification is set to: True but you're running http (there's no https) in your conf.
Lastly, check the Snipe-IT setup and make sure that serials are required to be unique. If you have more than 1 entry for that serial number it'll be broke.
well sorry thought i starred all sensitive data
regarding the GET in fact there is no asset at all on my snipe instance, the aim is to get all of them from jamf pro, I am sorry I guess I was not clear enough, we have one Jamf Pro instance with all company Apple devices, and one hosted SnipeIT instance where we add/update all devices manually. So I installed a local snipeIT on my Macbook to test the import from Jamf first before of course testing inn our real instance.
anyway thanks a lot for your help
If your local instance is empty, that's fine, but I'd like to see response from snipe for that call, because that's what's failing.
there is no error on server side, even activated debug mode, but when I do the call on log side I have nothing
[Tue Apr 4 18:03:51 2023] 127.0.0.1:62514 Accepted [Tue Apr 4 18:03:51 2023] 127.0.0.1:62514 Closing [Tue Apr 4 18:03:51 2023] 127.0.0.1:62516 Accepted [Tue Apr 4 18:03:51 2023] 127.0.0.1:62516 Closing [Tue Apr 4 18:03:51 2023] 127.0.0.1:62520 Accepted [Tue Apr 4 18:03:51 2023] 127.0.0.1:62520 Closing
its a bit crazy as snipe works perfectly, anyway was surprised as it is using laravel
yeah, but if you use curl or something, what's the response that the server gives the agent?
when i try curl http://127.0.0.1:8000/api/v1/hardware/byserial/C02FD57WQ6L7
<!DOCTYPE html>
Looks like the latest version of snipe changed the schema:
So this:
curl --request GET \
--url 'https://develop.snipeitapp.com/api/v1/hardware/byserial/C02FD57WQ6L7?deleted=true' \
--header 'accept: application/json'
now gives you this:
{
"status": "error",
"messages": "Asset does not exist.",
"payload": null
}
This might actually be a bug. I'll have to go back and look at the function. (Or someone from Snipe-IT will)
ha ok, so sorry for that, at least made you understand, thanks a lot for your time spent, really appreciate, I will then wait for the update
Before we get too far, I noticed that you're not using the latest version version = "1.0.4"
Would you mind download the latest and testing (it'll probably be the same) because I don't remember what got fixed in that last minor version.
ok doing it now
it works ! So i feel so sorry to have bothered you, now it imports well, I still have warnings on models but all is well ceated and imported. So you 1.0.4 fixed this issue.
thanks again
Glad it's working!
yes just don't have all the assets, and have :root:Snipe-IT responded with error code:{"status":"error","messages":"Too many requests","payload":null} when we tried to look up but I guess there should be a trick
We haven't changed the schema - can you reproduce the problem on the API explorer?
I still have warnings on models
You shouldn't? What are the warnings?
We haven't changed the schema - can you reproduce the problem on the API explorer?
I ... might have pulled that out of my butt or used the wrong term or it might have been that it started to error properly at one point and it was already fixed in the last version. 😅 Or my memory is just awful. My bad either way.
You shouldn't? What are the warnings?
I could be wrong, but I think it throws a little warning or info message that models are missing before it creates new ones (it disappears after the first run because they exist after that)
Hello, we have a production instance of SnipeIT, and I wanted to test your script to update it from our Jamf Pro, so I installed it on my Macbook, and it works. But i can't make your script work. please find below the error and then my settings.conf
INFO:root:Searching for a valid settings.conf file. INFO:root:Great, we found a settings file. Let's get started by parsing all of the settings. INFO:root:Setting the Jamf Pro Base url. INFO:root:Setting the username to request an api key. INFO:root:Setting the password to request an api key. INFO:root:Setting the base URL for SnipeIT. INFO:root:Setting the API key for SnipeIT. INFO:root:Setting the default status for SnipeIT assets. INFO:root:Setting the Snipe ID for Apple Manufacturer devices. INFO:root:Found subset general: Acceptable INFO:root:Found subset general: Acceptable INFO:root:Found subset hardware: Acceptable INFO:root:Creating the headers we'll need for API calls INFO:root:SSL Verification is set to: True INFO:root:Running tests to see if hosts are up. INFO:root:We were able to get a good response from your Snipe-IT instance. INFO:root:We were able to get a good response from your JAMFPro instance. INFO:root:Requesting a new token at 1680618276.4381702. INFO:root:Setting new jamf headers with bearer token INFO:root:Finished running our tests. INFO:root:Getting a list of computer models that snipe knows about. INFO:root:Got a valid response that should have 2 models. INFO:root:Our list of models has 2 entries. INFO:root:Received a list of JAMF assets that had 189 entries. INFO:root:Starting to Update Inventory INFO:root:Processing entry 1 out of 189 - JAMFID: 5 - NAME: test1-C02FD57WQ6L7 Traceback (most recent call last): File "/Users/ludoviclhoir/Desktop/jamf2snipe-main/jamf2snipe", line 786, in
snipe = search_snipe_asset(jamf['general']['serial_number'])
File "/Users/ludoviclhoir/Desktop/jamf2snipe-main/jamf2snipe", line 447, in search_snipe_asset
if jsonresponse['total'] == 1:
KeyError: 'total'
This entire section is Required
url = OUR_INSTANCE.jamfcloud.com username = MY_MAIL password = MY_PASS
[snipe-it]
Required
url = http://127.0.0.1:8000 apikey = MY_KEY manufacturer_id = 1 defaultStatus = 2 computer_model_category_id = 2 mobile_model_category_id = 3
Not Required, uncomment to use
computer_custom_fieldset_id = 3
mobile_custom_fieldset_id = 4
asset_tag = general serial_number # If not specified, defaults to jamf-{id} or jamf-m-{id}
[computers-api-mapping] name = general name _snipeit_mac_address_1 = general mac_address _snipeit_os_version_1 = hardware os_version
[mobile_devices-api-mapping] _snipeit_imei_4 = network imei name = general name
[user-mapping] # The field from jamf that you want to search Snipe with jamf_api_field = location username