- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
** This example is based around Cisco based product ***
Overall Developer Steps:
- Load MIB files needed for SNMP
- The MIBs I loaded: AIRESPACE-WIRELESS-MIB, AIRESPACE-REF-MIB, AIRESPACE-SWITCHING-MIB
- Create new Probe to pull SNMP Query
- Tie probe back to "Standard Network Switch Classifier" Trigger
- Create Custom Sensor to read data and insert in CMDB with relationships.
Creating Custom Probe:
SNMP Fields:
Command == Table
OID == iso.org.dod.internet.private.enterprises.airespace.bsnWireless.bsnAP.bsnAPTable
Table Fields == bsnAPName,bsnAPDot3MacAddress,bsnAPPrimaryMwarName,bsnAPModel,bsnAPIOSVersion,bsnAPSerialNumber
Next we need to tie Probe back to Standard Network Switch Classifier Trigger. If you know this probe is only needed for one type of device then you can create a new classifier and add this probe and others to new classifier.
Creating Custom Sensor:
Make sure sensor reacts to Probe just created above.
Sensor Type = Sensor
Sensor Type(The Other one) = Javascript
Script:
new DiscoverySensor({
process: function (result, ciData) {
var snmp = new SNMPResponse(result);
//gs.info('PD: IN SNMP - WAP Device');
//ensures that we call the current record (used for creating the "parent" relationship below)
var recOBJ = this.getCmdbRecord();
//enter into the table we defined in the probe
var wapTable = 'iso.org.dod.internet.private.enterprises.airespace.bsnWireless.bsnAP';
var apTable = snmp.getOIDTable(wapTable, 'bsnAPEntry');
//gs.info('PD: IN SNMP - WAP Device and wapTable {0} and apTable {1}', wapTable, apTable);
for (var ap in apTable) {
var model = apTable[ap]['bsnAPModel'];
//get Model info/ or Create
var mod = new GlideRecord('cmdb_model');
mod.addQuery('name', model);
mod.query();
if (!mod.next()) {
mod.initialize();
mod.name = model;
mod.insert();
}
var idResult;
var logger = new DiscoveryLogger();
logger.setSource(this.type);
logger.setSensor(this.getEccQueueId());
var apData = new CIData({
"sys_class_name": "cmdb_ci_wap_network",
"name": apTable[ap]['bsnAPName'].toUpperCase(),
"serial_number": apTable[ap]['bsnAPSerialNumber'],
"mac_address": apTable[ap]['bsnAPDot3MacAddress'],
"model_id": mod.sys_id,
"comments": 'OS Version = '+apTable[ap]['bsnAPIOSVersion']
});
idResult = DiscoveryCMDBUtil.insertOrUpdate(apData, logger);
var id = idResult.sysId;
// Build/Update relationship data
//getting type id
var t = new GlideRecord('cmdb_rel_type');
t.get('name', 'Controller for::Controlled by');
var rel = new GlideRecord('cmdb_rel_ci');
rel.addQuery('parent', recOBJ.sys_id);
rel.addQuery('child', id);
rel.addQuery('type', t.sys_id);
rel.query();
if(!rel.next()){
rel.type = t.sys_id;
rel.parent = recOBJ.sys_id;
rel.child = id;
rel.update();
}
}
},
type: 'DiscoverySensor'
});
For your needs, you might want to adjust or add the fields you need to collect for your needs.
I hope example helps others out there with the same needs.
Thanks to Ryan Zulli for his help.
********* New network pattern from SN app store includes checks for Cisco WAPs *************
- 4,414 Views
- « Previous
-
- 1
- 2
- Next »
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.