btw, there is my code
 

from CollectorPlugin import SnmpPlugin, GetTableMap

class bwSoftwareMap(SnmpPlugin):

"""Map Broadworks Software Installed """

mapType = "SoftwareMap"

modname = "Products.ZenModel.Software"

relname = "software"

compName = "os"

snmpGetTableMaps = (

GetTableMap ('bwSoftwarePatchTable', '1.3.6.1.4.1.6431.1.1.2.2.3.1', 

{'.1':'bwSoftwarePatchIndex',

'.2':'bwSoftwarePatchVersionName',

'.3':'bwSoftwarePatchName',

'.4':'bwSoftwarePatchType',

'.5':'bwSoftwarePatchInstallDate',

'.6':'bwSoftwarePatchStatus',

'.7':'bwSoftwarePatchOperation'

}

),

GetTableMap ('bwSoftwareThirdPartyTable','1.3.6.1.4.1.6431.1.1.2.2.4.1',

{'.1':'bwSoftwareThirdPartyIndex',

'.2':'bwSoftwareThirdPartyName',

'.3':'bwSoftwareThirdPartyVersion',

'.4':'bwSoftwareThirdPartyStatus'

}

),

GetTableMap ('swTableOid','.1.3.6.1.4.1.6431.1.1.2.2.2.1',

{'.1':'snmpIndex',

'.2':'setProductKey',

'.3':'setInstallDate'

}

)

)

def process (self, device, results, log):

log.info('processing broadworks information for device %s' %device.id)

getdata, tabledata = results 

log.info('fetching Software Versions')

swVersionTable = tabledata.get("swTableOid")

if not swVersionTable: 

log.info('No Software versions found, exiting...')

return

rm = self.relMap()

log.debug('relmap is %s', rm)

for swVersion in swVersionTable.values():

log.info('found software %s' % swVersion['setProductKey'])

om = self.objectMap(swVersion)

om.id = self.prepId(om.setProductKey)

log.debug('om is %s',om.id)

if not om.id: continue

if hasattr(om,'setInstallDate'):

om.setInstallDate = self.asdate(om.setInstallDate)

rm.append(om)

log.debug('relmap is finally %s', rm)

return rm


________________________________

Od: [EMAIL PROTECTED] za uživatele Erik A. Dahl
Odesláno: po 23.10.2006 21:18
Komu: General discussion of using zenoss system
Předmět: Re: [zenoss-users] DataCollector Docs



Pavel,

Take a look a the plugins in $ZENHOME/Products/DataCollector/plugins/
zenoss/snmp/HRSWInstalledMap.py for and example.  Here are some high 
level points though:

Define the type map you will be using the target class type the 
relationship name and the component name. here we are populating the 
relation dev.os.software with Sofware objects.  This is most likely 
what you want.

     maptype = "YourSoftwareMap"
     modname = "Products.ZenModel.Software"
     relname = "software"
     compname = "os"


To get a table returned with named columns defined a tuple of 
GetTableMap objects at the class level.

     snmpGetTableMaps = (
         GetTableMap('swTableOid', '.1.3.6.1.2.1.25.6.3.1',
                 {'.1': 'snmpindex',
                  '.2': 'setProductKey',
                  #'.4': 'type',
                  '.5': 'setInstallDate',
                  }
         ),
     )

In the method process you will be building a list of ObjectMaps that 
go into a RelMap.  One confusing thing in this method is the way a 
software instance is stored.  Most of the data (ie the name) goes 
into the class object.  This is found by the zenoss backend using the 
setProductKey method.  This key is used to find the software product 
for the instance you have collected (the product is under a 
manufacturer in the /Manufacturers root).  If none is found a new one 
is created in the /Unknown manufacturer.

-EAD



On Oct 21, 2006, at 1:49 PM, Chlupáček Pavel wrote:

> I need to write custom data collector plugin.
>
> I found that doc on wiki si in fact just skeleton. Can you at least 
> provide some high-level steps? I just need to query the system for 
> software installed (i.e. patches, versions etc) which are populated 
> over enterprise mib. Therefore need to use custom one.
>
> I tried to undestand code, but maybe providing some guidance with 
> reference to code will help.
>
> Thx. p.
>
> _______________________________________________
> zenoss-users mailing list
> [email protected]
> http://lists.zenoss.org/mailman/listinfo/zenoss-users

_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users


<<winmail.dat>>

_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to