[icinga-checkins] icinga.org: icinga-core/fholzer/core: bugfix get_error_from_log

git at icinga.org git at icinga.org
Tue Apr 24 15:06:00 CEST 2012


Module: icinga-core
Branch: fholzer/core
Commit: de8fa629a66a8e6136901cf3c5d1ae5d0ac7729c
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=de8fa629a66a8e6136901cf3c5d1ae5d0ac7729c

Author: Franz Holzer <office at frankstar.at>
Date:   Tue Apr 24 15:06:05 2012 +0200

bugfix get_error_from_log

---

 tools/icinga_verification.pl |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/icinga_verification.pl b/tools/icinga_verification.pl
index 1708558..854eb14 100644
--- a/tools/icinga_verification.pl
+++ b/tools/icinga_verification.pl
@@ -201,7 +201,7 @@ chomp($selinux);
 
 #log file test
 #FIXME - PATH to syslog not hardcoded
-my $idolog = get_error_from_log("/var/log/messages", 'ido2db');
+my @idolog = get_error_from_log("/var/log/messages", 'ido2db');
 
 ################################
 # Icinga Checks
@@ -347,7 +347,7 @@ idomod Information:
  SSL Status: $idomodssl
  TCP Port: $idomodtcpport
  
- $idolog
+ @idolog
 ##################### Test Results: ########################
 
 Mysql Connection with ido2db.cfg:
@@ -512,10 +512,11 @@ sub get_error_from_log ($$) {
 
     if ( open( my $fh, '<', $file ) ) {
         while ( my $line = <$fh> ) {
-            chomp($line);
-			print "\nread error:\n $line \nfrom $file","\n", if $verbose;
-            if ( $line =~ /\$key/ ) {
+            chomp($line);		
+            if ( $line =~ /\s+$key: (.*)/) {
+				print "\nFound error log in:","\n$file for key '$key':","\n$1 ", "\n" if $verbose;
                 return $1;
+				
             }
         }
     } else {





More information about the icinga-checkins mailing list