Till Brehm
2015-05-06 68af0bbdd603e8b8bb9eae2cbd55264ce0647ddb
server/lib/classes/monitor_tools.inc.php
@@ -62,6 +62,21 @@
            $mainver = array_filter($mainver);
            $mainver = current($mainver).'.'.next($mainver);
            switch ($mainver){
            case "15.04":
               $relname = "(Vivid Vervet)";
               break;
            case "14.10":
               $relname = "(Utopic Unicorn)";
               break;
            case "14.04":
               $relname = "(Trusty Tahr)";
               break;
            case "13.10":
               $relname = "(Saucy Salamander)";
               break;
            case "13.04":
               $relname = "(Raring Ringtail)";
               break;
            case "12.10":
               $relname = "(Quantal Quetzal)";
               break;
@@ -132,9 +147,14 @@
            $distver = 'Squeeze/Sid';
            $distid = 'debian60';
            $distbaseid = 'debian';
         } elseif (strstr(trim(file_get_contents('/etc/debian_version')), '7.0') || strstr(trim(file_get_contents('/etc/debian_version')), '7.1') || trim(file_get_contents('/etc/debian_version')) == 'wheezy/sid') {
         } elseif (strstr(trim(file_get_contents('/etc/debian_version')), '7.0') || substr(trim(file_get_contents('/etc/debian_version')),0,2) == '7.' || trim(file_get_contents('/etc/debian_version')) == 'wheezy/sid') {
            $distname = 'Debian';
            $distver = 'Wheezy/Sid';
            $distid = 'debian60';
            $distbaseid = 'debian';
         } elseif(strstr(trim(file_get_contents('/etc/debian_version')), '8') || substr(trim(file_get_contents('/etc/debian_version')),0,1) == '8') {
            $distname = 'Debian';
            $distver = 'Jessie';
            $distid = 'debian60';
            $distbaseid = 'debian';
         } else {
@@ -201,6 +221,16 @@
            $distver = '5.3';
            $distid = 'centos53';
            $distbaseid = 'fedora';
         } elseif(stristr($content, 'CentOS Linux release 6')) {
            $distname = 'CentOS';
            $distver = 'Unknown';
            $distid = 'centos53';
            $distbaseid = 'fedora';
         } elseif(stristr($content, 'CentOS Linux release 7')) {
            $distname = 'CentOS';
            $distver = 'Unknown';
            $distid = 'centos53';
            $distbaseid = 'fedora';
         } else {
            $distname = 'Redhat';
            $distver = 'Unknown';
@@ -250,7 +280,9 @@
            $filename = $mb['maildir'].'/.quotausage';
            if(file_exists($filename) && !is_link($filename)) {
               $quotafile = file($filename);
               $data[$email]['used'] = trim($quotafile['1']);
               preg_match('/storage.*?([0-9]+)/s', implode('',$quotafile), $storage_value);
               $data[$email]['used'] = $storage_value[1];
               $app->log("Mail storage $email: " . $storage_value[1], LOGLEVEL_DEBUG);
               unset($quotafile);
            } else {
               exec('du -s '.escapeshellcmd($mb['maildir']), $out);
@@ -1147,10 +1179,13 @@
      /*
      * 3ware Controller
      */
      system('which tw_cli', $retval);
      if($retval === 0) {
         $data['output'] = shell_exec('tw_cli info c0');
         // TYPOWORX FIX | Determine Controler-ID
         $availableControlers = shell_exec('tw_cli info | grep -Eo "c[0-9]+');
         $data['output'] = shell_exec('tw_cli info ' . $availableControlers);
         $state = 'ok';
         if(is_array($data['output'])) {
@@ -1571,15 +1606,20 @@
       * Now we have the last log in the array.
       * Check if the outdated-string is found...
       */
      $clamav_outdated_warning = false;
      $clamav_bytecode_updated = false;
      foreach ($lastLog as $line) {
         if (strpos(strtolower($line), 'outdated') !== false) {
            /*
             * Outdatet is only info, because if we set this to warning, the server is
             * as long in state warning, as there is a new version of ClamAv which takes
             * sometimes weeks!
             */
            $state = $this->_setState($state, 'info');
         if (stristr($line,'outdated')) {
            $clamav_outdated_warning = true;
         }
         if(stristr($line,'main.cld is up to date')) {
            $clamav_bytecode_updated = true;
         }
      }
      //* Warn when clamav is outdated and main.cld update failed.
      if($clamav_outdated_warning == true && $clamav_bytecode_updated == false) {
         $state = $this->_setState($state, 'info');
      }
      /*