Giter Site home page Giter Site logo

arduino-snmp's Introduction

Usage code https://code.google.com/p/agentuino/

Implemented SNMP trap functions from Enmyerp http://forum.arduino.cc/index.php?topic=50848.60

@EDIT M. Pivovarsky  <[email protected]>

Extended version - with memory library
Simple version - without memory library 

--------------------------------------------------------------------------------------------------------------------------------------------------------------------

SNMP v1

PDU Types
    GET-Request
    SET-Request
    Response
    Trap
    
Syntax Types
    Null
    Boolean
    Bits (WIP)
    Octet-String
    Object-Identifier (WIP)
    Integer and Integer32
    Counter and Counter64
    Gauge
    Time-Ticks
    IP-Address
    Opaque
    Network-Service-Access-Point (NSAP) Address
    
Limitations
    Agentuino's limitation is dependent on the amount of SRAM available.

    Maximum Community Names (Get/Set) Length: 20 bytes
    Maximum Object-Identifier Length: 64 bytes
    Maximum Value Length: 64 bytes
    Maximum Packet Length: 153 bytes
    
--------------------------------------------------------------------------------------------------------------------------------------------------------------------    

Net-Snmp Get-Request

snmpget -v 1 -r 1 -c public 192.168.2.64 sysUpTime.0

Net-Snmp Set

snmpset -v 1 -r 1 -c private 192.168.2.64 sysName.0 s NewName

snmpget -v 1 -r 1 -c public 192.168.2.64 sysName.0

arduino-snmp's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

arduino-snmp's Issues

Question about the library

Hi there,

Can someone tell me how can I easily pool Values from other devices with Arduino, I have the host, community and the OID too.

Thank you! ;)

When set to DHCP able to send traps to other network ip but not on setting static ip

Hello sir...
I am working on a small project and when I set the IP as DHCP by using only this-ethernet.begin(mac);,
Then I am getting the Traps over the other network also(having different gateway!
But once I set the device on Static IP with the default gateway and Subnet mask then I am getting trap over the the same gateway ips i.e. same IP pool but not on other network!
please help me as I am not having much networking knowledge.

It has worng asn header with length > 128

It has worng asn header with length > 128
asn length field may be 2, 3 or 4 bytes. It needs to be adaptive.
Type_and_leng[1] = sizeof (Version) / sizeof (Version[0]) + sizeof (Comunity_string) / sizeof (Comunity_string[0])
^^^^^^^^^^^
+ sizeof (PDU_type_and_leng) / sizeof (PDU_type_and_leng[0]) + sizeof (OID) / sizeof (OID[0])
+ sizeof (IP_definition) / sizeof (IP_definition[0]) + sizeof (my_IP_address) / sizeof (my_IP_address[0])
+ sizeof (Type_Trap) / sizeof ( Type_Trap[0]) + sizeof (extra_OID) / sizeof ( extra_OID[0])
+ sizeof (Type_time_stick) / sizeof ( Type_time_stick[0]) + sizeof (hexadecimalNumber) / sizeof ( hexadecimalNumber[0])
+ sizeof (Var_Bind) / sizeof ( Var_Bind[0]) + sizeof (Var_Bind1) / sizeof ( Var_Bind1[0])
+ sizeof (OID1) / sizeof ( OID1[0]) + sizeof (Value1) / sizeof (Value1[0]) + strlen(Message);
^^^^^^^^^^^^^^^^^^^^^
Message also requires adjustment.

This library is useful for small message but not for complex environment.

from net-snmp code

if (length < 0x80) {
if (*datalength < 1) {
snprintf(ebuf, sizeof(ebuf),
"%s: bad length < 1 :%lu, %lu", errpre,
(unsigned long)*datalength, (unsigned long)length);
ebuf[ sizeof(ebuf)-1 ] = 0;
ERROR_MSG(ebuf);
return NULL;
}
*data++ = (u_char) length;
} else if (length <= 0xFF) {
if (*datalength < 2) {
snprintf(ebuf, sizeof(ebuf),
"%s: bad length < 2 :%lu, %lu", errpre,
(unsigned long)*datalength, (unsigned long)length);
ebuf[ sizeof(ebuf)-1 ] = 0;
ERROR_MSG(ebuf);
return NULL;
}
*data++ = (u_char) (0x01 | ASN_LONG_LEN);
data++ = (u_char) length;
} else { /
0xFF < length <= 0xFFFF */
if (*datalength < 3) {
snprintf(ebuf, sizeof(ebuf),
"%s: bad length < 3 :%lu, %lu", errpre,
(unsigned long)*datalength, (unsigned long)length);
ebuf[ sizeof(ebuf)-1 ] = 0;
ERROR_MSG(ebuf);
return NULL;
}
*data++ = (u_char) (0x02 | ASN_LONG_LEN);
*data++ = (u_char) ((length >> 8) & 0xFF);
*data++ = (u_char) (length & 0xFF);
}

Agentuino.Trap not working

I'm using the Agent.ino already provided by the library and it doesn't work. It doesn't send any trap. It spams "Send Trap" but the trap wasn't sent.

Library not valid

Hi, i get:

Error: 13 INTERNAL: Library install failed: moving extracted archive to destination dir: library not valid

When trying to install this as zip file on IDE 2.0.4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.