Discovery auto populating assigned_to, breaking asset management processes.

smfoister
Giga Expert

Good morning,

 

OOTB Discovery runs and populates the assigned_to field on CI's. This is breaking out hardware asset management process and assigning assets to users erroneously if they sign into a shared machine, or a projection computer, kiosk, etc...

 

I'd like to have Discovery populate a custom field I have created on the CMDB called "u_last_logged_in"

I have found and customized the sensor that identifies computer information with no luck. I have also attempted to change the assigned_to field in the discovery pattern to use u_last_logged_in and I'm just getting a JS error. 

I'd like to hear from the community on how you would do this. I feel like there really should already be a last logged on field OOTB and you should have an option to populate this field, or assigned_to. I don't think assuming the recent user of a machine is the asset / CI owner is a very good practice.

1 ACCEPTED SOLUTION

Its running for both.. Ignore the var windowServer. lol

So doesn't look like anything changed here based on what I shared above. So if you want to map to a new field, need to update pattern with custom field and then updated the two lines below in the post script. 

 

 

Script you need to change the following:

var userName = windowsServer.assigned_to; <-- change "assigned_to" to whatever value you are using in the pattern. 

 

 windowsServer.assigned_to = userID; <-- change "assigned_to" to whatever filed you are using to match above. 

View solution in original post

8 REPLIES 8

Its running for both.. Ignore the var windowServer. lol

So doesn't look like anything changed here based on what I shared above. So if you want to map to a new field, need to update pattern with custom field and then updated the two lines below in the post script. 

 

 

Script you need to change the following:

var userName = windowsServer.assigned_to; <-- change "assigned_to" to whatever value you are using in the pattern. 

 

 windowsServer.assigned_to = userID; <-- change "assigned_to" to whatever filed you are using to match above. 

This did the trick. I'm not sure if the pattern modification was needed, I'm going to experiment with that and go back to OOTB if possible there.

 

Thanks for the help Patrick

I just did some testing and you're right, it is. So for anyone in the future doing this same thing you'll be owning the pre script code and the pattern.

Luckily it's just a couple of edits so if they have some major change to either one of these you can easily use the new version and edit your changes back in.