etingof / pysmi

SNMP MIB parser
http://snmplabs.com/pysmi/
BSD 2-Clause "Simplified" License
132 stars 51 forks source link

There's anyway to convert text to mib files with this lib? #54

Closed marcotuliocnd closed 4 years ago

marcotuliocnd commented 4 years ago

I'm in need of converting the error log of my aplication to a MIB file, don't need be plain text, can be json, or strings. Can I do this with pysmi?

etingof commented 4 years ago

Your requirement is unclear to me. MIB file is a "schema" i.e. it defines the structure of the data, while log records are typically like a barely structured data.

marcotuliocnd commented 4 years ago

Thanks for an awnser.

I am a developer and in one of my projects, the client required that any error that occurred in the platform should be sent to them in MIB format.

So I want to get the error log of my application and manipulate them in a way that could be converted to a MIB file.

My requirement is the inverse of the functionality MIB Parser that exists today in the lib, that converts MIB to JSON. I Want to convert JSON, to MIB. Is it possible?

etingof commented 4 years ago

It might be theoretically possible (to a limited extent) to derive data structure definition from a data instance. Many things, like constraints, can't be deduced that way.

That makes me think that may be your client means something else. What's their ultimate goal? What they gonna do with a MIB file?

marcotuliocnd commented 4 years ago

They use a software called zabbix and they wanna see the information there.

etingof commented 4 years ago

Of the top of my head, may be they want some of your log records to pop up in their monitoring system (Zabbix). That's conventionally done by packing the log item of interest into SNMP TRAP message and sending it towards NMS.

You may or may not need a MIB that describes the structure and semantics of the log record, however it is usually written by hand and fed to the NMS for TRAP message interpretation.

Just my guess, FWIW.

etingof commented 4 years ago

It appears to me that your original idea of converting log record into a MIB file has no relevance to the problem at hand.

Perhaps you should devise a way to (1) send SNMP TRAP message with the logs coming out of your app and (2) find a way to get your SNMP TRAP message through the network up to their NMS.

etingof commented 4 years ago

If I were in your shoes, I'd sit down with the customer and figure out what's their ultimate goal.

marcotuliocnd commented 4 years ago

thank you for the help