JAMF Integration

Tony Cattoi
Mega Guru

Has anyone used the official JAMF Integration that is available in the ServiceNow store? Any reviews or thoughts?

13 REPLIES 13

Community Alums
Not applicable

@Rick Mann can you please let me know if you have any documentation for your basic REST integration with JAMF to import Mac workstations into ServiceNow? I do not want to use the ServiceNow graph connector. Please do let me know. 

 

Thanks, 

Ravi

This is probably an old school way of doing this because I set it up several years ago.

I setup a GET REST method to access a JAMF report URL that was created by our JAMF admin.  The script below will call that method and parse the JSON payload and insert records into a web service table that you can run a transform against.

I run the script below as a scheduled job once per day.

try {
	var r = new sn_ws.RESTMessageV2('Casper', 'get');
	r.setHttpTimeout(10000);
	r.setEccParameter('skip_sensor', true);
	var response = r.execute();
	var responseBody = response.getBody();
	var httpStatus = response.getStatusCode();
	//gs.print("Step 1 " + responseBody);
	
	var jsonString = response.getBody();
	var parser = new JSONParser();
	var parsed = parser.parse(jsonString);
	
	for (i = 0; i < parsed.computer_reports.length; i++) {
		var name = parsed.computer_reports[i].Computer_Name;
		var model = parsed.computer_reports[i].Model;
		var serial_number = parsed.computer_reports[i].Serial_Number;
		var operating_system = parsed.computer_reports[i].Operating_System;
		//var assignee = parsed.computer_reports[i].Full_Name;
		var assignee = parsed.computer_reports[i].Username;
		var ip = parsed.computer_reports[i].IP_Address;
		var ram = parsed.computer_reports[i].Total_RAM_MB;
		var n_procs = parsed.computer_reports[i].Number_of_Processors;
		var proc_sp = parsed.computer_reports[i].Processor_Speed_MHz;
		var last_check_in = parsed.computer_reports[i].Last_Check_in;
		var model_id = parsed.computer_reports[i].Model_Identifier;
		
		var rec = new GlideRecord('u_casper_web_service');
		rec.initialize();
		rec.name = name;
		rec.model_number = model;
		rec.serial_number = serial_number;
		rec.os_version = operating_system;
		rec.assigned_to = assignee;
		rec.ip_address = ip;
		rec.ram = ram;
		rec.cpu_count = n_procs;
		rec.cpu_speed = proc_sp;
		rec.last_discovered = last_check_in;
		rec.model_id = model_id;
		rec.insert();
	}
}
catch(ex) {
	var message = ex.getMessage();
}

Community Alums
Not applicable

Thank you Rick, but we do not have discovery to use the JAMF connector. So I had to go old school way. 

Tony Cattoi
Mega Guru

Hi Rick,

We had already setup something like Scott for our load of data into ServiceNow prior to us asking the question about it.  

 

You can integrate ServiceNow to do what you are asking in the same sort of format that is described in the image on Scott's post for the load of data into ServiceNow.  You can use the REST capabilities of both systems to send the details needed to add something to a collection in JAMF.  You will just need to make sure that the message from ServiceNow is in the correct format and has the correct permissions to do what you are wanting to do from ServiceNow.

 

Not sure how much that helps but hopefully it gets you started.
Thanks,
Tony