Subversion Repositories ALCASAR

Rev

Rev 3179 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 3179 Rev 3287
Line 279... Line 279...
279
            }
279
            }
280
        }
280
        }
281
 
281
 
282
        if (defined('PSI_SHOW_VIRTUALIZER_INFO') && PSI_SHOW_VIRTUALIZER_INFO) {
282
        if (defined('PSI_SHOW_VIRTUALIZER_INFO') && PSI_SHOW_VIRTUALIZER_INFO) {
283
            $virt = $this->_sys->getVirtualizer();
283
            $virt = $this->_sys->getVirtualizer();
284
            $first = true;
-
 
285
            $virtstring = "";
284
            $virtstring = "";
286
            foreach ($virt as $virtkey=>$virtvalue) if ($virtvalue) {
285
            foreach ($virt as $virtkey=>$virtvalue) if ($virtvalue) {
287
                if ($first) {
286
                if ($virtstring !== "") {
288
                    $first = false;
-
 
289
                } else {
-
 
290
                    $virtstring .= ", ";
287
                    $virtstring .= ", ";
291
                }
288
                }
292
                if ($virtkey === 'microsoft') {
289
                if ($virtkey === 'microsoft') {
-
 
290
                    if (!isset($virt["wsl"]) || !$virt["wsl"]) {
293
                    $virtstring .= 'hyper-v';
291
                        $virtstring .= 'hyper-v';
-
 
292
                    }
294
                } elseif ($virtkey === 'kvm') {
293
                } elseif ($virtkey === 'kvm') {
295
                    $virtstring .= 'qemu-kvm';
294
                    $virtstring .= 'qemu-kvm';
296
                } elseif ($virtkey === 'oracle') {
295
                } elseif ($virtkey === 'oracle') {
297
                    $virtstring .= 'virtualbox';
296
                    $virtstring .= 'virtualbox';
298
                } elseif ($virtkey === 'zvm') {
297
                } elseif ($virtkey === 'zvm') {
Line 659... Line 658...
659
     */
658
     */
660
    private function _buildMbinfo()
659
    private function _buildMbinfo()
661
    {
660
    {
662
        $mbinfo = $this->_xml->addChild('MBInfo');
661
        $mbinfo = $this->_xml->addChild('MBInfo');
663
        $temp = $fan = $volt = $power = $current = $other = null;
662
        $temp = $fan = $volt = $power = $current = $other = null;
-
 
663
        $hideSensors = array();
664
 
664
 
665
        if (sizeof(unserialize(PSI_MBINFO))>0) {
665
        if (sizeof(unserialize(PSI_MBINFO))>0) {
-
 
666
            if (defined('PSI_HIDE_SENSORS') && is_string(PSI_HIDE_SENSORS)) {
-
 
667
                 if (preg_match(ARRAY_EXP, PSI_HIDE_SENSORS)) {
-
 
668
                    $hideSensors = eval(PSI_HIDE_SENSORS);
-
 
669
                } else {
-
 
670
                    $hideSensors = array(PSI_HIDE_SENSORS);
-
 
671
                }
-
 
672
            }
666
            foreach (unserialize(PSI_MBINFO) as $mbinfoclass) {
673
            foreach (unserialize(PSI_MBINFO) as $mbinfoclass) {
667
                $mbinfo_data = new $mbinfoclass();
674
                $mbinfo_data = new $mbinfoclass();
668
                $mbinfo_detail = $mbinfo_data->getMBInfo();
675
                $mbinfo_detail = $mbinfo_data->getMBInfo();
669
 
-
 
670
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='temperature') foreach ($mbinfo_detail->getMbTemp() as $dev) {
676
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='temperature' || $this->_sysinfo->getBlockName()==='mbinfo') foreach ($mbinfo_detail->getMbTemp() as $dev) {
671
                    if ($temp == null) {
-
 
672
                        $temp = $mbinfo->addChild('Temperature');
-
 
673
                    }
-
 
674
                    $item = $temp->addChild('Item');
-
 
675
                    $item->addAttribute('Label', $dev->getName());
677
                    $mbinfo_name = $dev->getName();
676
                    $item->addAttribute('Value', $dev->getValue());
678
                    if (!in_array($mbinfo_name, $hideSensors, true)) {
677
                    $alarm = false;
-
 
678
                    if ($dev->getMax() !== null) {
-
 
679
                        $item->addAttribute('Max', $dev->getMax());
-
 
680
                        $alarm = true;
-
 
681
                    }
-
 
682
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && ($dev->getEvent() !== "") && (((strtolower($dev->getEvent())) !== "alarm") || $alarm || ($dev->getValue() == 0))) {
-
 
683
                        $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
-
 
684
                    }
-
 
685
                }
-
 
686
 
-
 
687
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='fans') foreach ($mbinfo_detail->getMbFan() as $dev) {
-
 
688
                    if ($fan == null) {
679
                        if ($temp == null) {
689
                        $fan = $mbinfo->addChild('Fans');
680
                            $temp = $mbinfo->addChild('Temperature');
690
                    }
681
                        }
691
                    $item = $fan->addChild('Item');
682
                        $item = $temp->addChild('Item');
692
                    $item->addAttribute('Label', $dev->getName());
683
                        $item->addAttribute('Label', $mbinfo_name);
693
                    $item->addAttribute('Value', $dev->getValue());
684
                        $item->addAttribute('Value', $dev->getValue());
694
                    $alarm = false;
685
                        $alarm = false;
695
                    if ($dev->getMin() !== null) {
686
                        if ($dev->getMax() !== null) {
696
                        $item->addAttribute('Min', $dev->getMin());
687
                            $item->addAttribute('Max', $dev->getMax());
697
                        $alarm = true;
688
                            $alarm = true;
698
                    }
-
 
699
                    if ($dev->getUnit() !== "") {
-
 
700
                        $item->addAttribute('Unit', $dev->getUnit());
-
 
701
                    }
689
                        }
702
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && ($dev->getEvent() !== "") && (((strtolower($dev->getEvent())) !== "alarm") || $alarm || ($dev->getValue() == 0))) {
690
                        if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && ($dev->getEvent() !== "") && (((strtolower($dev->getEvent())) !== "alarm") || $alarm || ($dev->getValue() == 0))) {
703
                        $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
691
                            $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
-
 
692
                        }
704
                    }
693
                    }
705
                }
694
                }
706
 
695
 
707
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='voltage') foreach ($mbinfo_detail->getMbVolt() as $dev) {
696
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='fans' || $this->_sysinfo->getBlockName()==='mbinfo') foreach ($mbinfo_detail->getMbFan() as $dev) {
-
 
697
                    $mbinfo_name = $dev->getName();
-
 
698
                    if (!in_array($mbinfo_name, $hideSensors, true)) {
708
                    if ($volt == null) {
699
                        if ($fan == null) {
709
                        $volt = $mbinfo->addChild('Voltage');
700
                            $fan = $mbinfo->addChild('Fans');
710
                    }
701
                        }
711
                    $item = $volt->addChild('Item');
702
                        $item = $fan->addChild('Item');
712
                    $item->addAttribute('Label', $dev->getName());
703
                        $item->addAttribute('Label', $mbinfo_name);
713
                    $item->addAttribute('Value', $dev->getValue());
704
                        $item->addAttribute('Value', $dev->getValue());
714
                    $alarm = false;
705
                        $alarm = false;
715
                    if (($dev->getMin() === null) || ($dev->getMin() != 0) || ($dev->getMax() === null) || ($dev->getMax() != 0)) {
-
 
716
                        if ($dev->getMin() !== null) {
706
                        if ($dev->getMin() !== null) {
717
                            $item->addAttribute('Min', $dev->getMin());
707
                            $item->addAttribute('Min', $dev->getMin());
718
                            $alarm = true;
708
                            $alarm = true;
719
                        }
709
                        }
720
                        if ($dev->getMax() !== null) {
710
                        if ($dev->getUnit() !== "") {
721
                            $item->addAttribute('Max', $dev->getMax());
711
                            $item->addAttribute('Unit', $dev->getUnit());
722
                            $alarm = true;
712
                        }
-
 
713
                        if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && ($dev->getEvent() !== "") && (((strtolower($dev->getEvent())) !== "alarm") || $alarm || ($dev->getValue() == 0))) {
-
 
714
                            $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
723
                        }
715
                        }
724
                    }
-
 
725
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && ($dev->getEvent() !== "") && (((strtolower($dev->getEvent())) !== "alarm") || $alarm || ($dev->getValue() == 0))) {
-
 
726
                        $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
-
 
727
                    }
716
                    }
728
                }
717
                }
729
 
718
 
730
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='power') foreach ($mbinfo_detail->getMbPower() as $dev) {
719
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='voltage' || $this->_sysinfo->getBlockName()==='mbinfo') foreach ($mbinfo_detail->getMbVolt() as $dev) {
-
 
720
                    $mbinfo_name = $dev->getName();
-
 
721
                    if (!in_array($mbinfo_name, $hideSensors, true)) {
731
                    if ($power == null) {
722
                        if ($volt == null) {
732
                        $power = $mbinfo->addChild('Power');
723
                            $volt = $mbinfo->addChild('Voltage');
733
                    }
724
                        }
734
                    $item = $power->addChild('Item');
725
                        $item = $volt->addChild('Item');
735
                    $item->addAttribute('Label', $dev->getName());
726
                        $item->addAttribute('Label', $mbinfo_name);
736
                    $item->addAttribute('Value', $dev->getValue());
727
                        $item->addAttribute('Value', $dev->getValue());
737
                    $alarm = false;
728
                        $alarm = false;
-
 
729
                        if (($dev->getMin() === null) || ($dev->getMin() != 0) || ($dev->getMax() === null) || ($dev->getMax() != 0)) {
-
 
730
                            if ($dev->getMin() !== null) {
-
 
731
                                $item->addAttribute('Min', $dev->getMin());
-
 
732
                                $alarm = true;
-
 
733
                            }
738
                    if ($dev->getMax() !== null) {
734
                            if ($dev->getMax() !== null) {
739
                        $item->addAttribute('Max', $dev->getMax());
735
                                $item->addAttribute('Max', $dev->getMax());
740
                        $alarm = true;
736
                                $alarm = true;
-
 
737
                            }
741
                    }
738
                        }
742
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && ($dev->getEvent() !== "") && (((strtolower($dev->getEvent())) !== "alarm") || $alarm || ($dev->getValue() == 0))) {
739
                        if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && ($dev->getEvent() !== "") && (((strtolower($dev->getEvent())) !== "alarm") || $alarm || ($dev->getValue() == 0))) {
743
                        $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
740
                            $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
-
 
741
                        }
744
                    }
742
                    }
745
                }
743
                }
746
 
744
 
747
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='current') foreach ($mbinfo_detail->getMbCurrent() as $dev) {
745
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='power' || $this->_sysinfo->getBlockName()==='mbinfo') foreach ($mbinfo_detail->getMbPower() as $dev) {
748
                    if ($current == null) {
-
 
749
                        $current = $mbinfo->addChild('Current');
-
 
750
                    }
-
 
751
                    $item = $current->addChild('Item');
-
 
752
                    $item->addAttribute('Label', $dev->getName());
746
                    $mbinfo_name = $dev->getName();
753
                    $item->addAttribute('Value', $dev->getValue());
747
                    if (!in_array($mbinfo_name, $hideSensors, true)) {
754
                    $alarm = false;
-
 
755
                    if (($dev->getMin() === null) || ($dev->getMin() != 0) || ($dev->getMax() === null) || ($dev->getMax() != 0)) {
-
 
756
                        if ($dev->getMin() !== null) {
748
                        if ($power == null) {
757
                            $item->addAttribute('Min', $dev->getMin());
749
                            $power = $mbinfo->addChild('Power');
758
                            $alarm = true;
-
 
759
                        }
750
                        }
-
 
751
                        $item = $power->addChild('Item');
-
 
752
                        $item->addAttribute('Label', $mbinfo_name);
-
 
753
                        $item->addAttribute('Value', $dev->getValue());
-
 
754
                        $alarm = false;
760
                        if ($dev->getMax() !== null) {
755
                        if ($dev->getMax() !== null) {
761
                            $item->addAttribute('Max', $dev->getMax());
756
                            $item->addAttribute('Max', $dev->getMax());
762
                            $alarm = true;
757
                            $alarm = true;
763
                        }
758
                        }
764
                    }
-
 
765
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && ($dev->getEvent() !== "") && (((strtolower($dev->getEvent())) !== "alarm") || $alarm || ($dev->getValue() == 0))) {
759
                        if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && ($dev->getEvent() !== "") && (((strtolower($dev->getEvent())) !== "alarm") || $alarm || ($dev->getValue() == 0))) {
766
                        $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
760
                            $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
-
 
761
                        }
767
                    }
762
                    }
768
                }
763
                }
769
 
764
 
770
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='other') foreach ($mbinfo_detail->getMbOther() as $dev) {
765
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='current' || $this->_sysinfo->getBlockName()==='mbinfo') foreach ($mbinfo_detail->getMbCurrent() as $dev) {
-
 
766
                    $mbinfo_name = $dev->getName();
-
 
767
                    if (!in_array($mbinfo_name, $hideSensors, true)) {
771
                    if ($other == null) {
768
                        if ($current == null) {
772
                        $other = $mbinfo->addChild('Other');
769
                            $current = $mbinfo->addChild('Current');
773
                    }
770
                        }
774
                    $item = $other->addChild('Item');
771
                        $item = $current->addChild('Item');
775
                    $item->addAttribute('Label', $dev->getName());
772
                        $item->addAttribute('Label', $mbinfo_name);
776
                    $item->addAttribute('Value', $dev->getValue());
773
                        $item->addAttribute('Value', $dev->getValue());
-
 
774
                        $alarm = false;
-
 
775
                        if (($dev->getMin() === null) || ($dev->getMin() != 0) || ($dev->getMax() === null) || ($dev->getMax() != 0)) {
777
                    if ($dev->getUnit() !== "") {
776
                            if ($dev->getMin() !== null) {
778
                        $item->addAttribute('Unit', $dev->getUnit());
777
                                $item->addAttribute('Min', $dev->getMin());
-
 
778
                                $alarm = true;
-
 
779
                            }
-
 
780
                            if ($dev->getMax() !== null) {
-
 
781
                                $item->addAttribute('Max', $dev->getMax());
-
 
782
                                $alarm = true;
-
 
783
                            }
-
 
784
                        }
-
 
785
                        if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && ($dev->getEvent() !== "") && (((strtolower($dev->getEvent())) !== "alarm") || $alarm || ($dev->getValue() == 0))) {
-
 
786
                            $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
-
 
787
                        }
779
                    }
788
                    }
-
 
789
                }
-
 
790
 
-
 
791
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='other' || $this->_sysinfo->getBlockName()==='mbinfo') foreach ($mbinfo_detail->getMbOther() as $dev) {
-
 
792
                    $mbinfo_name = $dev->getName();
-
 
793
                    if (!in_array($mbinfo_name, $hideSensors, true)) {
-
 
794
                        if ($other == null) {
-
 
795
                            $other = $mbinfo->addChild('Other');
-
 
796
                        }
-
 
797
                        $item = $other->addChild('Item');
-
 
798
                        $item->addAttribute('Label', $mbinfo_name);
-
 
799
                        $item->addAttribute('Value', $dev->getValue());
-
 
800
                        if ($dev->getUnit() !== "") {
-
 
801
                            $item->addAttribute('Unit', $dev->getUnit());
-
 
802
                        }
780
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") {
803
                        if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") {
781
                        $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
804
                            $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
-
 
805
                        }
782
                    }
806
                    }
783
                }
807
                }
784
            }
808
            }
785
        }
809
        }
786
    }
810
    }
Line 895... Line 919...
895
            if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='vitals') $this->_buildVitals();
919
            if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='vitals') $this->_buildVitals();
896
            if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='network') $this->_buildNetwork();
920
            if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='network') $this->_buildNetwork();
897
            if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='hardware') $this->_buildHardware();
921
            if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='hardware') $this->_buildHardware();
898
            if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='memory') $this->_buildMemory();
922
            if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='memory') $this->_buildMemory();
899
            if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='filesystem') $this->_buildFilesystems();
923
            if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='filesystem') $this->_buildFilesystems();
900
            if (!$this->_sysinfo->getBlockName() || in_array($this->_sysinfo->getBlockName(), array('voltage','current','temperature','fans','power','other'))) $this->_buildMbinfo();
924
            if (!$this->_sysinfo->getBlockName() || in_array($this->_sysinfo->getBlockName(), array('mbinfo','voltage','current','temperature','fans','power','other'))) $this->_buildMbinfo();
901
            if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='ups') $this->_buildUpsinfo();
925
            if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='ups') $this->_buildUpsinfo();
902
        }
926
        }
903
        if (!$this->_sysinfo->getBlockName()) $this->_buildPlugins();
927
        if (!$this->_sysinfo->getBlockName()) $this->_buildPlugins();
904
        $this->_xml->combinexml($this->_errors->errorsAddToXML($this->_sysinfo->getEncoding()));
928
        $this->_xml->combinexml($this->_errors->errorsAddToXML($this->_sysinfo->getEncoding()));
905
    }
929
    }