Looks like you've got the basic idea, you've got to add the Collector Plugin
to the device to get that data modeled. As to how the oid connects to the
model see below:
This is using the file
$ZENHOME/Products/DataCollector/plugins/zenoss/snmp/HRFileSystemMap.py as an
example:
A few worthwhile things to note:
1) To get the modeler to grab snmp data it must first be a subclass of
SnmpPlugin.
2) The snmp oids you want need to be specified in a class member variable
snmpGetTableMaps.
3) That tuple takes GetTableMap Objects (whose constructor takes 3 arguments:
1) the table name you'll be using later, 2) the oid, 3) a dictionary of
"oid-endings" and column names (oid-endings being the keys)
4) The "oid-endings" are the last accessor digit before an index number for
each of the items you're querying. You must either get the index number from
one of the oids (in the example below ".1" gives us that index) or you must
somehow calculate and set this snmpindex variable explicitly (the index is
actually returned as a key in the map **see below**)
5) You can assign as many or as few of the oid-endings as you want to model.
Some of these will obviously need to be added to the Template you create as
data sources and don't fit appropriately in the model (i.e. don't model
anything you'll be storing in the RRD)
**see below about creating an snmpindex**
about the part where we get to this line:
for fs in fstable.values():
we can replace it with
for oid, fs in fstable.items():
then we can use the oid as snmpindex. The only caveat is that DataCollector
expects an already prefixed '.' so use this line to set it:
fs['snmpindex'] = '.' + oid
This might be way overkill to the question you're asking, but I hope this helps.
Justin
****EXCERPT FROM ZENOSS CORE SOURCE CODE*****
__doc__="""FileSystemMap
FileSystemMap maps the interface and ip tables to interface objects
$Id: HRFileSystemMap.py,v 1.2 2004/04/07 16:26:53 edahl Exp $"""
__version__ = '$Revision: 1.2 $'[11:-2]
import re
from Products.ZenUtils.Utils import unsigned
from CollectorPlugin import SnmpPlugin, GetTableMap
from DataMaps import ObjectMap
class HRFileSystemMap(SnmpPlugin):
maptype = "FileSystemMap"
compname = "os"
relname = "filesystems"
modname = "Products.ZenModel.FileSystem"
deviceProperties = \
SnmpPlugin.deviceProperties + ('zFileSystemMapIgnoreNames',)
columns = {
'.1': 'snmpindex',
'.2': 'type',
'.3': 'mount',
'.4': 'blockSize',
'.5': 'totalBlocks',
}
snmpGetTableMaps = (
GetTableMap('fsTableOid', '.1.3.6.1.2.1.25.2.3.1', columns),
)
typemap = {
".1.3.6.1.2.1.25.2.1.2": "ram",
".1.3.6.1.2.1.25.2.1.3": "swap",
".1.3.6.1.2.1.25.2.1.4": "fixedDisk",
}
def process(self, device, results, log):
"""collect snmp information from this device"""
log.info('processing %s for device %s', self.name(), device.id)
getdata, tabledata = results
fstable = tabledata.get("fsTableOid")
skipfsnames = getattr(device, 'zFileSystemMapIgnoreNames', None)
maps = []
rm = self.relMap()
for fs in fstable.values():
if not fs.has_key("totalBlocks"): continue
totalBlocks = fs['totalBlocks']
if totalBlocks < 0:
fs['totalBlocks'] = unsigned(totalBlocks)
if not self.checkColumns(fs, self.columns, log): continue
fstype = self.typemap.get(fs['type'],None)
size = long(fs['blockSize'] * totalBlocks)
if fstype == "ram":
maps.append(ObjectMap({"totalMemory": size}, compname="hw"))
elif fstype == "swap":
maps.append(ObjectMap({"totalSwap": size}, compname="os"))
elif (fstype == "fixedDisk" and size > 0 and
(not skipfsnames or not re.search(skipfsnames,fs['mount']))):
om = self.objectMap(fs)
om.id = self.prepId(om.mount)
rm.append(om)
maps.append(rm)
return maps
-------------------- m2f --------------------
Read this topic online here:
http://forums.zenoss.com/viewtopic.php?p=33982#33982
-------------------- m2f --------------------
_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users