lists.checkmk.com
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
List overview
Download
Checkmk git commits
August 2017
----- 2024 -----
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
checkmk-commits@lists.checkmk.com
10 participants
201 discussions
Start a n
N
ew thread
apc_rackpdu_power: Simplify scan function
by Konstantin Büttner
Module: check_mk Branch: master Commit: 9f6c0215ce4c83b8ef7af09fcaf50ae8bb36aee9 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9f6c0215ce4c83…
Author: Konstantin Büttner <kb(a)mathias-kettner.de> Date: Fri Aug 4 14:39:33 2017 +0200 apc_rackpdu_power: Simplify scan function Let the discovery function handle the enterprises OIDs Change-Id: Iedad8241403e6259d9687518988ef1957db240f2 --- checks/apc_rackpdu_power | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/checks/apc_rackpdu_power b/checks/apc_rackpdu_power index 99e2be1..7ea0368 100644 --- a/checks/apc_rackpdu_power +++ b/checks/apc_rackpdu_power @@ -99,8 +99,7 @@ check_info["apc_rackpdu_power"] = { '2', # PowerNet-MIB::rPDULoadStatusLoad '3', # PowerNet-MIB::rPDULoadStatusLoadState ])], - 'snmp_scan_function' : lambda oid: oid(".1.3.6.1.2.1.1.1.0").lower().startswith("apc web/snmp") and \ - oid(".1.3.6.1.4.1.318.1.1.12.1.1.0"), + 'snmp_scan_function' : lambda oid: oid(".1.3.6.1.2.1.1.1.0").lower().startswith("apc web/snmp"), 'group' : 'el_inphase', 'includes' : [ 'elphase.include' ], }
7 years, 2 months
1
0
0
0
5087 FIX brocade_fcport: Fixed conversion of BB credits
by Simon Betz
Module: check_mk Branch: master Commit: 7834fe94f85667ecfb7a3617464f3915063ce195 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7834fe94f85667…
Author: Simon Betz <si(a)mathias-kettner.de> Date: Fri Aug 4 14:33:53 2017 +0200 5087 FIX brocade_fcport: Fixed conversion of BB credits Change-Id: I0da136b417ca2048c1f00835f198e7d3024ce7d4 --- .werks/5087 | 11 +++++++++++ checks/brocade_fcport | 10 +++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.werks/5087 b/.werks/5087 new file mode 100644 index 0000000..0a61a80 --- /dev/null +++ b/.werks/5087 @@ -0,0 +1,11 @@ +Title: brocade_fcport: Fixed conversion of BB credits +Level: 1 +Component: checks +Class: fix +Compatible: compat +Edition: cre +State: unknown +Version: 1.5.0i1 +Date: 1501849884 + + diff --git a/checks/brocade_fcport b/checks/brocade_fcport index bb7e604..a9a9a9f 100644 --- a/checks/brocade_fcport +++ b/checks/brocade_fcport @@ -145,19 +145,20 @@ def parse_brocade_fcport(info): if_table = [x + ["", x[-2]] for x in if_info] parsed = [] + for index, phystate, opstate, admstate, txwords, rxwords, txframes, \ rxframes, notxcredits, rxcrcs, rxencinframes, rxencoutframes, \ c3discards, brocade_speed, portname, porttype, ifspeed in if_table: # Since FW v8.0.1b [rx/tx]words are no longer available - bbcredits = 0 + bbcredits = None if txwords == "" or rxwords == "": fcmgmt_portstats = [] - for oidend, tx_elements, rx_elements, bbcredits in if64_info: + for oidend, tx_elements, rx_elements, bbcredits_64 in if64_info: if index == int(oidend.split(".")[-1]): fcmgmt_portstats = [ binstring_to_int(tx_elements), binstring_to_int(rx_elements), - binstring_to_int(bbcredits) ] + binstring_to_int(bbcredits_64) ] break if fcmgmt_portstats: txwords = fcmgmt_portstats[0] @@ -196,7 +197,6 @@ def parse_brocade_fcport(info): }) except: # missing vital data. Skipping this port continue - return parsed @@ -391,7 +391,7 @@ def check_brocade_fcport(item, params, parsed): summarystate = 2 output.append("%s: %s%s" % (state_info, state_map[dev_state], errorflag)) - if bbcredits: + if bbcredits is not None: bbcredit_rate = get_rate("brocade_fcport.bbcredit.%s" % (item), this_time, bbcredits) perfdata.append( ("fc_bbcredit_zero", bbcredit_rate) )
7 years, 2 months
1
0
0
0
4548 Added new checks for liebert devices
by Marcel Arentz
Module: check_mk Branch: master Commit: d9d4dd93b093ab78d895cdcf005297c513df7f61 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d9d4dd93b093ab…
Author: Marcel Arentz <ma(a)mathias-kettner.de> Date: Fri Mar 24 17:33:12 2017 +0100 4548 Added new checks for liebert devices Including Checks for temperatures, fans, humidity, system events, pressure, fluids, etc. Please the manpage of the checkplugins for details. Checkplugins added in this werk: liebert_chilled_water liebert_cooling_position liebert_fans_condenser liebert_maintenance liebert_system liebert_temp_fluid liebert_compressor liebert_cooling_status liebert_humidity_air liebert_pump liebert_system_events liebert_temp_general liebert_cooling liebert_fans liebert.include liebert_reheating liebert_temp_air Change-Id: I68dc519e05d0fd18c7e16567b545498687739e43 --- .werks/4548 | 31 +++++++++++ checkman/liebert_chilled_water | 18 +++++++ checkman/liebert_compressor | 18 +++++++ checkman/liebert_cooling | 16 ++++++ checkman/liebert_cooling_position | 17 ++++++ checkman/liebert_cooling_status | 16 ++++++ checkman/liebert_fans | 16 ++++++ checkman/liebert_fans_condenser | 16 ++++++ checkman/liebert_humidity | 16 ++++++ checkman/liebert_maintenance | 14 +++++ checkman/liebert_pump | 16 ++++++ checkman/liebert_reheating | 12 +++++ checkman/liebert_system | 17 ++++++ checkman/liebert_system_events | 14 +++++ checkman/liebert_temp_air | 16 ++++++ checkman/liebert_temp_fluid | 17 ++++++ checkman/liebert_temp_general | 16 ++++++ checks/liebert.include | 110 ++++++++++++++++++++++++++++++++++++++ checks/liebert_chilled_water | 63 ++++++++++++++++++++++ checks/liebert_compressor | 83 ++++++++++++++++++++++++++++ checks/liebert_cooling | 71 ++++++++++++++++++++++++ checks/liebert_cooling_position | 69 ++++++++++++++++++++++++ checks/liebert_cooling_status | 51 ++++++++++++++++++ checks/liebert_fans | 78 +++++++++++++++++++++++++++ checks/liebert_fans_condenser | 74 +++++++++++++++++++++++++ checks/liebert_humidity_air | 93 ++++++++++++++++++++++++++++++++ checks/liebert_maintenance | 76 ++++++++++++++++++++++++++ checks/liebert_pump | 81 ++++++++++++++++++++++++++++ checks/liebert_reheating | 70 ++++++++++++++++++++++++ checks/liebert_system | 68 +++++++++++++++++++++++ checks/liebert_system_events | 67 +++++++++++++++++++++++ checks/liebert_temp_air | 74 +++++++++++++++++++++++++ checks/liebert_temp_fluid | 104 +++++++++++++++++++++++++++++++++++ checks/liebert_temp_general | 88 ++++++++++++++++++++++++++++++ 34 files changed, 1606 insertions(+) Diff:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=d9d4dd93b0…
7 years, 2 months
1
0
0
0
Once again: Make ownership explicit.
by Sven Panne
Module: check_mk Branch: master Commit: 319ea123382de175ca0d70d63a6a07a894db9dd7 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=319ea123382de1…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Fri Aug 4 11:53:22 2017 +0200 Once again: Make ownership explicit. This time: Logfile instances are owned by LogCache instances. Change-Id: I0d82174d9f9882da0ec65b0d9da9033f2f87573b --- livestatus/src/LogCache.cc | 62 +++++++++++++++++--------------------- livestatus/src/LogCache.h | 10 +++--- livestatus/src/Logfile.cc | 2 -- livestatus/src/Logfile.h | 3 +- livestatus/src/TableLog.cc | 7 ++--- livestatus/src/TableStateHistory.h | 8 +++-- 6 files changed, 42 insertions(+), 50 deletions(-) diff --git a/livestatus/src/LogCache.cc b/livestatus/src/LogCache.cc index e4f653f..e12d8f7 100644 --- a/livestatus/src/LogCache.cc +++ b/livestatus/src/LogCache.cc @@ -30,6 +30,7 @@ #include "Logger.h" #include "MonitoringCore.h" +using std::make_unique; using std::string; using std::chrono::system_clock; @@ -61,8 +62,6 @@ void LogCache::setMaxCachedMessages(unsigned long m) { } #endif -LogCache::~LogCache() { forgetLogfiles(); } - bool LogCache::logCachePreChecks() { if (_logfiles.empty() || _mc->last_logfile_rotation() > _last_index_update) { @@ -77,9 +76,6 @@ bool LogCache::logCachePreChecks() { void LogCache::forgetLogfiles() { Notice(logger()) << "flushing log file index"; - for (auto &logfile : _logfiles) { - delete logfile.second; - } _logfiles.clear(); num_cached_log_messages = 0; } @@ -102,21 +98,20 @@ void LogCache::updateLogfileIndex() { } void LogCache::scanLogfile(const fs::path &path, bool watch) { - auto logfile = new Logfile(_mc, path, watch); + auto logfile = make_unique<Logfile>(_mc, path, watch); time_t since = logfile->since(); - if (since != 0) { - // make sure that no entry with that 'since' is existing yet. - // under normal circumstances this never happens. But the - // user might have copied files around. - if (_logfiles.find(since) == _logfiles.end()) { - _logfiles.emplace(since, logfile); - } else { - Warning(logger()) << "ignoring duplicate log file " << path; - delete logfile; - } - } else { - delete logfile; + if (since == 0) { + return; } + // make sure that no entry with that 'since' is existing yet. Under normal + // circumstances this never happens, but the user might have copied files + // around. + if (_logfiles.find(since) != _logfiles.end()) { + Warning(logger()) << "ignoring duplicate log file " << path; + return; + } + + _logfiles.emplace(since, std::move(logfile)); } /* This method is called each time a log message is loaded @@ -147,16 +142,15 @@ void LogCache::handleNewMessage(Logfile *logfile, time_t /*unused*/, // [1] Begin by deleting old logfiles // Begin deleting with the oldest logfile available - _logfiles_t::iterator it; + logfiles_t::iterator it; for (it = _logfiles.begin(); it != _logfiles.end(); ++it) { - Logfile *log = it->second; - if (log == logfile) { + if (it->second.get() == logfile) { // Do not touch the logfile the Query is currently accessing break; } - if (log->numEntries() > 0) { - num_cached_log_messages -= log->numEntries(); - log->flush(); // drop all messages of that file + if (it->second->numEntries() > 0) { + num_cached_log_messages -= it->second->numEntries(); + it->second->flush(); // drop all messages of that file if (static_cast<unsigned long>(num_cached_log_messages) <= _max_cached_messages) { // remember the number of log messages in cache when @@ -176,13 +170,12 @@ void LogCache::handleNewMessage(Logfile *logfile, time_t /*unused*/, // Starting from the current logfile (wo broke out of the // previous loop just when 'it' pointed to that) for (; it != _logfiles.end(); ++it) { - Logfile *log = it->second; - if (log->numEntries() > 0 && (log->classesRead() & ~logclasses) != 0) { + if (it->second->numEntries() > 0 && + (it->second->classesRead() & ~logclasses) != 0) { Debug(logger()) << "freeing classes " << ~logclasses << " of file " - << log->path(); - long freed = log->freeMessages(~logclasses); // flush only messages - // not needed for - // current query + << it->second->path(); + // flush only messages not needed for current query + long freed = it->second->freeMessages(~logclasses); num_cached_log_messages -= freed; if (static_cast<unsigned long>(num_cached_log_messages) <= _max_cached_messages) { @@ -197,12 +190,11 @@ void LogCache::handleNewMessage(Logfile *logfile, time_t /*unused*/, // flushing logfiles from the oldest to the newest starting // at the file just after (i.e. newer than) the current logfile for (it = ++queryit; it != _logfiles.end(); ++it) { - Logfile *log = it->second; - if (log->numEntries() > 0) { - Debug(logger()) << "flush newer log, " << log->numEntries() + if (it->second->numEntries() > 0) { + Debug(logger()) << "flush newer log, " << it->second->numEntries() << " number of entries"; - num_cached_log_messages -= log->numEntries(); - log->flush(); + num_cached_log_messages -= it->second->numEntries(); + it->second->flush(); if (static_cast<unsigned long>(num_cached_log_messages) <= _max_cached_messages) { _num_at_last_check = num_cached_log_messages; diff --git a/livestatus/src/LogCache.h b/livestatus/src/LogCache.h index d1363ca..546a132 100644 --- a/livestatus/src/LogCache.h +++ b/livestatus/src/LogCache.h @@ -29,6 +29,7 @@ #include <chrono> #include <ctime> #include <map> +#include <memory> #include <mutex> #include "FileSystem.h" class Column; @@ -36,19 +37,18 @@ class Logfile; class Logger; class MonitoringCore; -typedef std::map<time_t, Logfile *> _logfiles_t; +using logfiles_t = std::map<time_t, std::unique_ptr<Logfile>>; class LogCache { MonitoringCore *_mc; unsigned long _max_cached_messages; unsigned long _num_at_last_check; - _logfiles_t _logfiles; + logfiles_t _logfiles; public: std::mutex _lock; LogCache(MonitoringCore *mc, unsigned long max_cached_messages); - ~LogCache(); #ifdef CMC void setMaxCachedMessages(unsigned long m); #endif @@ -60,7 +60,7 @@ public: unsigned logclasses); Column *column( const char *colname); // override in order to handle current_ - _logfiles_t *logfiles() { return &_logfiles; }; + logfiles_t *logfiles() { return &_logfiles; }; void forgetLogfiles(); void updateLogfileIndex(); @@ -68,7 +68,7 @@ public: private: void scanLogfile(const fs::path &path, bool watch); - _logfiles_t::iterator findLogfileStartingBefore(time_t); + logfiles_t::iterator findLogfileStartingBefore(time_t); Logger *logger() const; }; diff --git a/livestatus/src/Logfile.cc b/livestatus/src/Logfile.cc index 84c8e65..83b59d6 100644 --- a/livestatus/src/Logfile.cc +++ b/livestatus/src/Logfile.cc @@ -87,8 +87,6 @@ Logfile::Logfile(MonitoringCore *mc, fs::path path, bool watch) _since = atoi(line + 1); } -Logfile::~Logfile() { flush(); } - void Logfile::flush() { _entries.clear(); _logclasses_read = 0; diff --git a/livestatus/src/Logfile.h b/livestatus/src/Logfile.h index 2099f15..83631f7 100644 --- a/livestatus/src/Logfile.h +++ b/livestatus/src/Logfile.h @@ -33,8 +33,8 @@ #include <memory> #include <string> #include "FileSystem.h" +#include "LogEntry.h" // IWYU pragma: keep class LogCache; -class LogEntry; class Logger; class MonitoringCore; class Query; @@ -63,7 +63,6 @@ private: public: Logfile(MonitoringCore *mc, fs::path path, bool watch); - ~Logfile(); std::string path() { return _path; } #ifdef CMC diff --git a/livestatus/src/TableLog.cc b/livestatus/src/TableLog.cc index bf320a3..e9787e9 100644 --- a/livestatus/src/TableLog.cc +++ b/livestatus/src/TableLog.cc @@ -155,7 +155,7 @@ void TableLog::answerQuery(Query *query) { the Limit: header produces more reasonable results. */ /* NEW CODE - NEWEST FIRST */ - _logfiles_t::iterator it; + logfiles_t::iterator it; it = _log_cache->logfiles()->end(); // it now points beyond last log file --it; // switch to last logfile (we have at least one) @@ -171,9 +171,8 @@ void TableLog::answerQuery(Query *query) { } while (true) { - Logfile *log = it->second; - if (!log->answerQueryReverse(query, _log_cache, since, until, - classmask)) { + if (!it->second->answerQueryReverse(query, _log_cache, since, until, + classmask)) { break; // end of time range found } if (it == _log_cache->logfiles()->begin()) { diff --git a/livestatus/src/TableStateHistory.h b/livestatus/src/TableStateHistory.h index 5e5dd8d..7ff4f74 100644 --- a/livestatus/src/TableStateHistory.h +++ b/livestatus/src/TableStateHistory.h @@ -27,12 +27,16 @@ #include "config.h" // IWYU pragma: keep #include <map> -#include <memory> // IWYU pragma: keep +#include <memory> #include <string> #include "LogCache.h" #include "Logfile.h" #include "Table.h" +#ifdef CMC +#include "cmc.h" +#else #include "contact_fwd.h" +#endif class Column; class HostServiceState; class LogEntry; @@ -65,7 +69,7 @@ private: std::map<std::string, int> _notification_periods; // Helper functions to traverse through logfiles - _logfiles_t::iterator _it_logs; + logfiles_t::iterator _it_logs; logfile_entries_t *_entries; logfile_entries_t::iterator _it_entries;
7 years, 2 months
1
0
0
0
Fixed gude_powerbanks parse function again
by Simon Betz
Module: check_mk Branch: master Commit: b0b7f66b4a4b4d8ea5c087bbfe18ffbc711101a0 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b0b7f66b4a4b4d…
Author: Simon Betz <si(a)mathias-kettner.de> Date: Fri Aug 4 12:30:36 2017 +0200 Fixed gude_powerbanks parse function again Change-Id: I169aad08c9dbeb29e2e2475295b33b91a316c7fc --- checks/gude_powerbanks | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/checks/gude_powerbanks b/checks/gude_powerbanks index 0a7372b..3ac5c29 100644 --- a/checks/gude_powerbanks +++ b/checks/gude_powerbanks @@ -49,7 +49,7 @@ def parse_gude_powerbanks(info): ports = dict(info[0]) parsed = {} - for oid_idx, device_state, energy_str, active_power_str, \ + for oid_idx, dev_state, energy_str, active_power_str, \ current_str, volt_str, freq_str, appower_str in info[1]: oid, idx = oid_idx.split(".") @@ -57,7 +57,7 @@ def parse_gude_powerbanks(info): if oid in ["19"]: device_state = map_port_states[ports[oid_idx]] if oid in ["38"]: - device_state = map_channel_states[device_state] + device_state = map_channel_states[dev_state] if device_state is None: continue
7 years, 2 months
1
0
0
0
5083 FIX oracle_locks: Do not discover if data is incomplete
by Simon Betz
Module: check_mk Branch: master Commit: bedf0963deb83e64a438112fea25b4da09203298 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bedf0963deb83e…
Author: Simon Betz <si(a)mathias-kettner.de> Date: Fri Aug 4 12:19:41 2017 +0200 5083 FIX oracle_locks: Do not discover if data is incomplete Change-Id: I8cb90c07d81af7c329e4cf7e267758247fba7a0b --- .werks/5083 | 14 ++++++++++++++ checks/oracle_locks | 5 +++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.werks/5083 b/.werks/5083 new file mode 100644 index 0000000..0759ed6 --- /dev/null +++ b/.werks/5083 @@ -0,0 +1,14 @@ +Title: oracle_locks: Do not discover if data is incomplete +Level: 1 +Component: checks +Class: fix +Compatible: compat +Edition: cre +State: unknown +Version: 1.5.0i1 +Date: 1501841718 + +One error line may look like +Couldnt find /PATH/TO/sqlnet.ora +which was inventorize as an item and causes +an IndexError during check period. diff --git a/checks/oracle_locks b/checks/oracle_locks index 549f2dc..4463187 100644 --- a/checks/oracle_locks +++ b/checks/oracle_locks @@ -33,8 +33,10 @@ factory_settings["oracle_locks_defaults"] = { "levels" : (1800, 3600), } + def inventory_oracle_locks(info): - return [ (line[0], {}) for line in info ] + return [(line[0], {}) for line in info if len(line) >= 10] + def check_oracle_locks(item, params, info): lockcount = 0 @@ -43,7 +45,6 @@ def check_oracle_locks(item, params, info): for line in info: warn, crit = params["levels"] - if line[0] == item and line[1] != '': err = oracle_handle_ora_errors(line) if err == False:
7 years, 2 months
1
0
0
0
Made ownership explicit.
by Sven Panne
Module: check_mk Branch: master Commit: b1bc76d996917e8af9ff72657bd9b1f3543655fd URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b1bc76d996917e…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Fri Aug 4 10:42:39 2017 +0200 Made ownership explicit. By using std::unique_ptr instead of a naked pointer, we make it blindingly obvious that the LogEntry instances are owned by their corresponding LogFile instance. This removes a few fragile 'delete's, too. Change-Id: I36d7e14e3731d937a24dac8d24a7970e132cdc91 --- livestatus/src/Logfile.cc | 41 +++++++++++++++---------------------- livestatus/src/Logfile.h | 6 +++--- livestatus/src/MonitoringCore.h | 1 + livestatus/src/TableStateHistory.cc | 15 ++++++-------- livestatus/src/TableStateHistory.h | 2 +- 5 files changed, 28 insertions(+), 37 deletions(-) diff --git a/livestatus/src/Logfile.cc b/livestatus/src/Logfile.cc index 71625f9..84c8e65 100644 --- a/livestatus/src/Logfile.cc +++ b/livestatus/src/Logfile.cc @@ -90,10 +90,6 @@ Logfile::Logfile(MonitoringCore *mc, fs::path path, bool watch) Logfile::~Logfile() { flush(); } void Logfile::flush() { - for (auto &entry : _entries) { - delete entry.second; - } - _entries.clear(); _logclasses_read = 0; } @@ -186,9 +182,8 @@ long Logfile::freeMessages(unsigned logclasses) { // usual post-increment idiom, see Scott Meyers' "Effective STL", item 9 // ("Choose carefully among erasing options."). for (auto it = _entries.begin(); it != _entries.end();) { - LogEntry *entry = it->second; - if (((1u << static_cast<int>(entry->_logclass)) & logclasses) != 0u) { - delete entry; + if (((1u << static_cast<int>(it->second->_logclass)) & logclasses) != + 0u) { _entries.erase(it++); freed++; } else { @@ -224,10 +219,10 @@ logfile_entries_t *Logfile::getEntriesFromQuery(Query * /*unused*/, LogCache *logcache, time_t since, time_t until, unsigned logclasses) { - updateReferences(); // Make sure existing references to objects point to - // correct world - load(logcache, since, until, - logclasses); // make sure all messages are present + // Make sure existing references to objects point to correct world + updateReferences(); + // make sure all messages are present + load(logcache, since, until, logclasses); return &_entries; } @@ -239,10 +234,10 @@ bool Logfile::answerQuery(Query *query, LogCache *logcache, time_t since, load(logcache, since, until, logclasses); uint64_t sincekey = makeKey(since, 0); for (auto it = _entries.lower_bound(sincekey); it != _entries.end(); ++it) { - LogEntry *entry = it->second; // end found or limit exceeded? - if (entry->_time >= until || !query->processDataset(Row(entry))) { - return false; // limit exceeded + if (it->second->_time >= until || + !query->processDataset(Row(it->second.get()))) { + return false; } } return true; @@ -250,20 +245,18 @@ bool Logfile::answerQuery(Query *query, LogCache *logcache, time_t since, bool Logfile::answerQueryReverse(Query *query, LogCache *logcache, time_t since, time_t until, unsigned logclasses) { - updateReferences(); // Make sure existing references to objects point to - // correct world - load(logcache, since, until, - logclasses); // make sure all messages are present + // Make sure existing references to objects point to correct world + updateReferences(); + // make sure all messages are present + load(logcache, since, until, logclasses); uint64_t untilkey = makeKey(until, 999999999); auto it = _entries.upper_bound(untilkey); while (it != _entries.begin()) { --it; - LogEntry *entry = it->second; - if (entry->_time < since) { - return false; // end found - } - if (!query->processDataset(Row(entry))) { - return false; // limit exceeded + // end found or limit exceeded? + if (it->second->_time < since || + !query->processDataset(Row(it->second.get()))) { + return false; } } return true; diff --git a/livestatus/src/Logfile.h b/livestatus/src/Logfile.h index 5fc5663..2099f15 100644 --- a/livestatus/src/Logfile.h +++ b/livestatus/src/Logfile.h @@ -30,6 +30,7 @@ #include <cstdio> #include <ctime> #include <map> +#include <memory> #include <string> #include "FileSystem.h" class LogCache; @@ -39,13 +40,12 @@ class MonitoringCore; class Query; #ifdef CMC -#include <memory> #include <vector> class World; #endif -typedef std::map<uint64_t, LogEntry *> - logfile_entries_t; // key is time_t . lineno +// key is time_t . lineno +using logfile_entries_t = std::map<uint64_t, std::unique_ptr<LogEntry>>; class Logfile { private: diff --git a/livestatus/src/MonitoringCore.h b/livestatus/src/MonitoringCore.h index 5555b3f..964ee88 100644 --- a/livestatus/src/MonitoringCore.h +++ b/livestatus/src/MonitoringCore.h @@ -59,6 +59,7 @@ public: class ContactGroup; class Host; class Service; + class TimePeriod; virtual ~MonitoringCore() = default; diff --git a/livestatus/src/TableStateHistory.cc b/livestatus/src/TableStateHistory.cc index db5fffc..c636cf3 100644 --- a/livestatus/src/TableStateHistory.cc +++ b/livestatus/src/TableStateHistory.cc @@ -224,19 +224,18 @@ string TableStateHistory::name() const { return "statehist"; } string TableStateHistory::namePrefix() const { return "statehist_"; } -LogEntry *TableStateHistory::getPreviousLogentry() { +void TableStateHistory::getPreviousLogentry() { while (_it_entries == _entries->begin()) { // open previous logfile if (_it_logs == _log_cache->logfiles()->begin()) { - return nullptr; + return; } --_it_logs; _entries = _it_logs->second->getEntriesFromQuery( _query, _log_cache, _since, _until, classmask_statehist); _it_entries = _entries->end(); } - - return (--_it_entries)->second; + --_it_entries; } LogEntry *TableStateHistory::getNextLogentry() { @@ -254,7 +253,7 @@ LogEntry *TableStateHistory::getNextLogentry() { _query, _log_cache, _since, _until, classmask_statehist); _it_entries = _entries->begin(); } - return _it_entries->second; + return _it_entries->second.get(); } // TODO(sp) IsObjectFilter in TableCachedStatehist recurses into sub-filters, @@ -369,15 +368,13 @@ void TableStateHistory::answerQuery(Query *query) { } // Determine initial logentry - LogEntry *entry; _entries = _it_logs->second->getEntriesFromQuery( query, _log_cache, _since, _until, classmask_statehist); if (!_entries->empty() && _it_logs != newest_log) { _it_entries = _entries->end(); // Check last entry. If it's younger than _since -> use this logfile too if (--_it_entries != _entries->begin()) { - entry = _it_entries->second; - if (entry->_time >= _since) { + if (_it_entries->second->_time >= _since) { _it_entries = _entries->begin(); } } @@ -389,7 +386,7 @@ void TableStateHistory::answerQuery(Query *query) { bool only_update = true; bool in_nagios_initial_states = false; - while (nullptr != (entry = getNextLogentry())) { + while (LogEntry *entry = getNextLogentry()) { if (_abort_query) { break; } diff --git a/livestatus/src/TableStateHistory.h b/livestatus/src/TableStateHistory.h index 77ab097..5e5dd8d 100644 --- a/livestatus/src/TableStateHistory.h +++ b/livestatus/src/TableStateHistory.h @@ -69,7 +69,7 @@ private: logfile_entries_t *_entries; logfile_entries_t::iterator _it_entries; - LogEntry *getPreviousLogentry(); + void getPreviousLogentry(); LogEntry *getNextLogentry(); void process(Query *query, HostServiceState *hs_state); int updateHostServiceState(Query *query, const LogEntry *entry,
7 years, 2 months
1
0
0
0
4820 smart: Added support for uncommon Descriptions ( CRC Error and Uncorrectable errors)
by Marcel Arentz
Module: check_mk Branch: master Commit: d03e237bea2546aac742ebfd6f9229ce86aede14 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d03e237bea2546…
Author: Marcel Arentz <ma(a)mathias-kettner.de> Date: Wed Jun 14 11:11:59 2017 +0200 4820 smart: Added support for uncommon Descriptions (CRC Error and Uncorrectable errors) Now checks also stats if the description of this stat is somewhat different from the standard. Change-Id: I3cf9911e22bdfad682a6f7a5303dd2292effd450 --- .werks/4820 | 11 +++++++++++ checks/smart | 12 ++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.werks/4820 b/.werks/4820 new file mode 100644 index 0000000..664ce54 --- /dev/null +++ b/.werks/4820 @@ -0,0 +1,11 @@ +Title: smart: Added support for uncommon Descriptions (CRC Error and Uncorrectable errors) +Level: 1 +Component: checks +Compatible: compat +Edition: cre +Version: 1.5.0i1 +Date: 1497431383 +Class: feature + +Now checks also stats if the description of this stat is somewhat different +from the standard. diff --git a/checks/smart b/checks/smart index 6d457e7..d796657 100644 --- a/checks/smart +++ b/checks/smart @@ -43,6 +43,10 @@ #/dev/sda ATA WDC_SSC-D0128SC- 173 Unknown_Attribute 0x0012 100 100 000 Old_age Always - 4217788040605 +# TODO: Need to completely rework smart check. Use IDs instead of changing +# descriptions! But be careful: There is no standard neither for IDs nor for +# descriptions. Only use those, which are common sense. + factory_settings["smart_temp_default_levels"] = { "levels": (35, 40) } @@ -107,7 +111,9 @@ smart_stats_fields = [ 'Command_Timeout', 'End-to-End_Error', 'Reported_Uncorrect', - 'UDMA_CRC_Error_Count', ] + 'Uncorrectable_Error_Cnt', + 'UDMA_CRC_Error_Count', + 'CRC_Error_Count', ] def inventory_smart_stats(info): disks = parse_smart_raw_values(info) @@ -145,7 +151,9 @@ def check_smart_stats(item, params, info): ('', 'Command_Timeout', 'Command timeouts', ), ('', 'End-to-End_Error', 'End-to-End errors', ), ('', 'Reported_Uncorrect', 'Uncorrectable errors', ), - ('', 'UDMA_CRC_Error_Count', 'UDMA CRC errors', )]: + ('', 'Uncorrectable_Error_Cnt', 'Uncorrectable errors', ), + ('', 'UDMA_CRC_Error_Count', 'UDMA CRC errors', ), + ('', 'CRC_Error_Count', 'UDMA CRC errors', )]: if field in disk: value = disk[field] infos.append("%s: %d%s" % (descr, value, unit))
7 years, 2 months
1
0
0
0
Removed useless conditions.
by Sven Panne
Module: check_mk Branch: master Commit: c50472370ea7ed11f051b83284b244c78821164f URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c50472370ea7ed…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Fri Aug 4 10:03:12 2017 +0200 Removed useless conditions. Change-Id: I4b3e41aae1ca5de122a3384916e645a343c8902b --- livestatus/src/TimeperiodColumn.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/livestatus/src/TimeperiodColumn.cc b/livestatus/src/TimeperiodColumn.cc index c198c78..9f7fa92 100644 --- a/livestatus/src/TimeperiodColumn.cc +++ b/livestatus/src/TimeperiodColumn.cc @@ -40,8 +40,8 @@ TimeperiodColumn::TimeperiodColumn(const string& name, int32_t TimeperiodColumn::getValue(Row row, contact* /* auth_user */) { if (auto tp = columnData<timeperiod>(row)) { - // no timeperiod set -> Nagios assumes 7x24 - return (tp == nullptr || g_timeperiods_cache->inTimeperiod(tp)) ? 1 : 0; + return g_timeperiods_cache->inTimeperiod(tp) ? 1 : 0; } + // no timeperiod set -> Nagios assumes 7x24 return 0; }
7 years, 2 months
1
0
0
0
Fixed gude_powerbanks parse function
by Simon Betz
Module: check_mk Branch: master Commit: 3ed0ee770d69a9dec605ca3aad8cf77f7ad9820f URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3ed0ee770d69a9…
Author: Simon Betz <si(a)mathias-kettner.de> Date: Fri Aug 4 09:51:09 2017 +0200 Fixed gude_powerbanks parse function Change-Id: I2955be675b4c15f94976f4aa555b1721cde54831 --- checks/gude_powerbanks | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/checks/gude_powerbanks b/checks/gude_powerbanks index faaa792..0a7372b 100644 --- a/checks/gude_powerbanks +++ b/checks/gude_powerbanks @@ -53,11 +53,15 @@ def parse_gude_powerbanks(info): current_str, volt_str, freq_str, appower_str in info[1]: oid, idx = oid_idx.split(".") + device_state = None if oid in ["19"]: device_state = map_port_states[ports[oid_idx]] if oid in ["38"]: device_state = map_channel_states[device_state] + if device_state is None: + continue + parsed.setdefault(idx, { "device_state" : device_state })
7 years, 2 months
1
0
0
0
← Newer
1
...
14
15
16
17
18
19
20
21
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Results per page:
10
25
50
100
200