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
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
February 2016
----- 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
7 participants
402 discussions
Start a n
N
ew thread
linux and solaris agent: fixed asynchronous execution of mrpe plugins
by Sebastian Herbord
Module: check_mk Branch: master Commit: c76c429b6a5a6307bb7cc59bab3ba6f6a3a2a4de URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c76c429b6a5a63…
Author: Sebastian Herbord <sh(a)mathias-kettner.de> Date: Wed Feb 3 13:38:25 2016 +0100 linux and solaris agent: fixed asynchronous execution of mrpe plugins --- agents/check_mk_agent.linux | 50 ++++++++++++++++++++++++++--------------- agents/check_mk_agent.solaris | 34 +++++++++++++++++++++++----- 2 files changed, 60 insertions(+), 24 deletions(-) diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux index 1dd64e1..160e1c9 100755 --- a/agents/check_mk_agent.linux +++ b/agents/check_mk_agent.linux @@ -97,15 +97,34 @@ function section_cpu() } +function run_mrpe() { + local descr=$1 + shift + local cmdline="$@" + + echo '<<<mrpe>>>' + + PLUGIN=${cmdline%% *} + OUTPUT=$(eval "$cmdline") + + echo -n "(${PLUGIN##*/}) $descr $? $OUTPUT" | tr \\n \\1 + echo +} + +export -f run_mrpe + # Runs a command asynchronous by use of a cache file. Usage: # run_cached [-s] NAME MAXAGE # -s creates the section header <<<$NAME>>> +# -m mrpe-mode: stores exit code with the cache # NAME is the name of the section (also used as cache file name) # MAXAGE is the maximum cache livetime in seconds function run_cached () { local NOW=$(date +%s) local section= + local mrpe=0 if [ "$1" = -s ] ; then local section="echo '<<<$2:cached($NOW,$3)>>>' ; " ; shift ; fi + if [ "$1" = -m ] ; then local mrpe=1 ; shift ; fi local NAME=$1 local MAXAGE=$2 shift 2 @@ -139,7 +158,11 @@ function run_cached () { # Cache file outdated and new job not yet running? Start it if [ -z "$USE_CACHEFILE" -a ! -e "$CACHEFILE.new" ] ; then # When the command fails, the output is throws away ignored - echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit 1 ; $CMDLINE && mv \"$CACHEFILE.new\" \"$CACHEFILE\" || rm -f \"$CACHEFILE\" \"$CACHEFILE.new\"" | nohup bash >/dev/null 2>&1 & + if [ $mrpe -eq 1 ] ; then + echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit 1 ; run_mrpe $NAME $CMDLINE && mv \"$CACHEFILE.new\" \"$CACHEFILE\" || rm -f \"$CACHEFILE\" \"$CACHEFILE.new\"" | nohup bash >/dev/null 2>&1 & + else + echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit 1 ; $CMDLINE && mv \"$CACHEFILE.new\" \"$CACHEFILE\" || rm -f \"$CACHEFILE\" \"$CACHEFILE.new\"" | nohup bash >/dev/null 2>&1 & + fi fi } @@ -725,7 +748,6 @@ fi # MK's Remote Plugin Executor if [ -e "$MK_CONFDIR/mrpe.cfg" ] then - echo '<<<mrpe>>>' grep -Ev '^[[:space:]]*($|#)' "$MK_CONFDIR/mrpe.cfg" | \ while read descr cmdline do @@ -740,7 +762,9 @@ then for par in "${parlist[@]}" do # split each assignment - IFS='=' read key value <<< $par + key=$(echo $par | cut -d= -f1) + value=$(echo $par | cut -d= -f2) + if [ "$key" = "interval" ] then interval=$value @@ -749,16 +773,12 @@ then done fi - PLUGIN=${cmdline%% *} if [ -z "$interval" ] then - OUTPUT=$(eval "$cmdline") + run_mrpe $descr "$cmdline" else - OUTPUT=$(run_cached $descr $interval "$cmdline") + run_cached -m $descr $interval "\'$cmdline\'" fi - - echo -n "(${PLUGIN##*/}) $descr $? $OUTPUT" | tr \\n \\1 - echo done fi @@ -776,7 +796,6 @@ then # mrpe includes if [ "$type" == "mrpe" ] ; then - echo "<<<mrpe>>>" grep -Ev '^[[:space:]]*($|#)' "$include" | \ while read descr cmdline do @@ -800,20 +819,15 @@ then done fi - PLUGIN=${cmdline%% *} - if [ -n "$PREFIX" ] ; then - cmdline="$PREFIX\"$cmdline\"" + cmdline="$PREFIX\'$cmdline\'" fi - if [ -z "$interval" ] then - OUTPUT=$(eval "$cmdline") + run_mrpe $descr "$cmdline" else - OUTPUT=$(run_cached $descr $interval "$cmdline") + run_cached -m $descr $interval "$cmdline" fi - echo -n "(${PLUGIN##*/}) $descr $? $OUTPUT" | tr \\n \\1 - echo done # local and plugin includes diff --git a/agents/check_mk_agent.solaris b/agents/check_mk_agent.solaris index bf579a4..ac736fd 100755 --- a/agents/check_mk_agent.solaris +++ b/agents/check_mk_agent.solaris @@ -55,9 +55,27 @@ function file_age() { } +function run_mrpe() { + local descr=$1 + shift + local cmdline="$@" + + echo '<<<mrpe>>>' + + OUTPUT=$(eval "$cmdline") + + echo -n "$descr $? $OUTPUT" | tr \\n \\1 + echo +} + +export -f run_mrpe + + # Runs a command asynchronous by use of a cache file function run_cached () { + local mrpe=0 if [ "$1" = -s ] ; then local section="echo '<<<$2>>>' ; " ; shift ; fi + if [ "$1" = -m ] ; then local mrpe=1 ; shift ; fi local NAME=$1 local MAXAGE=$2 shift 2 @@ -86,7 +104,11 @@ function run_cached () { # Cache file outdated and new job not yet running? Start it if [ -z "$USE_CACHEFILE" -a ! -e "$CACHEFILE.new" ] ; then - echo "set -o noclobber ; exec > $CACHEFILE.new || exit 1 ; $CMDLINE && mv $CACHEFILE.new $CACHEFILE || rm -f $CACHEFILE $CACHEFILE.new" | nohup bash 2>/dev/null & + if [ $mrpe -eq 1 ] ; then + echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit 1 ; run_mrpe $NAME $CMDLINE && mv \"$CACHEFILE.new\" \"$CACHEFILE\" || rm -f \"$CACHEFILE\" \"$CACHEFILE.new\"" | nohup bash >/dev/null 2>&1 & + else + echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit 1 ; $CMDLINE && mv \"$CACHEFILE.new\" \"$CACHEFILE\" || rm -f \"$CACHEFILE\" \"$CACHEFILE.new\"" | nohup bash >/dev/null 2>&1 & + fi fi } @@ -323,7 +345,9 @@ then for par in "${parlist[@]}" do # split each assignment - IFS='=' read key value <<< $par + key=$(echo $par | cut -d= -f1) + value=$(echo $par | cut -d= -f2) + if [ "$key" = "interval" ] then interval=$value @@ -334,12 +358,10 @@ then if [ -z "$interval" ] then - OUTPUT=$($cmdline) + run_mrpe $descr "$cmdline" else - OUTPUT=$(run_cached $descr $interval "$cmdline") + run_cached -m $descr $interval "\'$cmdline\'" fi - - echo "$descr $? $OUTPUT" done fi
8 years, 7 months
1
0
0
0
#3043 FIX agent_emcvnx: Fixed error handling in case of missing naviseccli command
by Lars Michelsen
Module: check_mk Branch: master Commit: 00860c0801e79a642a8ff1bdb0a1338da77a7953 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=00860c0801e79a…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Wed Feb 3 13:17:58 2016 +0100 #3043 FIX agent_emcvnx: Fixed error handling in case of missing naviseccli command --- .werks/3043 | 9 +++++++++ ChangeLog | 1 + agents/special/agent_emcvnx | 14 ++++++++++---- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.werks/3043 b/.werks/3043 new file mode 100644 index 0000000..2414a88 --- /dev/null +++ b/.werks/3043 @@ -0,0 +1,9 @@ +Title: agent_emcvnx: Fixed error handling in case of missing naviseccli command +Level: 1 +Component: checks +Compatible: compat +Version: 1.2.7i4 +Date: 1454501841 +Class: fix + + diff --git a/ChangeLog b/ChangeLog index 154ae82..a2ca644 100644 --- a/ChangeLog +++ b/ChangeLog @@ -242,6 +242,7 @@ * 3064 FIX: netscaler_health: no longer discovers non-running fans (i.e. in virtual appliances) * 2987 FIX: esx_vsphere_counters: Improved accuracy of all counter values... * 3065 FIX: mem.win: renamed "Pagefile" to "Commit Charge" to clarify what the number actually expresses... + * 3043 FIX: agent_emcvnx: Fixed error handling in case of missing naviseccli command Multisite: * 2684 Added icons for downloading agent data / walks of hosts... diff --git a/agents/special/agent_emcvnx b/agents/special/agent_emcvnx index c652be8..c44a61e 100755 --- a/agents/special/agent_emcvnx +++ b/agents/special/agent_emcvnx @@ -39,7 +39,7 @@ # <-mirrorview><-snapviews><-sancopy><-reserved> <-cloneview><-metalun> # <-migration><-ioportconfig> <-fastcache><-backendbus> -import sys, os, getopt, re +import sys, os, getopt, re, subprocess import inspect, pprint # FOR DEBUGGING @@ -175,19 +175,25 @@ else: # check_mk section of agent output # -print "<<<check_mk>>>" -cmd=basecmd + "getall -sp" +cmd = basecmd + "getall -sp" if opt_debug: sys.stderr.write("executing external command: %s\n" % cmd) cmdout = [] -for line in os.popen(cmd).readlines(): +try: + p = subprocess.Popen(cmd) +except OSError: + sys.stderr.write("Failed to execute \"%s\". Maybe \"naviseccli\" is missing.\n" % cmd) + sys.exit(1) + +for line in p.stdout.readlines(): line = line.strip() cmdout.append(line) tokens = re.split("\s+", line) if tokens[0] == "Agent" and tokens[1] == "Rev:": emcvnx_version = "_".join(tokens[2:]) +print "<<<check_mk>>>" print "Version: %s" % emcvnx_version # maybe we could fill AgentOS: by reading "Model:" line of naviseccli output
8 years, 7 months
1
0
0
0
clang-tidy fixes for modernize-pass-by-value check.
by Sven Panne
Module: check_mk Branch: master Commit: 24696aef3872d02631ae124f78407deccf6b863b URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=24696aef3872d0…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Wed Feb 3 13:21:25 2016 +0100 clang-tidy fixes for modernize-pass-by-value check. --- livestatus/src/Column.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/livestatus/src/Column.cc b/livestatus/src/Column.cc index 620a06b..7e90673 100644 --- a/livestatus/src/Column.cc +++ b/livestatus/src/Column.cc @@ -22,14 +22,16 @@ // to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, // Boston, MA 02110-1301 USA. +#include <utility> + #include "Column.h" using std::string; Column::Column(string name, string description, int indirect_offset, int extra_offset, int extra_extra_offset) - : _name(name) - , _description(description) + : _name(std::move(name)) + , _description(std::move(description)) , _indirect_offset(indirect_offset) , _extra_offset(extra_offset) , _extra_extra_offset(extra_extra_offset) {}
8 years, 7 months
1
0
0
0
clang-tidy fixes for modernize-use-default check.
by Sven Panne
Module: check_mk Branch: master Commit: 660eb52f036251fe6a56f8b2b40074a6ff92d571 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=660eb52f036251…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Wed Feb 3 13:26:22 2016 +0100 clang-tidy fixes for modernize-use-default check. --- livestatus/src/DynamicColumn.cc | 2 +- livestatus/src/Store.cc | 2 +- livestatus/src/TableLog.cc | 2 +- livestatus/src/TimeperiodsCache.cc | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/livestatus/src/DynamicColumn.cc b/livestatus/src/DynamicColumn.cc index 4f6de82..fd49957 100644 --- a/livestatus/src/DynamicColumn.cc +++ b/livestatus/src/DynamicColumn.cc @@ -24,7 +24,7 @@ #include "DynamicColumn.h" -DynamicColumn::~DynamicColumn() {} +DynamicColumn::~DynamicColumn() = default; Column *DynamicColumn::createColumn(const char *arguments) { return createColumn(_indirect_offset, _extra_offset, arguments); diff --git a/livestatus/src/Store.cc b/livestatus/src/Store.cc index f95e7e0..b068ee7 100644 --- a/livestatus/src/Store.cc +++ b/livestatus/src/Store.cc @@ -103,7 +103,7 @@ Store::Store() } } -Store::~Store() {} +Store::~Store() = default; Table *Store::findTable(string name) { auto it = _tables.find(name); diff --git a/livestatus/src/TableLog.cc b/livestatus/src/TableLog.cc index f08e0ea..aa361ea 100644 --- a/livestatus/src/TableLog.cc +++ b/livestatus/src/TableLog.cc @@ -130,7 +130,7 @@ void TableLog::addColumns(Table *table, string prefix, int indirect_offset, (char *)&(ref->_command) - (char *)ref); } -TableLog::~TableLog() {} +TableLog::~TableLog() = default; void TableLog::answerQuery(Query *query) { lock_guard<mutex> lg(g_store->logCache()->_lock); diff --git a/livestatus/src/TimeperiodsCache.cc b/livestatus/src/TimeperiodsCache.cc index e42cd41..4e2e572 100644 --- a/livestatus/src/TimeperiodsCache.cc +++ b/livestatus/src/TimeperiodsCache.cc @@ -38,7 +38,7 @@ extern timeperiod *timeperiod_list; TimeperiodsCache::TimeperiodsCache() { _cache_time = 0; } -TimeperiodsCache::~TimeperiodsCache() {} +TimeperiodsCache::~TimeperiodsCache() = default; void TimeperiodsCache::logCurrentTimeperiods() { lock_guard<mutex> lg(_cache_lock);
8 years, 7 months
1
0
0
0
Fix duplicate load() in pagetype
by Mathias Kettner
Module: check_mk Branch: master Commit: ae6efd3bfe5ba685a33d21a525d258660b1e7170 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ae6efd3bfe5ba6…
Author: Mathias Kettner <mk(a)mathias-kettner.de> Date: Wed Feb 3 13:00:02 2016 +0100 Fix duplicate load() in pagetype --- web/htdocs/pagetypes.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/htdocs/pagetypes.py b/web/htdocs/pagetypes.py index 8f454e2..a9d8da1 100644 --- a/web/htdocs/pagetypes.py +++ b/web/htdocs/pagetypes.py @@ -322,6 +322,7 @@ class PageRenderer: @classmethod def page_show(self): name = html.var(self.ident_attr()) + self.load() page = self.find_page(name) if not page: raise MKGeneralException(_("Cannot find %s with the name %s") % ( @@ -564,8 +565,6 @@ class Overridable: # publishing und overriding by admins @classmethod def find_page(self, name): - self.load() - mine = None forced = None builtin = None @@ -614,6 +613,7 @@ class Overridable: def builtin_pages(self): return {} + # Lädt alle Dinge vom aktuellen User-Homeverzeichnis und # mergt diese mit den übergebenen eingebauten @classmethod @@ -1030,6 +1030,7 @@ class Container: self.need_overriding_permission("edit") need_sidebar_reload = False + self.load() page = self.find_page(page_name) if not page.is_mine(): page = page.clone()
8 years, 7 months
1
0
0
0
clang-tidy fixes for modernize-use-nullptr check.
by Sven Panne
Module: check_mk Branch: master Commit: 612d21752725ca6d79649f73f2b59ff118e3af81 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=612d21752725ca…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Wed Feb 3 11:46:55 2016 +0100 clang-tidy fixes for modernize-use-nullptr check. --- livestatus/src/AndingFilter.cc | 4 +- livestatus/src/AttributelistColumn.cc | 4 +- livestatus/src/Column.cc | 6 +-- livestatus/src/ContactgroupsColumn.cc | 2 +- livestatus/src/ContactgroupsMemberColumn.cc | 2 +- livestatus/src/CustomTimeperiodColumn.cc | 4 +- livestatus/src/CustomVarsColumn.cc | 6 +-- livestatus/src/CustomVarsExplicitColumn.cc | 4 +- livestatus/src/CustomVarsFilter.cc | 7 +-- livestatus/src/DownCommColumn.cc | 10 ++--- livestatus/src/DowntimeOrComment.cc | 2 +- livestatus/src/HostFileColumn.cc | 12 ++--- livestatus/src/HostServiceState.cc | 2 +- livestatus/src/HostSpecialDoubleColumn.cc | 2 +- livestatus/src/HostgroupsColumn.cc | 4 +- livestatus/src/HostlistColumn.cc | 2 +- livestatus/src/HostlistColumnFilter.cc | 2 +- livestatus/src/HostlistStateColumn.cc | 2 +- livestatus/src/InputBuffer.cc | 8 ++-- livestatus/src/ListColumnFilter.cc | 2 +- livestatus/src/LogCache.cc | 4 +- livestatus/src/Logfile.cc | 12 ++--- livestatus/src/OffsetStringHostMacroColumn.cc | 2 +- livestatus/src/OffsetStringMacroColumn.cc | 4 +- livestatus/src/OffsetStringServiceMacroColumn.cc | 2 +- livestatus/src/OutputBuffer.cc | 2 +- livestatus/src/PerfdataAggregator.cc | 4 +- livestatus/src/Query.cc | 30 ++++++------- livestatus/src/ServiceSpecialDoubleColumn.cc | 4 +- livestatus/src/ServicegroupsColumn.cc | 4 +- livestatus/src/ServicelistColumn.cc | 2 +- livestatus/src/ServicelistColumnFilter.cc | 2 +- livestatus/src/ServicelistStateColumn.cc | 2 +- livestatus/src/Store.cc | 12 ++--- livestatus/src/StringColumn.cc | 2 +- livestatus/src/StringColumnFilter.cc | 9 ++-- livestatus/src/Table.cc | 4 +- livestatus/src/TableDownComm.cc | 12 ++--- livestatus/src/TableHosts.cc | 4 +- livestatus/src/TableLog.cc | 4 +- livestatus/src/TableStateHistory.cc | 51 +++++++++++----------- livestatus/src/TimeperiodsCache.cc | 2 +- livestatus/src/store_c.cc | 12 ++--- livestatus/src/strutil.cc | 4 +- livestatus/src/waittriggers.cc | 2 +- 45 files changed, 141 insertions(+), 138 deletions(-) Diff:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=612d217527…
8 years, 7 months
1
0
0
0
clang-tidy fixes for modernize-use-auto check.
by Sven Panne
Module: check_mk Branch: master Commit: 1cccdb17bd22ed95ab56e160e1d7f4fce1e15a72 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1cccdb17bd22ed…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Wed Feb 3 11:54:10 2016 +0100 clang-tidy fixes for modernize-use-auto check. --- livestatus/src/AndingFilter.cc | 15 +++++---------- livestatus/src/DownCommColumn.cc | 6 ++---- livestatus/src/LogCache.cc | 7 +++---- livestatus/src/Logfile.cc | 12 +++++------- livestatus/src/OringFilter.cc | 6 ++---- livestatus/src/PerfdataAggregator.cc | 2 +- livestatus/src/Query.cc | 34 +++++++++++++--------------------- livestatus/src/Store.cc | 4 ++-- livestatus/src/Table.cc | 17 +++++++---------- livestatus/src/TableColumns.cc | 7 +++---- livestatus/src/TableDownComm.cc | 9 ++++----- livestatus/src/TableStateHistory.cc | 32 ++++++++++++++------------------ livestatus/src/TimeperiodsCache.cc | 6 +++--- 13 files changed, 64 insertions(+), 93 deletions(-) Diff:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=1cccdb17bd…
8 years, 7 months
1
0
0
0
clang-tidy fixes for modernize-loop-convert check.
by Sven Panne
Module: check_mk Branch: master Commit: e7a9857d3dc177dde64e28c6c1030746e9a13478 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e7a9857d3dc177…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Wed Feb 3 12:05:42 2016 +0100 clang-tidy fixes for modernize-loop-convert check. --- livestatus/src/AndingFilter.cc | 16 +++++----------- livestatus/src/LogCache.cc | 4 +--- livestatus/src/Logfile.cc | 3 +-- livestatus/src/OringFilter.cc | 6 ++---- livestatus/src/Query.cc | 30 ++++++++++-------------------- livestatus/src/Store.cc | 4 ++-- livestatus/src/Table.cc | 17 ++++++++--------- livestatus/src/TableColumns.cc | 10 ++++------ livestatus/src/TableDownComm.cc | 4 +--- livestatus/src/TableStateHistory.cc | 8 +++----- 10 files changed, 37 insertions(+), 65 deletions(-) Diff:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=e7a9857d3d…
8 years, 7 months
1
0
0
0
Do not create crash dumps anymore when running with --debug
by Mathias Kettner
Module: check_mk Branch: master Commit: d4b558e74d285e9fbb9093d3a6b87c9c4fb1ace0 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d4b558e74d285e…
Author: Mathias Kettner <mk(a)mathias-kettner.de> Date: Wed Feb 3 12:05:07 2016 +0100 Do not create crash dumps anymore when running with --debug --- modules/check_mk_base.py | 2 +- modules/discovery.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py index de317e4..60484bc 100644 --- a/modules/check_mk_base.py +++ b/modules/check_mk_base.py @@ -1430,9 +1430,9 @@ def do_all_checks_on_host(hostname, ipaddress, only_check_types = None, fetch_ag dont_submit = True except Exception, e: - result = 3, create_crash_dump(hostname, checkname, item, params, description, info), [] if opt_debug: raise + result = 3, create_crash_dump(hostname, checkname, item, params, description, info), [] if not dont_submit: # Now add information about the age of the data in the agent diff --git a/modules/discovery.py b/modules/discovery.py index 83898e3..e52dc73 100644 --- a/modules/discovery.py +++ b/modules/discovery.py @@ -331,10 +331,10 @@ def check_discovery(hostname, ipaddress=None): raise except Exception, e: - output = create_crash_dump(hostname, "discovery", None, None, "Check_MK Discovery", [])\ - .replace("Crash dump:\n", "Crash dump:\\n") if opt_debug: raise + output = create_crash_dump(hostname, "discovery", None, None, "Check_MK Discovery", [])\ + .replace("Crash dump:\n", "Crash dump:\\n") # Honor rule settings for "Status of the Check_MK service". In case of # a problem we assume a connection error here. spec = exit_code_spec(hostname)
8 years, 7 months
1
0
0
0
Fix predictive monitoring when using single RRDs
by Mathias Kettner
Module: check_mk Branch: master Commit: 6dc8ddc89f60b3764a91c5b9204a5ef2caf4fc64 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6dc8ddc89f60b3…
Author: Mathias Kettner <mk(a)mathias-kettner.de> Date: Wed Feb 3 11:30:15 2016 +0100 Fix predictive monitoring when using single RRDs --- modules/check_mk.py | 4 +- modules/nagios.py | 2 +- modules/prediction.py | 102 +++++++++++-------------------------------------- 3 files changed, 25 insertions(+), 83 deletions(-) diff --git a/modules/check_mk.py b/modules/check_mk.py index 5a1d584..a07d3c8 100755 --- a/modules/check_mk.py +++ b/modules/check_mk.py @@ -137,8 +137,8 @@ tcp_cache_dir = var_dir + '/cache' logwatch_dir = var_dir + '/logwatch' www_group = None # unset logwatch_notes_url = "/nagios/logwatch.php?host=%s&file=%s" -rrdcached_socket = None # used by prediction.py -rrd_path = None # used by prediction.py +rrdcached_socket = None +rrd_path = None # Stuff for supporting Nagios check_result_path = '/usr/local/nagios/var/spool/checkresults' diff --git a/modules/nagios.py b/modules/nagios.py index f90367b..0c05879 100644 --- a/modules/nagios.py +++ b/modules/nagios.py @@ -1011,7 +1011,7 @@ no_discovery_possible = None 'aggr_summary_hostname', 'nagios_command_pipe_path', 'check_result_path', 'check_submission', 'monitoring_core', 'var_dir', 'counters_directory', 'tcp_cache_dir', 'tmp_dir', 'log_dir', - 'snmpwalks_dir', 'check_mk_basedir', 'nagios_user', 'rrd_path', 'rrdcached_socket', + 'snmpwalks_dir', 'check_mk_basedir', 'nagios_user', 'omd_root', 'www_group', 'cluster_max_cachefile_age', 'check_max_cachefile_age', 'piggyback_max_cachefile_age', 'fallback_agent_output_encoding', 'simulation_mode', 'agent_simulator', 'aggregate_check_mk', diff --git a/modules/prediction.py b/modules/prediction.py index 80b84fa..be5b674 100644 --- a/modules/prediction.py +++ b/modules/prediction.py @@ -29,85 +29,29 @@ # Export data from an RRD file. This requires an up-to-date # version of the rrdtools. -def rrd_export(filename, ds, cf, fromtime, untiltime, rrdcached=None): - # rrdtool xport --json -s 1361554418 -e 1361640814 --step 60 DEF:x=/omd/sites/heute/X.rrd:1:AVERAGE XPORT:x:HIRNI - cmd = "rrdtool xport --json -s %d -e %d --step 60 " % (fromtime, untiltime) - if rrdcached and os.path.exists(rrdcached): - cmd += "--daemon '%s' " % rrdcached - cmd += " DEF:x=%s:%s:%s XPORT:x 2>&1" % (filename, ds, cf) - # if opt_debug: - # sys.stderr.write("Running %s\n" % cmd) - f = os.popen(cmd) - output = f.read() - exit_code = f.close() - if exit_code: - raise MKGeneralException("Cannot fetch RRD data: %s" % output) - - # Parse without json module (this is not always available) - # Our data begins at "data: [...". The sad thing: names are not - # quoted here. Don't know why. We fake this by defining variables. - about = "about" - meta = "meta" - start = "start" - step = "step" - end = "end" - legend = "legend" - data = "data" - null = None - - # begin = output.index("data:") - # data_part = output[begin + 5:-2] - data = eval(output) - - return data["meta"]["step"], [ x[0] for x in data["data"] ] - - -def find_ds_in_pnp_xmlfile(xml_file, varname): - ds = None - name = None - for line in file(xml_file): - line = line.strip() - if line.startswith("<DS>"): - ds = line[4:].split('<')[0] - if name == varname: - return int(ds) - elif line.startswith("<LABEL>"): - name = line[7:].split('<')[0] - if ds and name == varname: - return int(ds) - else: - ds = None - elif line == '<DATASOURCE>': - ds = None - name = None - +# Fetch RRD historic metrics data of a specific service. returns a tuple +# of (step, [value1, value2, ...]) def get_rrd_data(hostname, service_description, varname, cf, fromtime, untiltime): - global rrdcached_socket - rrd_base = "%s/%s/%s" % (rrd_path, pnp_cleanup(hostname), - pnp_cleanup(service_description)) - # First try PNP storage type MULTIPLE - rrd_file = rrd_base + "_%s.rrd" % pnp_cleanup(varname) - ds = 1 - if not os.path.exists(rrd_file): - # We need to look into the XML file of PNP in order to - # find the correct DS number. - xml_file = rrd_base + ".xml" - if not os.path.exists(xml_file): - raise MKGeneralException("Cannot do prediction: XML file %s missing" % xml_file) - rrd_file = rrd_base + ".rrd" - if not os.path.exists(rrd_file): - raise MKGeneralException("Cannot do prediction: RRD file missing") - - # Let's parse the XML file in a silly, but fast way, that does - # not need any further module. - ds = find_ds_in_pnp_xmlfile(xml_file, varname) - if ds == None: - raise MKGeneralException("Cannot do prediction: variable %s not known" % varname) - - if omd_root and not rrdcached_socket: - rrdcached_socket = omd_root + "/tmp/run/rrdcached.sock" - return rrd_export(rrd_file, ds, cf, fromtime, untiltime, rrdcached_socket) + step = 1 + rpn = "%s.%s" % (varname, cf.lower()) # "MAX" -> "max" + lql = "GET services\n" \ + "Columns: rrddata:m1:%s:%d:%d:%d\n" \ + "OutputFormat: python\n" \ + "Filter: host_name = %s\n" \ + "Filter: description = %s\n" % ( + rpn, fromtime, untiltime, step, hostname, service_description) + try: + response = eval(simple_livestatus_query(lql))[0][0] + except Exception, e: + if opt_debug: + raise + raise MKGeneralException("Cannot get historic metrics via Livestatus: %s" % e) + + real_fromtime, real_untiltime, step = response[:3] + values = response[3:] + return step, values + daynames = [ "monday", "tuesday", "wednesday", "thursday", @@ -172,9 +116,8 @@ def get_prediction_timegroup(t, period_info): until_time = t - rel_time + period_info["slice"] return timegroup, from_time, until_time, rel_time -def compute_prediction(pred_file, timegroup, params, period_info, from_time, dsname, cf): - import math +def compute_prediction(pred_file, timegroup, params, period_info, from_time, dsname, cf): # Collect all slices back into the past until the time horizon # is reached begin = from_time @@ -206,7 +149,6 @@ def compute_prediction(pred_file, timegroup, params, period_info, from_time, dsn num_points = len(slices[0][2]) consolidated = [] for i in xrange(num_points): - # print "PUNKT %d --------------------------------------" % i point_line = [] for from_time, scale, data in slices: idx = int(i / float(scale))
8 years, 7 months
1
0
0
0
← Newer
1
...
32
33
34
35
36
37
38
...
41
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
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Results per page:
10
25
50
100
200