Module: check_mk
Branch: master
Commit: 893d1b6ae657de5bc0f489b5acd37c6a8a34363b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=893d1b6ae657de…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Mar 16 11:51:18 2018 +0100
5829 FIX Fixed calculation of time ranges when using disjunctions in queries.
Disjunctions (Or:, WaitConditionOr:, StatsOr:) were handled like conjuctions
(And:, WaitConditionAnd:, StatsAnd:) when time ranges were calculated for
the log and statehist tables. This has been fixed now.
Note that the Check_MK GUI does not create such queries, so only people
using hand-rolled queries in scripts etc. were affected.
Change-Id: I0b1c10500e222c1c4c5ecf0bf43de6b16fc608eb
---
.werks/5829 | 15 +++++++++++++++
livestatus/src/OringFilter.cc | 14 +++++++++++++-
2 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/.werks/5829 b/.werks/5829
new file mode 100644
index 0000000..d2e3b24
--- /dev/null
+++ b/.werks/5829
@@ -0,0 +1,15 @@
+Title: Fixed calculation of time ranges when using disjunctions in queries.
+Level: 1
+Component: livestatus
+Compatible: compat
+Edition: cre
+Version: 1.5.0i4
+Date: 1521197227
+Class: fix
+
+Disjunctions (Or:, WaitConditionOr:, StatsOr:) were handled like conjuctions
+(And:, WaitConditionAnd:, StatsAnd:) when time ranges were calculated for
+the log and statehist tables. This has been fixed now.
+
+Note that the Check_MK GUI does not create such queries, so only people
+using hand-rolled queries in scripts etc. were affected.
diff --git a/livestatus/src/OringFilter.cc b/livestatus/src/OringFilter.cc
index 31ae207..506dd61 100644
--- a/livestatus/src/OringFilter.cc
+++ b/livestatus/src/OringFilter.cc
@@ -24,6 +24,7 @@
#include "OringFilter.h"
#include <iterator>
+#include <limits>
#include <memory>
#include <ostream>
#include <vector>
@@ -85,9 +86,20 @@ std::optional<std::string> OringFilter::stringValueRestrictionFor(
void OringFilter::findIntLimits(const std::string &colum_nname, int *lower,
int *upper,
std::chrono::seconds timezone_offset) const {
+ if (_subfilters.empty()) {
+ return; // NOTE: Ugly special case necessary for correctness!
+ }
+ int current_lower = std::numeric_limits<int>::max();
+ int current_upper = std::numeric_limits<int>::min();
for (const auto &filter : _subfilters) {
- filter->findIntLimits(colum_nname, lower, upper, timezone_offset);
+ int lo = *lower;
+ int up = *upper;
+ filter->findIntLimits(colum_nname, &lo, &up, timezone_offset);
+ current_lower = std::min(current_lower, lo);
+ current_upper = std::max(current_upper, up);
}
+ *lower = current_lower;
+ *upper = current_upper;
}
bool OringFilter::optimizeBitmask(const std::string &column_name,
Module: check_mk
Branch: master
Commit: 71f98efd07190aac04b7519ea51a59a255bd0ce5
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=71f98efd07190a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Mar 16 08:18:27 2018 +0100
make dist: Cleanup false positive error messages
The excludes for the agent build directories were always applied while
the directories did not exist all the time. This made the tar command
exit with an error exit code (which was printed to the log, but ignored
by the makefile).
For better error handling the script would now fail in such a case. The
tar command has been fixed by making the excludes be applied optionally
only in case the directories in question exist.
Future todo: Make the whole Makefile use stricter shell operation mode.
Change-Id: Ieb3015fa1116990117bb1cc73ceb58da9d916801
---
Makefile | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index 2de2ea3..74c12eb 100644
--- a/Makefile
+++ b/Makefile
@@ -47,6 +47,8 @@ DEMO_SUFFIX :=
OMD_VERSION := $(VERSION).$(EDITION_SHORT)$(DEMO_SUFFIX)
SHELL := /bin/bash
+# TODO: Be more strict - Add this:
+#SHELL := /bin/bash -e -o pipefail
NAME := check_mk
PREFIX := /usr
BINDIR := $(PREFIX)/bin
@@ -193,7 +195,7 @@ ifeq ($(ENTERPRISE),yes)
$(MAKE) -C enterprise agents/plugins/cmk-update-agent
$(MAKE) -C enterprise agents/windows/plugins/cmk-update-agent.exe
endif
- @EXCLUDES= ; \
+ @set -e -o pipefail ; EXCLUDES= ; \
if [ -d .git ]; then \
git rev-parse --short HEAD > COMMIT ; \
for X in $$(git ls-files --directory --others -i --exclude-standard) ; do \
@@ -201,6 +203,10 @@ endif
EXCLUDES+=" --exclude $${X%*/}" ; \
fi ; \
done ; \
+ else \
+ for F in $(DIST_ARCHIVE) enterprise/agents/plugins/{build,src} enterprise/agents/windows/{build64,build}; do \
+ EXCLUDES+=" --exclude $$F" ; \
+ done ; \
fi ; \
if [ -d check-mk-$(EDITION)-$(OMD_VERSION) ]; then \
rm -rf check-mk-$(EDITION)-$(OMD_VERSION) ; \
@@ -213,17 +219,14 @@ endif
--exclude .gitignore \
--exclude .gitmodules \
--exclude .gitattributes \
- --exclude $(DIST_ARCHIVE) \
- --exclude enterprise/agents/plugins/{build,src} \
- --exclude enterprise/agents/windows/{build64,build} \
$$EXCLUDES \
- * .werks .clang* | tar x -C check-mk-$(EDITION)-$(OMD_VERSION) ; \
+ * .werks .clang* | tar x -C check-mk-$(EDITION)-$(OMD_VERSION)
if [ -f COMMIT ]; then \
rm COMMIT ; \
- fi ; \
+ fi
tar -cz --wildcards -f $(DIST_ARCHIVE) \
$(TAROPTS) \
- check-mk-$(EDITION)-$(OMD_VERSION) ; \
+ check-mk-$(EDITION)-$(OMD_VERSION)
rm -rf check-mk-$(EDITION)-$(OMD_VERSION)
# This tar file is only used by "omd/packages/check_mk/Makefile"
Module: check_mk
Branch: master
Commit: 750d6eb0ba298fe73c34219b62a7b54c222f5865
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=750d6eb0ba298f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Mar 15 20:47:54 2018 +0100
Minimal cleanup of the setup.sh script to make it complete without issues
The things that were jus removed were failing for a longer time
silently without notice. This ancient setup mechanism is still used
internally. Needs to be cleaned up soon.
Change-Id: Idd7c5442749563aae8272b75f2d3762b825f8623
---
scripts/setup.sh | 60 --------------------------------------------------------
1 file changed, 60 deletions(-)
diff --git a/scripts/setup.sh b/scripts/setup.sh
index 737a1af..93e432f 100755
--- a/scripts/setup.sh
+++ b/scripts/setup.sh
@@ -821,16 +821,6 @@ do
mkdir -p $DESTDIR$confdir/multisite.d &&
mkdir -p $DESTDIR$confdir/conf.d &&
echo 'All files in this directory that end with .mk will be read in after main.mk' > $DESTDIR$confdir/conf.d/README &&
- mkdir -p $DESTDIR$bindir &&
- chmod 755 $DESTDIR$bindir/check_mk &&
- ln -snf check_mk $DESTDIR$bindir/cmk &&
- echo -e "#!/bin/sh\nexec python $bindir/check_mk.py -P "'"$@"' > $DESTDIR$bindir/mkp &&
- chmod 755 $DESTDIR$bindir/mkp &&
- sed -i "s#@BINDIR@#$bindir#g" $DESTDIR$sharedir/check_mk_templates.cfg &&
- sed -i "s#@VARDIR@#$vardir#g" $DESTDIR$sharedir/check_mk_templates.cfg &&
- sed -i "s#@CHECK_ICMP@#$check_icmp_path#g" $DESTDIR$sharedir/check_mk_templates.cfg &&
- sed -i "s#@CGIURL@#${url_prefix}nagios/cgi-bin/#g" $DESTDIR$sharedir/check_mk_templates.cfg &&
- sed -i "s#@PNPURL@#${url_prefix}pnp4nagios/#g" $DESTDIR$sharedir/check_mk_templates.cfg &&
mkdir -p "$DESTDIR$nagconfdir"
if [ ! -e $DESTDIR$nagconfdir/check_mk_templates.cfg ] ; then
ln -s $sharedir/check_mk_templates.cfg $DESTDIR$nagconfdir 2>/dev/null
@@ -928,53 +918,6 @@ Please install mod_python and restart Apache."
</Directory>
</IfModule>
EOF
- elif [ "$OMD_ROOT" ] ; then
- ln -sfn ../../check_mk/apache-local.conf $OMD_ROOT/etc/apache/conf.d/check_mk.conf
- cat <<EOF > $OMD_ROOT/etc/check_mk/apache-local.conf
-# Local Apache configuration file for Check_MK
-# This file has been created by a local ./setup.sh of Check_MK
-# within the OMD site $OMD_SITE
-#
-# This shares the check_mk agents delivered with the OMD
-# version via HTTP
-Alias /$OMD_SITE/check_mk/agents $OMD_ROOT/local/share/check_mk/agents
-<Directory $OMD_ROOT/local/share/check_mk/agents>
- Options +Indexes
- Order deny,allow
- allow from all
-</Directory>
-
-<IfModule mod_python.c>
-
- Alias /$OMD_SITE/check_mk $OMD_ROOT/local/share/check_mk/web/htdocs
- <Directory $OMD_ROOT/local/share/check_mk/web/htdocs>
- AddHandler mod_python .py
- PythonHandler index
- PythonInterpreter $OMD_SITE
- DirectoryIndex index.py
-
- Order deny,allow
- allow from all
-
- ErrorDocument 403 "<h1>Authentication Problem</h1>Either you've entered an invalid password or the authentication<br>configuration of your check_mk web pages is incorrect.<br>"
- ErrorDocument 500 "<h1>Server or Configuration Problem</h1>A Server problem occurred. You'll find details in the error log of Apache. One possible reason is, that the file <tt>$OMD_ROOT/etc/htpasswd</tt> is missing. You can manage that file with <tt>htpasswd</tt> or <tt>htpasswd2</tt>."
- </Directory>
- # Automation is done without HTTP Auth
- <Location "/$OMD_SITE/check_mk/automation.py">
- Order allow,deny
- Allow from all
- Satisfy any
- </Location>
-</IfModule>
-
-<IfModule !mod_python.c>
- Alias /$OMD_SITE/check_mk $OMD_ROOT/local/share/check_mk/web/htdocs
- <Directory $OMD_ROOT/local/share/check_mk/web/htdocs>
- Deny from all
- ErrorDocument 403 "<h1>Check_mk: Incomplete Apache2 Installation</h1>You need mod_python in order to run the web interface of check_mk.<br> Please install mod_python and restart Apache."
- </Directory>
-</IfModule>
-EOF
fi &&
for d in $DESTDIR$apache_config_dir/../*/*$NAME{,.conf} ; do
if [ -e "$d" ] && ! grep -q "$web_dir/htdocs" $d ; then
@@ -986,8 +929,6 @@ EOF
# WATO. Also create an empty and Apache-writable auth.serials
serials_file=$DESTDIR${htpasswd_file%/*}/auth.serials &&
touch "$serials_file" &&
- (chown $wwwuser "$serials_file" || true) &&
- (chown $wwwuser "$htpasswd_file" || true) &&
create_sudo_configuration &&
if [ "$enable_mkeventd" = yes ]
then
@@ -999,7 +940,6 @@ EOF
install -m 755 bin/mkevent bin/mkeventd $DESTDIR$bindir &&
install -m 4754 bin/mkeventd_open514 -g $wwwgroup $DESTDIR$bindir &&
mkdir -p $DESTDIR$confdir/mkeventd.d/wato &&
- chown $wwwuser.$wwwgroup $DESTDIR$confdir/mkeventd.d/wato &&
if [ ! -e "$DESTDIR$confdir/multisite.d/mkeventd.mk" ] ; then
mkdir -p $DESTDIR$confdir/multisite.d &&
echo 'mkeventd_enabled = True' > $DESTDIR$confdir/multisite.d/mkeventd.mk