grokability / jamf2snipe

Import and sync assets from a JAMFPro instance to Snipe-IT asset management.
MIT License
113 stars 55 forks source link

Converting megabytes to gigabytes #79

Open kryptonit1 opened 2 years ago

kryptonit1 commented 2 years ago

It would be be nice if it was possible to automatically convert megabytes to gigabytes when collecting for example total_ram_mb or drive_capacity_mb from Jamf.

Found this on the MacAdmins Slack, but it does not seem to have been added to jamf2snipe: https://macadmins.slack.com/archives/C81NQH7HC/p1566485883193100

snipe commented 2 years ago

Unfortunately, we don't have access to the MacAdmins slack :(

kryptonit1 commented 2 years ago

My colleague made some edits to allow for more flexibility and unit conversion in the API mapping.

We can now parse through hardware > storage to grab total_ram_mb and drive_capacity_mb then / 1024 for GB like so:

[api-mapping] name = general name _snipeit_mac_address_1 = general mac_address notes = location username _snipeit_ram_2 = hardware total_ram_mb / 1024 _snipeit_hdd_3 = hardware storage drive_capacity_mb / 1024

  • multiplication also works
uberbrady commented 1 year ago

Unfortunately, this feature isn't actually in-place, so I've had to back out the change to show the new syntax in the settings file. I'm working on re-integrating it, however. Unfortunately the version of jamf2snipe that it's based on is pretty ancient, so it's taking a bit of spelunking.

Once I have the feature re-integrated, I'll make sure to add back in the new / 1024 syntax into the example settings file