SNMP - Arduino Mega - Dude / Observium

Good morning.
I am experimenting with the SNMP.h library
What I want to do, is from the Dude and the Observium, monitor an Arduino Mega + Shield Ethernet. I am tested with the "Agent" example test.
I don't quite understand how it all works. With the program I am attaching, from a Linux I can poll the Arduino Mega:

root@Mkb:/home/administrator# snmpget -v 2c -c public 172.20.20.153 1.3.6.1.2.1.1.5.0
Resposta -> iso.3.6.1.2.1.1.5.0 = STRING: "Nucleo F767ZI"
it is "OK"

But from the Dude and Observium, it doesn't detect it.

Could it be that I need to schedule other IODs?
Object OID
system 1.3.6.1.2.1.1
Object OID
sysDescr 1.3.6.1.2.1.1.1.0
sysObjectID 1.3.6.1.2.1.1.2.0
sysUpTime 1.3.6.1.2.1.1.3.0
sysContact 1.3.6.1.2.1.1.4.0
sysName 1.3.6.1.2.1.1.5.0
sysLocation 1.3.6.1.2.1.1.6.0
sysServices 1.3.6.1.2.1.1.7.0
sysORLastChange 1.3.6.1.2.1.1.8.0
sysORTable 1.3.6.1.2.1.1.9.0

I don't really understand how this all works.
What do I need to do for the Dude and Observium to detect the Mega?

I'm attaching the code I'm using, which is the library example.
Thanks.


#include <Ethernet.h> 

#include <SNMP.h>

EthernetUDP udp;
SNMP::Agent snmp;

// snmpget -v 2c -c public 172.20.20.153 1.3.6.1.2.1.1.5.0

const char *SYSNAME_OID = "1.3.6.1.2.1.1.5.0";
//const char *SYSNAME_OID = "1.3.6.1.2.1.2.2.1.6";
//const char *SYSNAME_VALUE = "Nucleo F767ZI"; // Name of the board. Replace if needed.
const char *SYSNAME_VALUE = "Arduino Mega_XX"; // Name of the board. Replace if needed.

// Use some SNMP classes
using SNMP::OctetStringBER;
using SNMP::VarBind;
using SNMP::VarBindList;

// Event handler to process SNMP messages
void onMessage(const SNMP::Message *message, const IPAddress remote, const uint16_t port) {
    // Get the variable binding list from the message.
    VarBindList *varbindlist = message->getVarBindList();
    for (unsigned int index = 0; index < varbindlist->count(); ++index) {
        // Each variable binding is a sequence of 2 objects:
        // - First one is and ObjectIdentifierBER. It holds the OID
        // - Second is the value of any type
        VarBind *varbind = (*varbindlist)[index];
        // There is a convenient function to get the OID as a const char*
        const char *name = varbind->getName();
        if (strcmp(SYSNAME_OID, name) == 0) {
            // System name is requested. We have to send a response.
            // Create an SNMP message for response
            SNMP::Message *response = new SNMP::Message(SNMP::VERSION2C, "public", SNMP::TYPE_GETRESPONSE);
            // The response must have the same request-id as the request
            response->setRequestID(message->getRequestID());
            // SYSNAME
            // Create an OctetStringBER to hold the variable binding value
            OctetStringBER* value = new OctetStringBER(SYSNAME_VALUE);
            // Add the variable binding to the message
            response->add(SYSNAME_OID, value);
            // Send the response to remote IP and port
            snmp.send(response, remote, port);
            // Avoid memory leak
            delete response;
       }
    }
}

void setup() {
	// Serial

  Serial.begin(9600);

	byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
	Ethernet.begin(mac, IPAddress(172, 20, 20, 153));

  // print your local IP address:
  Serial.print("My IP address: ");
  Serial.println(Ethernet.localIP());

  // SNMP
  snmp.begin(&udp);
  snmp.onMessage(onMessage);
}

void loop() 
  {
  // Agent loop function must be called to process incoming messages
  snmp.loop();
  snmp.onMessage(onMessage);
  Serial.println("Hola");
  delay(1000);
  }

Is snmpget an Arduino command line tool? Asking because you might have posted in the wrong category.

My knowledge of SNMP is very limited (I guess about the same as yours :wink:)

I had a quick look at Observium; I suspect that they need to know the MIB of your Mega. https://mibs.observium.org/. I have no idea if you can add.

No - it's a Linux command-line tool to query an SNMP Agent.

http://www.net-snmp.org/wiki/index.php/TUT:snmpget

The what?

Are you sure that's the Mega? it's saying it's an STM32!

Are you sure they can reach its IP address? Can they ping it?

What error message(s) do they give?

Sorry if the query is not on the relevant list, maybe the moderator can do me the favor of sending it to the site.

If the mega ping responds correctly from any PC on the network.

From a Linux:
snmpget -v 2c -c public 172.20.20.153 1.3.6.1.2.1.1.5.0

where the IP is the address of the Mega, choosing:

iso.3.6.1.2.1.1.5.0 = STRING: "Arduino Mega_XX"

Where the String is what I wrote in code:

const char *SYSNAME_OID = "1.3.6.1.2.1.1.5.0"
const char *SYSNAME_VALUE = "Arduino Mega_XX";

But, both on Dude and Observiun, I register the Mega (172.20.20.153) with version v2-public, as I have done with other devices, PCs, Servers, etc... and the MEGA does not detect it. In the case of the Observium, it tells me what I show you in the attached image.

thanks.

Captura de pantalla 2023-07-20 125745

You still haven't answered what these are.

How do you have then set up?

Are the "Dude" and "Observiun" on that same network?

So why was your previous post showing "Nucleo F767ZI"? What's changed?

"both Dude and Observer"
Both fail. Only Linux responds to me with instructions.
I am not an expert in the field. The servers, Sw, PC,... that I'm monitoring on both Dude and Observaun are working fine for me. On each device at the time I activated the services and it worked fine for me.

With the *SYSNAME VALUE" I have been trying. Now I have it like this: *SYSNAME_VALUE = "Nucleo F767ZI" and it doesn't work for me.

const char *SYSNAME_OID = "1.3.6.1.2.1.1.5.0";
//const char *SYSNAME_OID = "1.3.6.1.4.1.11.2.13.2.5";
const char *SYSNAME_VALUE = "Nucleo F767ZI"; // Name of the board. Replace if needed.
//const char *SYSNAME_VALUE = "Arduino Mega_XX"; // Name of the board. Replace if needed.
//const char *SYSNAME_VALUE = "2.0.0"; // Name of the board. Replace if needed.

With the MEGA, I'm missing something, but it can't be found.
Thanks for your help.

You still haven't answered what these are - and is "Observer" different from "Observium" ?

How do you have then set up?

If it works from the command line with snmpget, then the problem must be:

  1. The network access from Dude/Observer/Observium to your Mega;
  2. The configuration of Dude/Observer/Observium;
  3. both!

I just wanted to confirm with you before moving the topic. No Arduino command line tool so it was the wrong category end hence your topic has been moved to a more suitable location on the forum.

2 Likes

sorry "Observer" = "Observation". Typing error !!!

Network access is checked and correct.
I will review everything. It seems to me too that something is missing from the Dude and the Observium.

You still haven't said what Dude and the Observium are!

How, exactly, have you checked it?

Have you used Wireshark (or similar) to see what's actually happening on the network?

Have you added some diagnostic prints to your Mega to see if it is receiving anything at all?

Did you have this working on the STM32 Nucleo F767ZI ?

I use both programs to monitor equipment. If a team crashes let me know. I can also see it graphically. Observium, they give me a lot of information about the servers, temperature, load,... they are very useful.

The Dude: MikroTik Routers and Wireless - Software
Observium: https://www.observium.org/

At last - thanks.

And are these running locally on a machine on the same network as your Mega and Linux machine?

What does their documentation say about adding a new device? And troubleshooting?

For questions about configuring those utilities:

https://forum.mikrotik.com/viewforum.php?f=8

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.