-1

there!

I'm participating in a school project in which we need to check the temperature with Arduino and DTH22 sensor. If the temperature is above a specified value (Celsius degrees is being used), the fan is activated. So far, so good. It works! But now the teacher is asking to use Zabbix (which I'm getting to know just now) to remotely collect the temperature data.

I've digged a lot, but haven't found any answer to that, only partial explanations about Zabbix, which I don't undestand very well so far. All codes that involve Zabbix are very confusing to me...

If someone could help me how to configure Zabbix with SNMP and which code lines should I add to my Arduino code in order to send Zabbix the data, I would be very thankful!

Here's the code I have (which works, without Zabbix):

#include"DHT.h"
#define DHTPIN A0
#define DHTTYPE DHT22
#define tLim 20.6
DHT dht(DHTPIN, DHTTYPE);

int rele=2;
void setup() {
  Serial.begin(9600);
  dht.begin();
  pinMode(rele,OUTPUT);
  digitalWrite(rele,HIGH);
}

void loop() {
  float u=dht.readHumidity();
  float t=dht.readTemperature();
  if (isnan(t)||isnan(u))
  {
    Serial.println("Erro na leitura");
    return;
  }else
  {
  Serial.print("Temperatura: ");
  Serial.print(t);
  Serial.print(" \xC2\xB0");
  Serial.println("C");
  Serial.print("Umidade: ");
  Serial.print(u);
  Serial.println("%");
  Serial.println();  
  delay(2000);
  }

  //turns fan on if temperature is reached

  if(t>=tLim)
  {
    digitalWrite(rele,LOW);
  }else
  {
    digitalWrite(rele,HIGH);
  }
}
  • 1
    1) What network interface you have with your Arduino? ethernet? WiFi? What Arduino you are using? 2) I would assumed that if your teacher ask you to send the data to a Zabbix server, there must be an API provided, what is the API? What protocol it used? Without that your question can't be answered because we don't know what exactly the Arduino need to communicate with the Server. – hcheung Oct 02 '22 at 01:25
  • Arduino UNo, with Ethernet shield. No API, but he mentioned to use SNMP. Thanks! – Stephan Oct 02 '22 at 20:27

1 Answers1

0

If I remember correctly, you have to run some server on your arduino, which is called a zabbix Agent. After that, you can tell the zabbix server, to periodically pull data from this agent(this is called pull model). With a quick search I found https://github.com/interlegis/Arduino-Zabbix-Agent this repository, you can start here.

IamK
  • 2,753
  • 5
  • 30
  • 39
  • Thanks. I had found that link, too. But I confess I didn't understand too well, because of that OneWire. But thanks, I know that that's the way, somehow :) – Stephan Oct 02 '22 at 20:26
  • The oneWire is used with a specific sensors (you dont need that), just use from the code what you need. – IamK Oct 02 '22 at 20:28