Changeset 1cc8566 in nscp


Ignore:
Timestamp:
05/19/12 11:54:59 (13 months ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2
Children:
81dbd0c
Parents:
c630d09
Message:
  • Fixed issue with checking rate counters (such as disk idle %)
  • Fixed (I think) the negative denominator counter issue
  • Fixed so indexes are only converted on
    123
    and not also
    hello 123 world
    which caused some issues with numeric counter variables.
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • changelog

    rc630d09 r1cc8566  
    44 * Fixa dependonservice LanManWorkStation (old win) 
    55 * Fix RtlStringFromGUID problem on NT4 
     6 
     72012-05-19 MickeM 
     8 * Fixed issue with checking rate counters (such as disk idle %) 
     9 * Fixed (I think) the negative denominator counter issue 
     10 * Fixed so indexes are only converted on \\123\\ and not also \\123 hello world\\ which caused some issues with numeric counter variables. 
    611 
    7122012-05-13 MickeM 
  • files/old-settings.map

    r682ccd2 r1cc8566  
    3636 
    3737log/file=/settings/log/file name 
    38 log/date_mask=/settings/log/date mask 
     38log/date_mask=/settings/log/date format 
    3939# log/debug=/settings/log/level 
    4040# log/debug 
  • include/pdh/counters.hpp

    rd6c3131 r1cc8566  
    105105      hCounter_ = NULL; 
    106106    } 
    107     void collect() { 
     107    PDH::PDHError collect() { 
     108      PDH::PDHError status; 
    108109      if (hCounter_ == NULL) 
    109         return; 
     110        return status; 
    110111      if (!listener_) 
    111         return; 
     112        return status; 
    112113      DWORD format = listener_->getFormat(); 
    113       PDH::PDHError status = PDH::PDHFactory::get_impl()->PdhGetFormattedCounterValue(hCounter_, format, NULL, &data_); 
    114       if (status.is_negative_denominator()) { 
    115         Sleep(500); 
    116         status = PDH::PDHFactory::get_impl()->PdhGetFormattedCounterValue(hCounter_, format, NULL, &data_); 
     114      status = PDH::PDHFactory::get_impl()->PdhGetFormattedCounterValue(hCounter_, format, NULL, &data_); 
     115      if (!status.is_error()) { 
     116        listener_->collect(*this); 
    117117      } 
    118       if (status.is_error()) { 
    119         throw PDHException(name_, _T("PdhGetFormattedCounterValue failed {format: ") + strEx::itos(format) + _T("}"), status); 
    120       } 
    121       listener_->collect(*this); 
     118      return status; 
    122119    } 
    123120    double getDoubleValue() const { 
  • include/pdh/query.hpp

    rd6c3131 r1cc8566  
    100100      collect(); 
    101101      for (CounterList::iterator it = counters_.begin(); it != counters_.end(); it++) { 
    102         (*it)->collect(); 
     102        PDH::PDHError status = (*it)->collect(); 
     103        if (status.is_negative_denominator()) { 
     104          Sleep(500); 
     105          collect(); 
     106          status = (*it)->collect(); 
     107        } 
     108        if (status.is_error()) { 
     109          throw PDHException(_T("Failed to poll counter: "), status); 
     110        } 
    103111      } 
    104112    } 
  • include/pdh/resolver.hpp

    rf0e6036 r1cc8566  
    7676      return status.is_ok(); 
    7777    } 
     78    static bool is_speacial_char(wchar_t c) { 
     79      return c == L'\\' || c == L'(' || c == L')'; 
     80    } 
    7881 
    7982    static bool PDHResolver::expand_index(std::wstring &counter) { 
     
    8891        if (p2 <= p1) 
    8992          return false; 
     93        if (p1 > 0) { 
     94          if (!is_speacial_char(counter[p1-1])) { 
     95            pos = p2; 
     96            continue; 
     97          } 
     98        } 
     99        if (p2 < counter.size()) { 
     100          if (!is_speacial_char(counter[p2+1])) { 
     101            pos = p2; 
     102            continue; 
     103          } 
     104        } 
    90105        unsigned int index = strEx::stoi(counter.substr(p1, p2-p1)); 
    91106        std::wstring sindex = PDH::PDHResolver::lookupIndex(index); 
  • modules/CheckExternalScripts/commands.hpp

    rc630d09 r1cc8566  
    8989        strEx::parse_command(str, command, arguments); 
    9090      } catch (const std::exception &e) { 
    91         NSC_LOG_ERROR(_T("Failed to parse arguments for command '") + alias + _T("', using old split string method: ") + utf8::to_unicode(e.what()) + _T(": ") + str); 
     91        NSC_LOG_MESSAGE(_T("Failed to parse arguments for command '") + alias + _T("', using old split string method: ") + utf8::to_unicode(e.what()) + _T(": ") + str); 
    9292        strEx::splitList list = strEx::splitEx(str, _T(" ")); 
    9393        if (list.size() > 0) { 
  • modules/CheckSystem/CheckSystem.cpp

    rd6c3131 r1cc8566  
    13461346        Sleep(1000); 
    13471347      } 
    1348       pdh.collect(); 
    13491348      pdh.gatherData(); 
    13501349      pdh.close(); 
Note: See TracChangeset for help on using the changeset viewer.