Skip to main content
Solved

NQE > External Sources > SNMP sources > Outputs > rawOidEntries


Hello:

  I am not sure if this should be a discussion or question so apologies on that.  I have an NQE where I am pulling the raw Oid data and displaying the rawValue result as an output.  I want to be able to name each of those outputs so that its know to the public what that raw data represents.  One such example is a returned value of INV: 2.12 in the rawValue field.  But I would like to have know as hardware revision.

I did apply names to the Oids in the custom source profile, but its not pulling that.  Can this be done?

Hi @gbaron - Thanks for your question. It sounds like you want to change the column name in the output from your NQE. Is this correct? 

@dev and @andreas demonstrate how to modify the column names in NQE output in this video at the 3:00 mark. The entire video is helpful for improving NQEs, but that particular segment addresses column naming.  

Let me know if that answers your question

 

Dave


Hello:

  Much appreciate the quick reply,.  Thats not quite what I need.  Let me see about getting an image on here tomorrow to better show the ask.  I know how to rename the columns and such, but this is modifying the actual data returned under that column name. Or making a column for each OID to output to, which would be easier if you can show me how to do that.


Sounds good. A screenshot or the chunk of NQE code you’d like to modify would be great. Thanks


Attached are three files to try an help paint the picture.  The one labeled “raw data example” is one of the SNMP OID outputs that I am using, there are five total as you can see.  The “NWE Code” is just that, the only code I can come up with.  The other “SNMP NQE Output” is a sample of the output from the code. 

As you can see, I have figure out out how to put the required fields in front of the raw data output, but I dont want 45 lines of that “else if” code line as none of the fields are all the same.  I tried to wild card the Serial Number “else if” statement but it wont put the anything other the raw value because of the final else rawOIDentry statement.

Ideally I want column headers for each of the “else if” statements for Manufacturer, Model, HardwareVersion, FirmwareVersion, and SerialNumber, but I dont know how to make that correlation.    Hope this helps, if not please ask away.


This doesn’t solve the problem you are asking about, but it does simplify things a bit.

Your query currently looks like

foreach device in network.devices
let snapshotInfo = device.snapshotInfo
foreach externalSources in nnetwork.externalSources]
foreach snmpSource in externalSources.snmpSources
... // no "where"
select distinct {
DeviceName: snmpSource.name,
...
}

I think you added `distinct` because you are generating duplicate data.

Instead, write your query like this

foreach snmpSource in network.externalSources.snmpSources
foreach device in network.devices
where device.name == snmpSource.name
let snapshotInfo = device.snapshotInfo
...
select {
DeviceName: device.name,
...
}

Please let me know if this suggestion works for you.


@gbaron, for you actual problem, do you want each device to have exactly one row in the query results?


I would very beneficial for each device to have its own row in the query results.  That would be a huge plus.


I am not sure I completely understand your original question.  I asked if you wanted one row of output per device to see if that was implied by your original request.  Your response

That would be a huge plus.

makes me think that I still don’t understand your original ask.

 


I apologize as its a hard one to explain.

The original ask is...IS there a way to label the individual rawOIDEntry.rawValue data without having to use 3 dozen or so else, if, replace commands?  As far as I can tell, the OID data is stored under that one data field, and there is no way to label what is the Manufacturer data, or Serial Number data, etc...without the use of the else, if, replace commands that I sent the screen shot of. 

 

Then you brought up  another great possibility, and that is to list all each device with all 5 results associated with that device.  All I meant by that was that would also be a nice option to have.

 

Does that help? 


I understand much better now.  Thanks for explaining again.

I believe I was able to simply your code.  See below.

Maybe there is a better way to solve your problem, but I don’t know enough about OIDs.

Does this work for you?

replacementPairs = s
{target: "EATON", replacement: "Maunufacturer: EATON" },
{target: "PXGX UPS + EATON BladeUPS", replacement: "Model: PXGX UPS + EATON BladeUPS" },
{target: "2.6.0.28-ups", replacement: "FirmwareVersion: 2.6.0.28-ups" },
{target: "ID: *", replacement: "SerialNumber: ID: *" }
];

replaceRawValue(rawValue) =
max(foreach replacementPair in replacementPairs
where matches(rawValue, replacementPair.target)
select replace(rawValue, replacementPair.target, replacementPair.replacement));

foreach snmpSource in network.externalSources.snmpSources
foreach device in network.devices
where device.name == snmpSource.name
let snapshotInfo = device.snapshotInfo
foreach output in snmpSource.outputs
foreach rawOidEntry in output.rawOidEntries
let replacedValue = replaceRawValue(rawOidEntry.rawValue)
select {
DeviceName: snmpSource.name,
SnapshotResult: when snmpSource.snapshotInfo.result is
collectionFailed -> "collectionFailed";
completed -> "completed";
processingFailed -> "processingFailed",
CollectionIp: snmpSource.snapshotInfo.collectionIp,
rawValue: if isPresent(replacedValue) then replacedValue else rawOidEntry.rawValue
}

 


That is cleaner, so thanks much for that.  Please consider this taken care of!


Reply