[icinga-checkins] icinga.org: icinga-core/fholzer/core: Make binary checks more robust

git at icinga.org git at icinga.org
Sat Apr 21 20:23:45 CEST 2012


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

Author: Alexander Wirt <formorer at debian.org>
Date:   Sat Apr 21 10:32:19 2012 +0200

Make binary checks more robust

---

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

diff --git a/tools/icinga_verification.pl b/tools/icinga_verification.pl
index ad4a715..cbfa792 100644
--- a/tools/icinga_verification.pl
+++ b/tools/icinga_verification.pl
@@ -103,10 +103,10 @@ if (!$icinga_base){
 my $perlversion = $^V;
 
 # Kernel version
-my $osversion = qx(uname -rp) ;
+my $osversion = which('uname') ? qx(uname -rp) : 'uname binary not found';
 
 # PHP Version
-my $phpversion = (qx(php -v))[0];
+my $phpversion = which('php') ? (qx(php -v))[0] : 'php binary not found';
 chomp($phpversion);
 
 #Current Time/Date
@@ -114,10 +114,10 @@ my $date = localtime();
 
 #Apache Info
 #FIXME we need a way of testing several binarynames. on debian this is apache2
-my @apacheinfo = (qx(httpd -V))[0,2,3,5,6,7,8];
+my @apacheinfo = which ('httpd') ? (qx(httpd -V))[0,2,3,5,6,7,8] : 'httpd binary not found';
 
 #Mysql Info
-my $mysqlver = (split(",", qx(mysql -V)))[0];
+my $mysqlver = which('mysql') ? (split(",", qx(mysql -V)))[0] : 'mysql binary not found';
 
 ######ADD JAVA HOMES, ORCALE HOMES, PATH -> via env | grep ######
 





More information about the icinga-checkins mailing list