UCMDB and UD Practitioners Forum (Previously CMS)
Showing results for 
Search instead for 
Do you mean 

UCMDB 8 - Enrichment rule help

SOLVED
Go to Solution
Advisor

UCMDB 8 - Enrichment rule help

[ Edited ]

Hello,

 

I'm trying to create a specific enrichment that's problably simple to define, but I'm stuck.

 

i.e. I have a host with some number of processes.

 

I've created an integer attribute on the host CIT called number_of_processes... How could I enrich that attribute?

 

Any ideas?

 

Thanks in advance,

Oskar

 

 

P.S. This thread has been moevd from Application Perf Mgmt (BAC / BSM) Support and News Forum to CMS and Discovery Support and News Forum. - Hp Forum Moderator

1 REPLY
Trusted Contributor

Re: UCMDB 8 - Enrichment rule help

[ Edited ]

I would not immediately consider using an enrichment rule for that. Enrichments are usually used to add, delete or update CI's. When updating a CI using the enrichment function of uCMDB one usually modifies an attribute directly, with a discrete value. I would consider modifying the host inventory script (by Shell or WMI) and fill your new attribute directly, counting the number of processes and returning the count variable.

 

The code below for example, when added to TTY_HR_Process_Lib.py (replacing the old addProcess routine) will update a custom Node CIT attribute called "number_processes":

 

def addProcess(pdu, hostId, cleanCommand, pid,  commandLine, commAndPath, cleanArgs, 
               processList, discoverProcesses, myVec, hostOSH, startuptime = None, owner = None):
    pdu.addProcess(hostId, cleanCommand, pid, commandLine, commAndPath, cleanArgs, owner, startuptime)

    processID = cleanCommand
    if commandLine != None:
        processID = processID + '->' + commandLine

    if ((processID in processList) != 0):
        logger.debug('process: ',cleanCommand,' already reported..')
        return
    processList.append(processID)
    processCount = len(processList)
    if discoverProcesses:
        processOsh = modeling.createProcessOSH(cleanCommand, hostOSH, commandLine, pid, commAndPath, cleanArgs, owner, startuptime)
        hostOSH.setAttribute('number_processes', processCount)		 
        logger.debug('Process count = ', processCount)
        myVec.add(processOsh)
        myVec.add(hostOSH)

 

//Add this to "OnDomLoad" event