[icinga-checkins] icinga.org: icinga-core/fholzer/core: Retrieve ido2db version

git at icinga.org git at icinga.org
Mon Apr 23 08:00:07 CEST 2012


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

Author: Alexander Wirt <formorer at debian.org>
Date:   Sun Apr 22 09:48:11 2012 +0200

Retrieve ido2db version

---

 tools/icinga_verification.pl |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/tools/icinga_verification.pl b/tools/icinga_verification.pl
index cad2aa1..57cf3db 100644
--- a/tools/icinga_verification.pl
+++ b/tools/icinga_verification.pl
@@ -36,6 +36,7 @@ sub slurp($);
 sub get_distribution;
 sub find_icinga_dir;
 sub get_icinga_version;
+sub get_ido2db_version;
 
 ################################
 # Option parsing
@@ -137,6 +138,10 @@ my $distribution = get_distribution();
 
 # icinga version
 my $icingaversion = get_icinga_version();
+
+# ido2db version
+my $ido2dbversion = get_ido2db_version();
+
 ################################
 # Icinga Checks
 ################################
@@ -273,6 +278,7 @@ MySQL Information:
  $mysqlver
 Icinga Informations:
  icinga version: $icingaversion
+ ido2db version: $ido2dbversion
  idomod Connections: $idocheck
  Icinga DB-Version: $result_icingadb[0]
  ido2db last Connection Info:
@@ -384,3 +390,17 @@ sub get_icinga_version {
         return 'icinga binary not found in PATH';
     }
 }
+
+sub get_ido2db_version {
+    if (which('ido2db')) {
+        open( my $fh, '-|', "ido2db --help" );
+        while (my $line = <$fh>) {
+            if ($line =~ /^IDO2DB (.*)/) {
+                return $1;
+            }
+        }
+        close($fh);
+    } else {
+        return 'ido2db binary not found in PATH';
+    }
+}





More information about the icinga-checkins mailing list