jeanparpaillon / elixir-snmp Goto Github PK
View Code? Open in Web Editor NEWSNMP tooling for elixir
License: MIT License
SNMP tooling for elixir
License: MIT License
First, thanks for this module, it has helped me a lot. I have implemented an agent with multiple variables and tables and it seems to work fine, although to implement the tables, it was more work than I have originally assumed (I am not using the generic instrumentation nor ecto).
Now I need to implement sending SNMP notifications/traps and the library does not seem to provide much help with this. The config files it generates seem to lack support for notifications.
Is there any guidance how to support notifications on top of this library?
MIB compiler generates a lof of instrumentation functions, types, ecto types, etc
We want to implement the following architecture:
.mib
file into mib
record and makes it a module attributebefore_compile
callbacks and generates whatever they want from thisMib.__using__
macro optionSNMP agent configuration possible errors are numerous and may be complex (dependent, conflicting options, etc)
Actually, agent configuration stops at first error. It could be better to have a full report of all errors when starting the agent.
Agent configuration is represented as an Ecto schema, so that we can leverage changeset mechanisms for validating and reporting errors.
The Erlang SNMP allows to map the MIB objects to instrumentation functions through the xxx_MIB.funcs like this:
{myName, {ex1, my_name, []}}.
The MIB compilation step in elixir-snmp should map the camelCase object names to snake_case automatically.
When the instrumentation function names are left in camelCase as in the MIB, mix credo reports readability issues like this:
┃ [R] ↗ Function/macro/guard names should be written in snake_case.
┃ apps/snmp_agent/lib/snmp_agent/snmp/mib/strouter.ex:43:7 #(SnmpAgent.Mib.StRouter.inputsTable)
I think the current library fails if using "AUGMENTS" in an mib? I wanted to implement IF-MIB in my app, so I created a stub something like:
defmodule SnmpAgent.Mib.If do
use Snmp.Mib, name: "IF-MIB"
end
Then added IF-MIB and IANAifType-MIB into my local mibs directory. This fails with an error:
Generated sys_data app
==> snmp_agent
Compiling 10 files (.ex)
== Compilation error in file lib/snmp_agent/mib/if.ex ==
** (Protocol.UndefinedError) protocol Enumerable not implemented for {:augments, {:ifEntry, :undefined}} of type Tuple
(elixir 1.14.5) lib/enum.ex:1: Enumerable.impl_for!/1
(elixir 1.14.5) lib/enum.ex:166: Enumerable.reduce/3
(elixir 1.14.5) lib/enum.ex:4307: Enum.map/2
(elixir_snmp 0.2.1) lib/snmp/mib/table_info.ex:66: Snmp.Mib.TableInfo.find_indices/1
(elixir_snmp 0.2.1) lib/snmp/mib/table_info.ex:27: Snmp.Mib.TableInfo.new/2
(elixir 1.14.5) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
(elixir 1.14.5) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
(elixir_snmp 0.2.1) expanding macro: Snmp.Mib.__using__/1
If I replace the "AUGMENTS { ifEntry }" in IfXEntry, then it compiles (and gives me errors about missing definitions)
So I speculate that it's something to do with the thing being augmented being described in the same file? However, I'm not sure how to progress to resolve this? Any guidance?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.