A hardware ZABBIX Agent made with Arduino Mega

Thank you guys for all the useful info!
With one DHT22 it works like a charm!

Now I encounter an issue when trying to use multiple DHT22's.

For some reason it only shows a maximum of 2 inputs in zabbix at the same time, sometimes it switches between the four(2x humidity measurement and 2x temperature measurement).

Can someone please tell me what I'm doing wrong?

In the picture attached there is some interruptions that are just me reuploading a different script trying to figure out what's wrong

//* Purpose : Zabbix Sensor Agent - Environmental Monitoring Solution *
//* Author : Evgeny Levkov *
//* Adapted to basics : Schotte Vincent *
//* DHT22 implementation to Arduino 1.0 : Carlos Eduardo de Siqueira *
//* Credits: *

//-----------------INCLUDES--------------------
#include "DHT22.h"
// Only used for sprintf
#include <stdio.h>

// Data wire is plugged into port 7 on the Arduino
// Connect a 4.7K resistor between VCC and the data pin (strong pullup)
#define DHT22_1_PIN 7
#define DHT22_2_PIN 8

// Setup a DHT22 instance
DHT22 dht(DHT22_1_PIN);
DHT22 dht2(DHT22_2_PIN);

#include <SPI.h>
#include <Ethernet.h>
#define MAX_CMD_LENGTH 25
//--------------------------------------------
byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0xE3, 0x5B };

IPAddress ip(10, 0, 30, 15);
IPAddress subnet(255, 255, 255, 0);

EthernetServer server = EthernetServer(10050); //Zabbix Agent port //Zabbix agent port
EthernetClient client;
boolean connected = false;

//--------------------------------------------
String cmd; //FOR ZABBIX COMMAND
//int led = 2; //LED PORT TO BLINK AFTER RECIEVING ZABBIX COMMAND
int counter = 1; // For testing
//-------

void setup(void)
{
// start serial port
//Serial.begin(9600);
//Serial.println("DHT22 Library Demo");
Ethernet.begin(mac, ip, subnet);
server.begin();
}

void loop(void)
{
//--------------------------------------------
client = server.available();
if (client == true) {
if (!connected) {
client.flush();
connected = true;
}
if (client.available() > 0) {
readTelnetCommand(client.read());
}
}
}

void readTelnetCommand(char c) {
if(cmd.length() == MAX_CMD_LENGTH) {
cmd = "";
}
cmd += c;
if(c == '\n') {
if(cmd.length() > 2) {
// remove \r and \n from the string
cmd = cmd.substring(0,cmd.length() - 1);
parseCommand();
}
}

}

//--------------------------------------------
void parseCommand() { //Commands recieved by agent on port 10050 parsing

DHT22_ERROR_t errorCode;

// The sensor can only be read from every 1-2s, and requires a minimum
// 2s warm-up after power-on.
//delay(2000);
//counter = counter + 1;

delay(2000);
errorCode = dht.readData();

if (errorCode == DHT_ERROR_NONE){
if (cmd.equals("humid")) {
server.print(dht.getHumidity());
client.stop();
} else
if (cmd.equals("temp")) {
server.print(dht.getTemperatureC());
client.stop();
}

delay(2000);
errorCode = dht2.readData();

if (errorCode == DHT_ERROR_NONE){
if (cmd.equals("humid2")) {
server.print(dht2.getHumidity());
client.stop();
} else
if (cmd.equals("temp2")) {
server.print(dht2.getTemperatureC());
client.stop();
}
}
cmd = "";

}
}