Module: check_mk
Branch: master
Commit: d0ccf09e5eeeabb39827cad7747cd69e48192fa0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d0ccf09e5eeeab…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Tue Jun 21 13:32:11 2016 +0200
3145 FIX solaris agent: fileinfo patterns that match a directory will no longer output
items for the files in that directory
Please note that this behaviour was not intended and differed from other agents. The
created items
are also incorrectly formatted so we assume no one used/wanted this.
---
.werks/3145 | 11 +++++++++++
ChangeLog | 1 +
agents/check_mk_agent.solaris | 15 ++++++++-------
3 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/.werks/3145 b/.werks/3145
new file mode 100644
index 0000000..303f215
--- /dev/null
+++ b/.werks/3145
@@ -0,0 +1,11 @@
+Title: solaris agent: fileinfo patterns that match a directory will no longer output
items for the files in that directory
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i1
+Date: 1466508571
+
+Please note that this behaviour was not intended and differed from other agents. The
created items
+are also incorrectly formatted so we assume no one used/wanted this.
diff --git a/ChangeLog b/ChangeLog
index deeb95e..94947ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -277,6 +277,7 @@
* 3638 FIX: cisco_qos: fixed wrong unit handling
* 3548 FIX: agent_netapp: fixed agent exception for channels without shelfes.
improved 7mode/clustermode differentation...
* 3549 FIX: netapp_api_snapshots: now correctly processes offline volumes...
+ * 3145 FIX: solaris agent: fileinfo patterns that match a directory will no longer
output items for the files in that directory...
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/agents/check_mk_agent.solaris b/agents/check_mk_agent.solaris
index cf1d3ca..839432e 100755
--- a/agents/check_mk_agent.solaris
+++ b/agents/check_mk_agent.solaris
@@ -353,17 +353,18 @@ 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
ls $file > /dev/null 2>&1
if [ $? -eq 0 ]; then
- ls $file | sort -u | \
- /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");
- }'
+ 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