Changeset 276


Ignore:
Timestamp:
07/28/10 22:00:41 (19 months ago)
Author:
mickem
Message:
  • Fixed issue with NSCA server and closing sockets (no flushes the datat before)
  • Fixed issue with performance data units beeing incorrect:

before: B, K, M, G, ... noew: B, KB, MB, GB, ...

  • Fixed syntax errors in performance data extra ';' dropped and spaces added propperly Result now looks like so: ... |'C:\ %'=42%;10;5 'C:\'=229.66GB;39.06;19.53;0;390.62 'D:\ %'=99%;10;5 'D:\'=3.39GB;20.55;10.27;0;205.54
  • Fixed issues with caluclating netmask (also added support for spaces and tabs in the hostlist string.
Location:
branches/stable
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/AutoBuild.h

    r272 r276  
    33// change the FALSE to TRUE for autoincrement of build number 
    44#define INCREMENT_VERSION TRUE 
    5 #define FILEVER        0,3,8,78 
    6 #define PRODUCTVER     0,3,8,78 
    7 #define STRFILEVER     _T("0.3.8.78") 
    8 #define STRPRODUCTVER  _T("0.3.8.78") 
    9 #define STRPRODUCTDATE  _T("2010-06-02") 
     5#define FILEVER        0,3,8,89 
     6#define PRODUCTVER     0,3,8,89 
     7#define STRFILEVER     _T("0.3.8.89") 
     8#define STRPRODUCTVER  _T("0.3.8.89") 
     9#define STRPRODUCTDATE  _T("2010-07-28") 
    1010#endif // AUTOBUILD_H 
  • branches/stable/NSClient++-2005.sln

    r225 r276  
    268268EndProject 
    269269Global 
    270   GlobalSection(SubversionScc) = preSolution 
    271     Svn-Managed = True 
    272     Manager = AnkhSVN - Subversion Support for Visual Studio 
    273   EndGlobalSection 
    274270  GlobalSection(SolutionConfigurationPlatforms) = preSolution 
    275271    Debug|Any CPU = Debug|Any CPU 
     
    451447    {BA246C01-063A-4548-8957-32D5CC76171B}.Debug|Mixed Platforms.Build.0 = Debug|x64 
    452448    {BA246C01-063A-4548-8957-32D5CC76171B}.Debug|Win32.ActiveCfg = Debug|Win32 
    453     {BA246C01-063A-4548-8957-32D5CC76171B}.Debug|Win32.Build.0 = Debug|Win32 
    454449    {BA246C01-063A-4548-8957-32D5CC76171B}.Debug|x64.ActiveCfg = Debug|x64 
    455450    {BA246C01-063A-4548-8957-32D5CC76171B}.Debug|x64.Build.0 = Debug|x64 
     
    869864    {6F55C9BF-57F6-4A15-A058-C83A52F539EE}.Debug|Mixed Platforms.Build.0 = Debug|x64 
    870865    {6F55C9BF-57F6-4A15-A058-C83A52F539EE}.Debug|Win32.ActiveCfg = Debug|Win32 
     866    {6F55C9BF-57F6-4A15-A058-C83A52F539EE}.Debug|Win32.Build.0 = Debug|Win32 
    871867    {6F55C9BF-57F6-4A15-A058-C83A52F539EE}.Debug|x64.ActiveCfg = Debug|x64 
    872868    {6F55C9BF-57F6-4A15-A058-C83A52F539EE}.Debug|x64.Build.0 = Debug|x64 
     
    15821578    {10A0052D-542B-47AD-85C3-1A3DD45BF2ED} = {FC917E21-188A-44EE-9EF2-7C1274C2D719} 
    15831579  EndGlobalSection 
     1580  GlobalSection(SubversionScc) = preSolution 
     1581    Svn-Managed = True 
     1582    Manager = AnkhSVN - Subversion Support for Visual Studio 
     1583  EndGlobalSection 
    15841584  GlobalSection(DPCodeReviewSolutionGUID) = preSolution 
    15851585    DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000} 
  • branches/stable/changelog

    r272 r276  
    66 * Fix depend onservice LanManWorkStation (old win) 
    77 * Fix RtlStringFromGUID problem on NT4 
     8 
     92010-07-28 MickeM 
     10 * Fixed issue with NSCA server and closing sockets (no flushes the datat before) 
     11 * Fixed issue with performance data units beeing incorrect: 
     12    before: B, K, M, G, ... noew: B, KB, MB, GB, ... 
     13 * Fixed syntax errors in performance data extra ';' dropped and spaces added propperly 
     14   Result now looks like so: ... |'C:\ %'=42%;10;5 'C:\'=229.66GB;39.06;19.53;0;390.62 'D:\ %'=99%;10;5 'D:\'=3.39GB;20.55;10.27;0;205.54 
     15 * Fixed issues with caluclating netmask (also added support for spaces and tabs in the hostlist string. 
    816 
    9172010-06-02 MickeM 
     
    279287 * Rebuilt installer UI (still missing write config function) 
    280288 * Added debug entry to log filename used by debug log metrics. 
    281  * Fixed so alias will not require the allow_nasty_metachars option set under external sripts module. 
     289 * Fixed so alias will not require the allow_nasty_meta_chars option set under external sripts module. 
    282290 
    2832912009-03-02 MickeM  
  • branches/stable/include/Socket.h

    r183 r276  
    227227    virtual void close() { 
    228228      if (socket_) 
    229         closesocket(socket_); 
     229        ::closesocket(socket_); 
    230230      socket_ = NULL; 
     231    } 
     232    virtual void setLinger(int timeout) { 
     233      if (this->setsockopt(SOL_SOCKET, SO_LINGER, (const char*)&timeout, sizeof(timeout)) == SOCKET_ERROR) 
     234        throw SocketException(_T("Failed to set linger on socket: "), ::WSAGetLastError()); 
     235    } 
     236    virtual int setsockopt(int level, int optname, const char * optval, int optlen) { 
     237      return ::setsockopt(socket_, level, optname, optval, optlen); 
    231238    } 
    232239    virtual void setNonBlock() { 
     
    236243      FD_SET(socket_, &excp_); 
    237244      this->ioctlsocket(FIONBIO, &NoBlock); 
     245    } 
     246    virtual void setBlock() { 
     247      unsigned long Block = 0; 
     248      FD_SET(socket_, &read_); 
     249      FD_SET(socket_, &write_); 
     250      FD_SET(socket_, &excp_); 
     251      this->ioctlsocket(FIONBIO, &Block); 
    238252    } 
    239253    virtual bool canRead(long timeout = -1) { 
     
    751765      if (masklen > 32) 
    752766        masklen = 32; 
    753       return (~((unsigned int)0))>>(32-masklen); 
     767      return ::ntohl((0xffffffff >> (32 - masklen )) << (32 - masklen)); 
    754768    } 
    755769    void lookupList() { 
     
    771785              (*it).in_addr = ::inet_addr(strEx::wstring_to_string((*it).host).c_str()); // simpleSocket::Socket::getHostByAddrAsIN((*it).host); 
    772786            /* 
    773             std::cerr << "Added: "  
    774               + simpleSocket::Socket::inet_ntoa((*it).in_addr) 
    775               + " with mask " 
    776               + simpleSocket::Socket::inet_ntoa((*it).mask) 
    777               + " from " 
    778               + (*it).record << 
     787            std::wcerr << _T("Added: ") 
     788              << simpleSocket::Socket::inet_ntoa((*it).in_addr) 
     789              << _T(" with mask ") 
     790              << simpleSocket::Socket::inet_ntoa((*it).mask) 
     791              //<< _T("(") << (*it).mask << _T(")")  
     792              << _T(" from ") 
     793              << (*it).record << 
    779794              std::endl; 
    780795              */ 
     796               
     797               
    781798          } catch (simpleSocket::SocketException e) { 
    782799            std::wcerr << _T("Filed to lookup host: ") << e.getMessage() << std::endl; 
     
    788805    void setAllowedHosts(const std::list<std::wstring> list, bool cachedAddresses) { 
    789806      for (std::list<std::wstring>::const_iterator it = list.begin(); it != list.end(); ++it) { 
    790         allowedHosts_.push_back(host_record(*it)); 
     807        allowedHosts_.push_back(host_record(strEx::trim(*it, _T(" \t")))); 
    791808      } 
    792809      cachedAddresses_ = cachedAddresses; 
  • branches/stable/include/checkHelpers.hpp

    r268 r276  
    2424#include <strEx.h> 
    2525 
    26 #define MAKE_PERFDATA(alias, value, unit, warn, crit) _T("'") + alias + _T("'=") + value + unit + _T(";") + warn + _T(";") + crit + _T("; ") 
    27 #define MAKE_PERFDATA_EX(alias, value, unit, warn, crit, xmin, xmax) _T("'") + alias + _T("'=") + value + unit + _T(";") + warn + _T(";") + crit + _T(";") + xmin + _T(";") + xmax + _T("; ") 
     26#define MAKE_PERFDATA(alias, value, unit, warn, crit) _T("'") + alias + _T("'=") + value + unit + _T(";") + warn + _T(";") + crit  
     27#define MAKE_PERFDATA_EX(alias, value, unit, warn, crit, xmin, xmax) _T("'") + alias + _T("'=") + value + unit + _T(";") + warn + _T(";") + crit + _T(";") + xmin + _T(";") + xmax 
    2828 
    2929namespace checkHolders { 
     
    159159        tstr = getAlias() + _T(": ") + TContents::toStringShort(value); 
    160160      } 
    161       if (perfData) 
     161      if (perfData) { 
     162        if (!perf.empty()) 
     163          perf += _T(" "); 
    162164        perf += gatherPerfData(value); 
     165      } 
    163166      if (!message.empty() && !tstr.empty()) 
    164167        message += _T(", "); 
     
    744747      return  
    745748        MAKE_PERFDATA(alias + _T(" %"), THandler::print_unformated(value_p), _T("%"), THandler::print_unformated(warn_p), THandler::print_unformated(crit_p)) 
    746         +  
     749        + _T(" ") + 
    747750        MAKE_PERFDATA_EX(alias, THandler::print_perf(value.value, unit), unit, THandler::print_perf(warn_v, unit), THandler::print_perf(crit_v, unit),  
    748751          THandler::print_perf(0, unit), THandler::print_perf(value.total, unit)) 
  • branches/stable/include/config.h

    r266 r276  
    199199#define NSCA_STRLEN _T("string_length") 
    200200#define NSCA_STRLEN_DEFAULT 512 
     201#define NSCA_CHUNK _T("chunk") 
     202#define NSCA_CHUNK_DEFAULT 0 
     203 
    201204 
    202205#define C_SYSTEM_SVC_ALL_0 _T("check_all_services[SERVICE_BOOT_START]") 
  • branches/stable/include/strEx.h

    r267 r276  
    421421    double cpy = static_cast<double>(i); 
    422422    TCHAR postfix[] = _T(BKMG_RANGE); 
    423     if (unit.length() != 1) 
     423    if (unit.length() == 0) 
    424424      return itos(cpy); 
    425425    for (int i=0;i<BKMG_SIZE;i++) { 
     
    446446      idx++; 
    447447    } 
     448    if (idx > 0) 
     449      return std::wstring(1, postfix[idx]) + _T("B"); 
    448450    return std::wstring(1, postfix[idx]); 
    449451  } 
  • branches/stable/modules/CheckEventLog/CheckEventLog-2005.vcproj

    r263 r276  
    15551555        > 
    15561556        <FileConfiguration 
     1557          Name="Release|Win32" 
     1558          > 
     1559          <Tool 
     1560            Name="VCCLCompilerTool" 
     1561            UsePrecompiledHeader="0" 
     1562          /> 
     1563        </FileConfiguration> 
     1564        <FileConfiguration 
     1565          Name="Release|x64" 
     1566          > 
     1567          <Tool 
     1568            Name="VCCLCompilerTool" 
     1569            UsePrecompiledHeader="0" 
     1570          /> 
     1571        </FileConfiguration> 
     1572        <FileConfiguration 
     1573          Name="Debug|Win32" 
     1574          > 
     1575          <Tool 
     1576            Name="VCCLCompilerTool" 
     1577            UsePrecompiledHeader="0" 
     1578          /> 
     1579        </FileConfiguration> 
     1580        <FileConfiguration 
    15571581          Name="Debug|x64" 
     1582          > 
     1583          <Tool 
     1584            Name="VCCLCompilerTool" 
     1585            UsePrecompiledHeader="0" 
     1586          /> 
     1587        </FileConfiguration> 
     1588        <FileConfiguration 
     1589          Name="Distribution|Win32" 
     1590          > 
     1591          <Tool 
     1592            Name="VCCLCompilerTool" 
     1593            UsePrecompiledHeader="0" 
     1594          /> 
     1595        </FileConfiguration> 
     1596        <FileConfiguration 
     1597          Name="Distribution|x64" 
     1598          > 
     1599          <Tool 
     1600            Name="VCCLCompilerTool" 
     1601            UsePrecompiledHeader="0" 
     1602          /> 
     1603        </FileConfiguration> 
     1604        <FileConfiguration 
     1605          Name="Nightly|Win32" 
     1606          > 
     1607          <Tool 
     1608            Name="VCCLCompilerTool" 
     1609            UsePrecompiledHeader="0" 
     1610          /> 
     1611        </FileConfiguration> 
     1612        <FileConfiguration 
     1613          Name="Nightly|x64" 
     1614          > 
     1615          <Tool 
     1616            Name="VCCLCompilerTool" 
     1617            UsePrecompiledHeader="0" 
     1618          /> 
     1619        </FileConfiguration> 
     1620        <FileConfiguration 
     1621          Name="Debug-MemCheck|Win32" 
     1622          > 
     1623          <Tool 
     1624            Name="VCCLCompilerTool" 
     1625            UsePrecompiledHeader="0" 
     1626          /> 
     1627        </FileConfiguration> 
     1628        <FileConfiguration 
     1629          Name="Debug-MemCheck|x64" 
     1630          > 
     1631          <Tool 
     1632            Name="VCCLCompilerTool" 
     1633            UsePrecompiledHeader="0" 
     1634          /> 
     1635        </FileConfiguration> 
     1636        <FileConfiguration 
     1637          Name="OP5|Win32" 
     1638          > 
     1639          <Tool 
     1640            Name="VCCLCompilerTool" 
     1641            UsePrecompiledHeader="0" 
     1642          /> 
     1643        </FileConfiguration> 
     1644        <FileConfiguration 
     1645          Name="OP5|x64" 
    15581646          > 
    15591647          <Tool 
     
    15711659        > 
    15721660        <FileConfiguration 
     1661          Name="Release|Win32" 
     1662          > 
     1663          <Tool 
     1664            Name="VCCLCompilerTool" 
     1665            UsePrecompiledHeader="0" 
     1666          /> 
     1667        </FileConfiguration> 
     1668        <FileConfiguration 
     1669          Name="Release|x64" 
     1670          > 
     1671          <Tool 
     1672            Name="VCCLCompilerTool" 
     1673            UsePrecompiledHeader="0" 
     1674          /> 
     1675        </FileConfiguration> 
     1676        <FileConfiguration 
     1677          Name="Debug|Win32" 
     1678          > 
     1679          <Tool 
     1680            Name="VCCLCompilerTool" 
     1681            UsePrecompiledHeader="0" 
     1682          /> 
     1683        </FileConfiguration> 
     1684        <FileConfiguration 
    15731685          Name="Debug|x64" 
     1686          > 
     1687          <Tool 
     1688            Name="VCCLCompilerTool" 
     1689            UsePrecompiledHeader="0" 
     1690          /> 
     1691        </FileConfiguration> 
     1692        <FileConfiguration 
     1693          Name="Distribution|Win32" 
     1694          > 
     1695          <Tool 
     1696            Name="VCCLCompilerTool" 
     1697            UsePrecompiledHeader="0" 
     1698          /> 
     1699        </FileConfiguration> 
     1700        <FileConfiguration 
     1701          Name="Distribution|x64" 
     1702          > 
     1703          <Tool 
     1704            Name="VCCLCompilerTool" 
     1705            UsePrecompiledHeader="0" 
     1706          /> 
     1707        </FileConfiguration> 
     1708        <FileConfiguration 
     1709          Name="Nightly|Win32" 
     1710          > 
     1711          <Tool 
     1712            Name="VCCLCompilerTool" 
     1713            UsePrecompiledHeader="0" 
     1714          /> 
     1715        </FileConfiguration> 
     1716        <FileConfiguration 
     1717          Name="Nightly|x64" 
     1718          > 
     1719          <Tool 
     1720            Name="VCCLCompilerTool" 
     1721            UsePrecompiledHeader="0" 
     1722          /> 
     1723        </FileConfiguration> 
     1724        <FileConfiguration 
     1725          Name="Debug-MemCheck|Win32" 
     1726          > 
     1727          <Tool 
     1728            Name="VCCLCompilerTool" 
     1729            UsePrecompiledHeader="0" 
     1730          /> 
     1731        </FileConfiguration> 
     1732        <FileConfiguration 
     1733          Name="Debug-MemCheck|x64" 
     1734          > 
     1735          <Tool 
     1736            Name="VCCLCompilerTool" 
     1737            UsePrecompiledHeader="0" 
     1738          /> 
     1739        </FileConfiguration> 
     1740        <FileConfiguration 
     1741          Name="OP5|Win32" 
     1742          > 
     1743          <Tool 
     1744            Name="VCCLCompilerTool" 
     1745            UsePrecompiledHeader="0" 
     1746          /> 
     1747        </FileConfiguration> 
     1748        <FileConfiguration 
     1749          Name="OP5|x64" 
    15741750          > 
    15751751          <Tool 
     
    19772153      </File> 
    19782154      <File 
    1979         RelativePath=".\test.cpp" 
    1980         > 
    1981       </File> 
    1982       <File 
    19832155        RelativePath="..\..\include\utils.cpp" 
    19842156        > 
     
    21412313        > 
    21422314        <FileConfiguration 
     2315          Name="Release|Win32" 
     2316          > 
     2317          <Tool 
     2318            Name="VCCLCompilerTool" 
     2319            UsePrecompiledHeader="0" 
     2320          /> 
     2321        </FileConfiguration> 
     2322        <FileConfiguration 
     2323          Name="Release|x64" 
     2324          > 
     2325          <Tool 
     2326            Name="VCCLCompilerTool" 
     2327            UsePrecompiledHeader="0" 
     2328          /> 
     2329        </FileConfiguration> 
     2330        <FileConfiguration 
     2331          Name="Debug|Win32" 
     2332          > 
     2333          <Tool 
     2334            Name="VCCLCompilerTool" 
     2335            UsePrecompiledHeader="0" 
     2336          /> 
     2337        </FileConfiguration> 
     2338        <FileConfiguration 
    21432339          Name="Debug|x64" 
     2340          > 
     2341          <Tool 
     2342            Name="VCCLCompilerTool" 
     2343            UsePrecompiledHeader="0" 
     2344          /> 
     2345        </FileConfiguration> 
     2346        <FileConfiguration 
     2347          Name="Distribution|Win32" 
     2348          > 
     2349          <Tool 
     2350            Name="VCCLCompilerTool" 
     2351            UsePrecompiledHeader="0" 
     2352          /> 
     2353        </FileConfiguration> 
     2354        <FileConfiguration 
     2355          Name="Distribution|x64" 
     2356          > 
     2357          <Tool 
     2358            Name="VCCLCompilerTool" 
     2359            UsePrecompiledHeader="0" 
     2360          /> 
     2361        </FileConfiguration> 
     2362        <FileConfiguration 
     2363          Name="Nightly|Win32" 
     2364          > 
     2365          <Tool 
     2366            Name="VCCLCompilerTool" 
     2367            UsePrecompiledHeader="0" 
     2368          /> 
     2369        </FileConfiguration> 
     2370        <FileConfiguration 
     2371          Name="Nightly|x64" 
     2372          > 
     2373          <Tool 
     2374            Name="VCCLCompilerTool" 
     2375            UsePrecompiledHeader="0" 
     2376          /> 
     2377        </FileConfiguration> 
     2378        <FileConfiguration 
     2379          Name="Debug-MemCheck|Win32" 
     2380          > 
     2381          <Tool 
     2382            Name="VCCLCompilerTool" 
     2383            UsePrecompiledHeader="0" 
     2384          /> 
     2385        </FileConfiguration> 
     2386        <FileConfiguration 
     2387          Name="Debug-MemCheck|x64" 
     2388          > 
     2389          <Tool 
     2390            Name="VCCLCompilerTool" 
     2391            UsePrecompiledHeader="0" 
     2392          /> 
     2393        </FileConfiguration> 
     2394        <FileConfiguration 
     2395          Name="OP5|Win32" 
     2396          > 
     2397          <Tool 
     2398            Name="VCCLCompilerTool" 
     2399            UsePrecompiledHeader="0" 
     2400          /> 
     2401        </FileConfiguration> 
     2402        <FileConfiguration 
     2403          Name="OP5|x64" 
    21442404          > 
    21452405          <Tool 
  • branches/stable/modules/NSCAAgent/NSCAThread.cpp

    r261 r276  
    8282  payload_length_ = NSCModuleHelper::getSettingsInt(NSCA_AGENT_SECTION_TITLE, NSCA_STRLEN, NSCA_STRLEN_DEFAULT); 
    8383  read_timeout_ = NSCModuleHelper::getSettingsInt(NSCA_AGENT_SECTION_TITLE, NSCA_READ_TIMEOUT, NSCA_READ_TIMEOUT_DEFAULT); 
     84  resultInterval = NSCModuleHelper::getSettingsInt(NSCA_AGENT_SECTION_TITLE, NSCA_CHUNK, NSCA_CHUNK_DEFAULT); 
    8485  std::wstring report = NSCModuleHelper::getSettingsString(NSCA_AGENT_SECTION_TITLE, NSCA_REPORT, NSCA_REPORT_DEFAULT); 
    8586  report_ = parse_report_string(report); 
     
    222223        if (!results.empty()) { 
    223224          try { 
    224             send(results); 
     225            if (resultInterval != 0) { 
     226              while (!results.empty()) { 
     227                std::list<Command::Result> chunk; 
     228                for (int i=0;i<resultInterval&&!results.empty();++i) { 
     229                  chunk.push_back(results.front()); 
     230                  results.pop_front(); 
     231                } 
     232                send(chunk); 
     233              } 
     234            } else  
     235              send(results); 
    225236          } catch (...) { 
    226237            NSC_LOG_ERROR_STD(_T("Unknown exception when sending commands to server...")); 
     
    314325      return; 
    315326    } 
     327    socket.setBlock(); 
    316328 
    317329    try { 
    318330      for (std::list<Command::Result>::const_iterator cit = results.begin(); cit != results.end(); ++cit) { 
    319331        try { 
    320           socket.send((*cit).getBuffer(crypt_inst, timeDelta_, payload_length_)); 
     332          socket.sendAll((*cit).getBuffer(crypt_inst, timeDelta_, payload_length_)); 
    321333        } catch (NSCAPacket::NSCAException &e) { 
    322           NSC_LOG_ERROR_STD(_T("Failed to make command: ") + e.getMessage() ); 
     334          NSC_LOG_ERROR_STD(_T("Failed to build command: ") + e.getMessage() ); 
     335        } catch (simpleSocket::SocketException &e) { 
     336          NSC_LOG_ERROR_STD(_T("Failed to send command: ") + e.getMessage() ); 
    323337        } 
    324338      } 
     
    330344      return; 
    331345    } 
     346    socket.setLinger(30); 
    332347    socket.close(); 
    333348  } catch (simpleSocket::SocketException &e) { 
  • branches/stable/modules/NSCAAgent/NSCAThread.h

    r188 r276  
    237237  int report_; 
    238238  unsigned int read_timeout_; 
     239  int resultInterval; 
    239240 
    240241public: 
Note: See TracChangeset for help on using the changeset viewer.