MKR Zero SNMP

Good Day

I am new to arduino platform and trying to get SNMP host to talk to MKR Zero with MKR Ethernet shield. Further I am using Agentuino library for SNMP agent. The code is as follows

#include <Agentuino.h>
#include <Ethernet.h>
#include <Arduino.h>
#include <Wire.h>
#include “SHT31.h”
#include <SPI.h>

SHT31 sht31 = SHT31();

byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //Mac Address for Arduino Ethernet Shield
byte ip = { 192, 168, 0, 169 }; //IP Address for Arduino Ethernet Shield

const int a2 = A2;
const int a3 = A3;
const int a4 = A4;
const int a5 = A5;

int term2=0;
int term3=0;
int term4=0;
int term5=0;

const char sysDescr PROGMEM = “1.3.6.1.2.1.1.1.0”; // System Description
const char sysContact PROGMEM = “1.3.6.1.2.1.1.4.0”; // System Contact
const char sysName PROGMEM = “1.3.6.1.2.1.1.5.0”; // System Name
const char sysLocation PROGMEM = “1.3.6.1.2.1.1.6.0”; // System Location
const char sysServices PROGMEM = “1.3.6.1.2.1.1.7.0”; // System Services

//My Custom OID’s

const char temperature2 PROGMEM = “1.3.6.1.3.2016.5.0.2”; //Temperature in Celsius
const char temperature3 PROGMEM = “1.3.6.1.3.2016.5.0.3”; //Temperature in Celsius
const char temperature4 PROGMEM = “1.3.6.1.3.2016.5.0.4”; //Temperature in Celsius
const char temperature5 PROGMEM = “1.3.6.1.3.2016.5.0.5”; //Temperature in Celsius

// RFC1213 local values

static char locDescr = “SNMP monitoring”; // read-only (static)
static char locContact[50] = “P1”;
static char locName[20] = “ServerRoom”;
static char locLocation[20] = “test_location”;
static int32_t locServices = 2; // read-only (static)

uint32_t prevMillis = millis();
char oid[SNMP_MAX_OID_LEN];
SNMP_API_STAT_CODES api_status;
SNMP_ERR_CODES status;

void pduReceived()

{

SNMP_PDU pdu;
api_status = Agentuino.requestPdu(&pdu);

if ((pdu.type == SNMP_PDU_GET || pdu.type == SNMP_PDU_GET_NEXT || pdu.type == SNMP_PDU_SET)
&& pdu.error == SNMP_ERR_NO_ERROR && api_status == SNMP_API_STAT_SUCCESS ) {

pdu.OID.toString(oid);

if ( strcmp_P(oid, sysDescr ) == 0 ) {
if ( pdu.type == SNMP_PDU_SET ) {
pdu.type = SNMP_PDU_RESPONSE;
pdu.error = SNMP_ERR_READ_ONLY;
} else {
status = pdu.VALUE.encode(SNMP_SYNTAX_OCTETS, locDescr);
pdu.type = SNMP_PDU_RESPONSE;
pdu.error = status;
}
} else if ( strcmp_P(oid, sysName ) == 0 ) {
if ( pdu.type == SNMP_PDU_SET ) {
status = pdu.VALUE.decode(locName, strlen(locName));
pdu.type = SNMP_PDU_RESPONSE;
pdu.error = status;
} else {
status = pdu.VALUE.encode(SNMP_SYNTAX_OCTETS, locName);
pdu.type = SNMP_PDU_RESPONSE;
pdu.error = status;
}
} else if ( strcmp_P(oid, sysContact ) == 0 ) {
if ( pdu.type == SNMP_PDU_SET ) {
status = pdu.VALUE.decode(locContact, strlen(locContact));
pdu.type = SNMP_PDU_RESPONSE;
pdu.error = status;
} else {
status = pdu.VALUE.encode(SNMP_SYNTAX_OCTETS, locContact);
pdu.type = SNMP_PDU_RESPONSE;
pdu.error = status;
}
} else if ( strcmp_P(oid, sysLocation ) == 0 ) {
if ( pdu.type == SNMP_PDU_SET ) {
status = pdu.VALUE.decode(locLocation, strlen(locLocation));
pdu.type = SNMP_PDU_RESPONSE;
pdu.error = status;
} else {
status = pdu.VALUE.encode(SNMP_SYNTAX_OCTETS, locLocation);
pdu.type = SNMP_PDU_RESPONSE;
pdu.error = status;
}
} else if ( strcmp_P(oid, sysServices) == 0 ) {
if ( pdu.type == SNMP_PDU_SET ) {
pdu.type = SNMP_PDU_RESPONSE;
pdu.error = SNMP_ERR_READ_ONLY;
} else {
status = pdu.VALUE.encode(SNMP_SYNTAX_INT, locServices);
pdu.type = SNMP_PDU_RESPONSE;
pdu.error = status;
}
}
else {
pdu.type = SNMP_PDU_RESPONSE;
pdu.error = SNMP_ERR_NO_SUCH_NAME;
}
Agentuino.responsePdu(&pdu);
}
Agentuino.freePdu(&pdu);
}

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
sht31.begin();
Ethernet.begin(mac, ip);
//Udp.begin(localPort);

api_status = Agentuino.begin(); //Begin Snmp agent on Ethernet shield
if ( api_status == SNMP_API_STAT_SUCCESS ) {
Agentuino.onPduReceive(pduReceived);
delay(10);
return;
}

}

void loop() {
Agentuino.listen();
}

Currently, I trying to poll static SNMP OID that are defined in the code. Any input will be of great help. Has anyone tested the library for MKR boards?