Changeset 74a8115 in nscp


Ignore:
Timestamp:
02/22/08 07:43:40 (5 years ago)
Author:
Michael Medin <michael@…>
Children:
274362b
Parents:
83d61f0
Message:
  • Fixed issues in the NRPE module (now returns the correct status) + Added a lot of "error log" for when the packet size in NRPEListener is not correct

(might make it simpler to diagnose problems)

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/changelog

    r83d61f0 r74a8115  
    77 * Improved socket performance (would be nice if we could be used as a "hub") 
    88 
    9 2008-02-19 MickeM 
     92008-02-22 MickeM 
     10 * Fixed issues in the NRPE module (now returns the correct status) 
     11 + Added a lot of "error log" for when the packet size in NRPEListener is not correct  
     12    (might make it simpler to diagnose problems) 
     13 
     142008-02-20 MickeM 
    1015 + Added new module NRPEClient that can act as a NRPE client, might be useful for testing things and  
    1116   eventually for relaying events. 
  • trunk/modules/NRPEListener/NRPEListener.cpp

    r087a3c9 r74a8115  
    8181  scriptDirectory_ = NSCModuleHelper::getSettingsString(NRPE_SECTION_TITLE, NRPE_SETTINGS_SCRIPTDIR ,NRPE_SETTINGS_SCRIPTDIR_DEFAULT); 
    8282  buffer_length_ = NSCModuleHelper::getSettingsInt(NRPE_SECTION_TITLE, NRPE_SETTINGS_STRLEN, NRPE_SETTINGS_STRLEN_DEFAULT); 
     83  if (buffer_length_ != 1024) 
     84    NSC_DEBUG_MSG_STD(_T("Non-standard buffer length (hope you have recompiled check_nrpe changing #define MAX_PACKETBUFFER_LENGTH = ") + strEx::itos(buffer_length_)); 
    8385  std::list<std::wstring> commands = NSCModuleHelper::getSettingsSection(NRPE_HANDLER_SECTION_TITLE); 
    8486  std::list<std::wstring>::const_iterator it; 
     
    276278        break; 
    277279      if (!lastReadHasMore) { 
     280        NSC_LOG_MESSAGE(_T("Could not read a full NRPE packet from socket, only got: ") + strEx::itos(block.getLength())); 
    278281        client->close(); 
    279282        return; 
     
    282285    } 
    283286    if (i >= maxWait) { 
    284       NSC_LOG_ERROR_STD(_T("Timeout reading NRPE-packet (increase socket_timeout)")); 
     287      NSC_LOG_ERROR_STD(_T("Timeout reading NRPE-packet (increase socket_timeout), we only got: ") + strEx::itos(block.getLength())); 
    285288      client->close(); 
    286289      return; 
     
    317320        return; 
    318321      } 
     322    } else { 
     323      NSC_LOG_ERROR_STD(_T("We got more then we wanted ") + strEx::itos(NRPEPacket::getBufferLength(buffer_length_)) + _T(", we only got: ") + strEx::itos(block.getLength())); 
     324      client->close(); 
     325      return; 
    319326    } 
    320327  } catch (simpleSocket::SocketException e) { 
  • trunk/modules/NSCAAgent/NSCAThread.cpp

    r34f5502 r74a8115  
    7474    } 
    7575  } 
    76   //NSC_DEBUG_MSG_STD(_T("Result: ") + result.toString()); 
    7776  return result; 
    7877} 
  • trunk/modules/NSCAAgent/NSCAThread.h

    re0936e3 r74a8115  
    170170      data->packet_version=static_cast<NSCAPacket::int16_t>(htons(NSCA_PACKET_VERSION_3)); 
    171171      data->timestamp=static_cast<NSCAPacket::u_int32_t>(htonl(time)); 
    172       data->return_code = code; 
     172      data->return_code = ntohs(code); 
    173173      data->crc32_value=static_cast<NSCAPacket::u_int32_t>(0L); 
    174174 
Note: See TracChangeset for help on using the changeset viewer.