How can capture the "last logged in user" UserName or User ID from Discovery for CI

bharath10
Mega Expert

Hello All,

1.How can capture the "last logged in user" UserName or User ID from Discovery for CI. and discovery uses sys_user (user) table to refer and populate match corresponding UserID, and want to capture the discovered login name even it is not in the User table. 

2.i have created custom string field on cmdb_ci_computer table, can i use same field for windows server, linux, etc. server table/form to populate value of "last logged in user". OR i need to create separate filed for each table/form. ( and how can i get value of "last logged in user" from discovery to populate in custom field.

currently using London and in london discovery uses patterns. but am bit confuse where and which pattern need to customized.

i have checked below link and might this solution is given and apply for earlier versions of london - discovery.(probe & sensor)

https://community.servicenow.com/community?id=community_question&sys_id=847ec321dbdcdbc01dcaf3231f96...

@jwelton , @doug.schulze - any suggestion.

Thanks in advance.

 

Bharat

4 REPLIES 4

DaveHertel
Kilo Sage
Kilo Sage

Hi - 

For question 1, you can create a pattern to retrieve this info (assuming you know the command or location on the target to get the user data from).  You'll need a pattern for Windows hosts, another for linux, etc. since they operate differently, but the main process is the same.  On the classifications of various OS's, your custom patterns launched (triggered) to go get the data and store it in your custom field on cmdb_ci_computer.   For each OS, you'll need to know exactly how & where to get these desired user data.  Then your custom patterns can leverage that to retrieve it and store into CIs

For question 2, if you've created field on cmdb_ci_computer class, then its inherited automatically by subclasses, like windows, linux, etc.  No need to re-create same field on those extended tables.

Hope this helps?

Thanks Dave for reply.

i am looking for OOTB pattern (Windows OS - Desktop). i can see here in step 7.3 we are setting value to assigned to field of a last logged person id(matching record from sys_user table) and what if i create custom string filed, 'last_logged_user' and set value from the discovery (login ID, User ID, etc.) to custom filed not matching with sys_user table for matching record.

could you help/direct me how can i achieve it with existing pattern.

Thanks in advance.

find_real_file.png

i have created custom filed and trying to add last logged user to it. using pattern. but unable to get result. and

test result showing session timed out.

is this correct way ? help me with guidance/direction.

 

find_real_file.png

 

Joby
Tera Contributor

I am able to set the custom field successfully.

find_real_file.png

 

find_real_file.png