Module: check_mk
Branch: master
Commit: 203bfd8a62df19dd07a1ee8b9a97dbb3fba60372
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=203bfd8a62df19…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Nov 9 10:30:37 2017 +0100
Huge refactoring of Check_MK base data fetching
* Flipped the data gathering structure.
It was first iterating over all check types and fetching the (agent)
data on demand during the first check and caching these results to
reuse it for the other checks.
This has been changed into two phases:
1. Fetch ALL data (including SNMP scan + walks)
2. Execute discovery/check/inventory logic
* Abstracted collection of data
A new concept of "data sources" has been introduced. Each source
of monitoring data is a data source. The following exist at the
moment:
TCPDataSource
SNMPDataSource
SNMPManagementBoardDataSource
PiggyBackDataSource
DSProgramDataSource
SpecialAgentDataSource
* With the above changes we have a far better situation now
a) Exception handling (-> error reporting) is equal for all sources
b) Caching of raw source data is exactly the same
* This prepares the way for splitting up data fetching, which also
includes expensive timeouts, from the check execution.
Change-Id: I975cb49c8087c5e5d94bdf2786ca60e89c58171c
---
cmk_base/agent_data.py | 1304 +++++++++++++++++++++-----------------
cmk_base/automations/check_mk.py | 30 +-
cmk_base/checking.py | 295 ++++-----
cmk_base/crash_reporting.py | 4 +-
cmk_base/discovery.py | 218 ++-----
cmk_base/inventory.py | 61 +-
cmk_base/modes/check_mk.py | 20 +-
cmk_base/snmp.py | 27 -
lib/paths.py | 4 +-
9 files changed, 977 insertions(+), 986 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=203bfd8a62…
Module: check_mk
Branch: master
Commit: c82eb0f4aa371a6b7ec600dd6785429439881e2a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c82eb0f4aa371a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Nov 21 14:07:46 2017 +0100
5534 FIX Fixed wrong host graph scaling when using DNS names as IPv4 address
When configuring a host to use a DNS name as IPv4 address, the host is not
being pinged anymore via Smart Ping. Instead of this the active check
check_icmp is used. This check produces host graphs, which were scaled wrong
by factor 1000 in previous versions.
Change-Id: I8ecde73d0fe38779d23859681c902b0aad3c1b73
---
.werks/5534 | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/.werks/5534 b/.werks/5534
new file mode 100644
index 0000000..3ffb2c5
--- /dev/null
+++ b/.werks/5534
@@ -0,0 +1,14 @@
+Title: Fixed wrong host graph scaling when using DNS names as IPv4 address
+Level: 1
+Component: core
+Class: fix
+Compatible: compat
+Edition: cee
+State: unknown
+Version: 1.5.0i2
+Date: 1511269458
+
+When configuring a host to use a DNS name as IPv4 address, the host is not
+being pinged anymore via Smart Ping. Instead of this the active check
+check_icmp is used. This check produces host graphs, which were scaled wrong
+by factor 1000 in previous versions.
Module: check_mk
Branch: master
Commit: ff7ab6146060bb87784975686c789cc82ebbeca0
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ff7ab6146060bb…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Mon Nov 20 18:26:39 2017 +0100
5479 FIX fileinfo: handle globbing pattern expansion and whitespace in fileinfo.cfg
This werk fixes the issue that spaces and globbing patterns defined in
fileinfo.cfg were not handled correctly. Now files containing spaces
are recognized corretly and globbing patterns are expanded.
Change-Id: Ic2f710811addd8cfe008d4c45402f60f15a8c601
---
.werks/5479 | 12 ++++++++++++
agents/check_mk_agent.aix | 25 +++++++++++++++----------
agents/check_mk_agent.freebsd | 18 +++++++++++-------
agents/check_mk_agent.linux | 23 ++++++++++++-----------
agents/check_mk_agent.macosx | 18 +++++++++++-------
agents/check_mk_agent.openwrt | 18 +++++++++++-------
agents/check_mk_agent.solaris | 42 +++++++++++++++++++++++-------------------
7 files changed, 95 insertions(+), 61 deletions(-)
diff --git a/.werks/5479 b/.werks/5479
new file mode 100644
index 0000000..5612ef6
--- /dev/null
+++ b/.werks/5479
@@ -0,0 +1,12 @@
+Title: fileinfo: handle globbing pattern expansion and whitespace in fileinfo.cfg
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i2
+Date: 1511197837
+Class: fix
+
+This werk fixes the issue that spaces and globbing patterns defined in
+fileinfo.cfg were not handled correctly. Now files containing spaces
+are recognized corretly and globbing patterns are expanded.
diff --git a/agents/check_mk_agent.aix b/agents/check_mk_agent.aix
index 4031f66..532b08f 100755
--- a/agents/check_mk_agent.aix
+++ b/agents/check_mk_agent.aix
@@ -291,16 +291,21 @@ if [ -r "$MK_CONFDIR/fileinfo.cfg" ]; then
date +%s
# simulate output of the Linux "stat -c "%n|%s|%Y" command
# TODO: feel free to improve this command. It opens the perl interpreter for every file found...
- for pattern in $(cat "$MK_CONFDIR/fileinfo.cfg" 2>/dev/null)
- do
- if [ -f "$pattern" ]; then
- ls -1 "$pattern"
- fi
- done |\
- while read file
- do
- /usr/bin/perl -e 'printf "$_|%s|%s\n", (stat) [7,9] for @ARGV' "$file"
- done
+ OLD_IFS=$IFS
+ IFS='
+'
+ while read -r pattern; do
+ case $pattern in
+ /*) for file in $pattern; do
+ if [ -f "$file" ]; then
+ /usr/bin/perl -e 'printf "$_|%s|%s\n", (stat) [7,9] for @ARGV' "$file"
+ else
+ echo "$file|missing|`date +%s`"
+ fi
+ done ;;
+ esac
+ done < "$MK_CONFDIR/fileinfo.cfg"
+ IFS=$OLD_IFS
fi
# powerHA
diff --git a/agents/check_mk_agent.freebsd b/agents/check_mk_agent.freebsd
index d68df23..a944f61 100755
--- a/agents/check_mk_agent.freebsd
+++ b/agents/check_mk_agent.freebsd
@@ -380,14 +380,18 @@ fi
if [ -r "$MK_CONFDIR/fileinfo.cfg" ] ; then
echo '<<<fileinfo:sep(124)>>>'
date +%s
- for line in $(cat "$MK_CONFDIR/fileinfo.cfg")
- do
- stat -f "%N|%z|%m" "$line" 2>/dev/null
- if [ $? -ne 0 ]; then
- echo "$line|missing|$(date +%s)"
- fi
- done
+ OLD_IFS=$IFS
+ IFS='
+'
+ while read -r pattern; do
+ case $pattern in
+ /*) for file in $pattern; do
+ stat -f "%N|%z|%m" "$file" 2>/dev/null || echo "$file|missing|`date +%s`"
+ done ;;
+ esac
+ done < "$MK_CONFDIR/fileinfo.cfg"
+ IFS=$OLD_IFS
fi
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index 0e08cbf..7ce4333 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -766,18 +766,19 @@ function replace_datevariable()
if [ -r "$MK_CONFDIR/fileinfo.cfg" ] ; then
echo '<<<fileinfo:sep(124)>>>'
date +%s
- for line in $(cat "$MK_CONFDIR/fileinfo.cfg")
- do
- # only work on lines containing files, skip e.g. comments and blank lines
- if [ "${line:0:1}" = "/" ]; then
- line=$(replace_datevariable "$line")
- stat -c "%n|%s|%Y" "${line}" 2>/dev/null
- if [ $? -ne 0 ]; then
- echo "$line|missing|$(date +%s)"
- fi
- fi
- done
+ OLD_IFS=$IFS
+ IFS='
+'
+ while read -r pattern; do
+ case $pattern in
+ /*) pattern=`replace_datevariable "$pattern"`
+ for file in $pattern; do
+ stat -c "%n|%s|%Y" "$file" 2> /dev/null || echo "$file|missing|`date +%s`"
+ done ;;
+ esac
+ done < "$MK_CONFDIR/fileinfo.cfg"
+ IFS=$OLD_IFS
fi
# Get stats about OMD monitoring cores running on this machine.
diff --git a/agents/check_mk_agent.macosx b/agents/check_mk_agent.macosx
index a93ba28..99d5782 100755
--- a/agents/check_mk_agent.macosx
+++ b/agents/check_mk_agent.macosx
@@ -93,14 +93,18 @@ netstat -ntfinet | awk ' /^tcp/ { c[$6]++; } END { for (x in c) { print x, c[x];
if [ -r "$MK_CONFDIR/fileinfo.cfg" ] ; then
echo '<<<fileinfo:sep(124)>>>'
date +%s
- for line in $(cat "$MK_CONFDIR/fileinfo.cfg")
- do
- stat -f "%N|%z|%m" "$line" 2>/dev/null
- if [ $? -ne 0 ]; then
- echo "$line|missing|$(date +%s)"
- fi
- done
+ OLD_IFS=$IFS
+ IFS='
+'
+ while read -r pattern; do
+ case $pattern in
+ /*) for file in $pattern; do
+ stat -f "%N|%z|%m" "$file" 2>/dev/null || echo "$file|missing|`date +%s`"
+ done ;;
+ esac
+ done < "$MK_CONFDIR/fileinfo.cfg"
+ IFS=$OLD_IFS
fi
if type tmutil >/dev/null
diff --git a/agents/check_mk_agent.openwrt b/agents/check_mk_agent.openwrt
index 5b10b6a..bd14ef6 100755
--- a/agents/check_mk_agent.openwrt
+++ b/agents/check_mk_agent.openwrt
@@ -681,14 +681,18 @@ fi
if [ -r "$MK_CONFDIR/fileinfo.cfg" ] ; then
echo '<<<fileinfo:sep(124)>>>'
date +%s
- for line in $(cat "$MK_CONFDIR/fileinfo.cfg")
- do
- stat -c "%n|%s|%Y" "$line" 2>/dev/null
- if [ $? -ne 0 ]; then
- echo "$line|missing|$(date +%s)"
- fi
- done
+ OLD_IFS=$IFS
+ IFS='
+'
+ while read -r pattern; do
+ case $pattern in
+ /*) for file in $pattern; do
+ stat -c "%n|%s|%Y" "$file" 2>/dev/null || echo "$file|missing|`date +%s`"
+ done ;;
+ esac
+ done < "$MK_CONFDIR/fileinfo.cfg"
+ IFS=$OLD_IFS
fi
# Get stats about OMD monitoring cores running on this machine.
diff --git a/agents/check_mk_agent.solaris b/agents/check_mk_agent.solaris
index 5eda934..a27b13b 100755
--- a/agents/check_mk_agent.solaris
+++ b/agents/check_mk_agent.solaris
@@ -368,26 +368,30 @@ if [ -f "$MK_CONFDIR/fileinfo.cfg" ]
then
echo '<<<fileinfo:sep(124)>>>'
/usr/bin/perl -e 'print time."\n"'
+
# note: patterns in the fileinfo.cfg are resolved inside this loop
- for file in $(cat "$MK_CONFDIR/fileinfo.cfg")
- do
- # only work on lines containing files, skip e.g. comments and blank lines
- if [ "${file:0:1}" = "/" ]; then
- file=$(replace_datevariable "$file")
- ls "$file" > /dev/null 2>&1
- if [ $? -eq 0 ]; then
- echo "$file" | \
- /usr/bin/perl -e '
- while(my $file = <>) {
- $file =~ s/\n$//;
- ($device, $inode, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat($file);
- print("$file|$size|$mtime\n");
- }'
- else
- echo "$file|missing|$(/usr/bin/perl -e 'print time')"
- fi
- fi
- done
+ OLD_IFS=$IFS
+ IFS='
+'
+ while read -r pattern; do
+ case $pattern in
+ /*) pattern=`replace_datevariable "$pattern"`
+ for file in $pattern; do
+ if [ -f "$file" ]; then
+ echo "$file" | /usr/bin/perl -e '
+ while(my $file = <>) {
+ $file =~ s/\n$//;
+ ($device, $inode, $mode, $nlink, $uid, $gid, $rdev, $size,
+ $atime, $mtime, $ctime, $blksize, $blocks) = stat($file);
+ print("$file|$size|$mtime\n");
+ }'
+ else
+ echo "$file|missing|`/usr/bin/perl -e 'print time'`"
+ fi
+ done ;;
+ esac
+ done < "$MK_CONFDIR/fileinfo.cfg"
+ IFS=$OLD_IFS
fi
# Libelle Business Shadow