Highlighted
New Member.
299 views

Windows last users parsed into UCMDB

Hi Forum

How do I get the LastUser from the UD Scanfile (I can see the user data with the Inventory tool viewer) into the UCMDB? What CI-type will it be parsed into?

Could someone supply a sample code I can add to ParseEnrichedScanFile.py?

The data is in the scanfile under hwOsData.hwUserdata.hwOSUserProfiles the fields hwOSUserProfileName and hwOSUserProfileLastLogon. I'm interrested in populating the 5 lastes user that have logged on.

I hope it is a good question for tomorrows Experts day :0)

Regards Gordon

0 Likes
9 Replies
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: Windows last users parsed into UCMDB

Hello ,

 

Would you please provide us the OS that you are using ?

 

Best Regards ,

Melissa Carranza Mejias
Customer Support Engineer

If you find that this or any other post resolves your issue, please be sure to mark it as an accepted solution.
If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the STAR at the bottom left of the post and show your appreciation. “
0 Likes
Highlighted
New Member.

Re: Windows last users parsed into UCMDB

The UCMDB is running Windows.

I didn't think it matters since the Python is platform independent

*** System information *** Server version: 10.22 build: 196 OS: Windows Server 2012 version 6.2 DB: [XXXX] at SQLServer on [xxxxxx:1433] with userName [xxxxx] with password [xxxx] MT: disabled HA: Is_ha_enabled = true Cluster_name = sqlserver_ucmdb Cluster_nodes_names = [xxxxx] Cluster_node_number = 1 Customers [Total of 2 customer(s)]: [Customer ID: 1, Name: Default Client, CP: 18.00.74Description: Default Client, Config ID: 1] [Customer ID: 100001, Name: State: Authorized; Customer: 1, CP: 15.00.123Description: null, Config ID: 1] Probe: IntegrationService, version: 10.22.196, build: 196 Probe: yyyyy, version: 10.22.196, build: 196

0 Likes
Highlighted
New Member.

Re: Windows last users parsed into UCMDB

Hi,

 

Looks the user info is in tag :  <hwOSUserProfileName type="attrib">admin</hwOSUserProfileName>

For now, there is no usage of User related data. It may need a new attribute to set the user info

 

Thanks,

Ding Dong

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Windows last users parsed into UCMDB

Are you looking for the user who logged in last time to the server ?

 

0 Likes
Highlighted
New Member.

Re: Windows last users parsed into UCMDB

I'm looking for creating CIs showing at least the last 5 users.

I guess I would create a new CI type a clone of person and then create a link to Node of type user

I know the information is available in the scanfile. The file ParseEnrichedScanfile.py need modifications.

If you have tried to make these modifications.

Regards

Gordon

0 Likes
Highlighted
Contributor.
Contributor.

Re: Windows last users parsed into UCMDB

Please open up a support ticket, so that we can assist you further.

HP Support
If you find that this or any post has resolved your issues please mark it as solved.
0 Likes
Highlighted
New Member.

Re: Windows last users parsed into UCMDB

Hi Figenkum

Well this is not an error I'm reporting.

I'll create a Support case

Regards Gordon

0 Likes
Highlighted
New Member.

Re: Windows last users parsed into UCMDB

After quite a lot of hardwork I came to this result:

Add this to the ParseEnrichedScanFile.py:

Under parseDom I added:

            createWinLastLogonUserOSH(OSHVResult, rootNode, nodeOSH)

In the end of the file I added:

def createWinLastLogonUserOSH(oshvresults, root, hostOsh):
    logger.debug("RSA_serveruser H: was here")
    logonUsers = root.getElementsByTagName("hwOSUserProfiles_value")
    logonUsersArray = nodeListToArray(logonUsers)
    user_tuples = []
    idx = 0
    for logonUser in logonUsersArray:
        username = getNodeValues("hwOSUserProfileName",logonUser)[0]
        #logger.debug("RSA_serveruser (in for loop): " + username)
        if username.find('\\')<>-1 and username.find('cmdbadmin')==-1:
    #    logger.debug("RSA_serveruser (username ok): " + username)
            lastLogon=getNodeValues("hwOSUserProfileLastLogon",logonUser)[0]
            user_tuples.extend([(username,lastLogon)])
            logger.debug("RSA_serveruser: " + username + ", RSA_dateaccess: " + lastLogon)      

    sorted_user_tuples= sorted(user_tuples, key=lambda user: user[1])
    sorted_user_tuples.reverse()
        
    for idx in range(0,len(sorted_user_tuples)):
        logger.debug("RSA_serveruser insert: " + sorted_user_tuples[idx][0] + ", RSA_dateaccess: " + sorted_user_tuples[idx][1])      
        userOsh = ObjectStateHolder("RSA_serveruser")
        userOsh.setAttribute("name", sorted_user_tuples[idx][0])
        userOsh.setAttribute("RSA_dateaccess", sorted_user_tuples[idx][1])
        oshvresults.add(userOsh)
        userOsh.setContainer(hostOsh)
        oshvresults.add(userOsh)
        mapScanFile(oshvresults, root, hostOsh, userOsh)
        linkOsh = modeling.createLinkOSH('usage', userOsh, hostOsh)
        oshvresults.add(linkOsh)
        if idx == 5:
            break            
 

I just could not make the connection to the between hostOSH and my UserOSH, but  linkOsh = modeling.createLinkOSH('usage', userOsh, hostOsh), did the work. Does anyone know why the MapScanfile did not work?

The issue is next time I get a CP or other update, this will be overwritten. Any hints on adding functionality that is not deleted at next update?

Regards

Gordon

0 Likes
Highlighted
Contributor.
Contributor.

Re: Windows last users parsed into UCMDB

Hi Gordon,

We would need to create an Enhancement Request and this needs to be approved and implemented for it to be available all the time.

Unfortunately, otherwise you will need to update it everytime you have a CP update.

 

Thanks

 

HP Support
If you find that this or any post has resolved your issues please mark it as solved.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.