Subversion Repositories ALCASAR

Rev

Rev 2976 | Rev 3100 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2976 Rev 3037
Line 187... Line 187...
187
            } elseif (PSI_HIDE_NETWORK_INTERFACE === true) {
187
            } elseif (PSI_HIDE_NETWORK_INTERFACE === true) {
188
                return;
188
                return;
189
            }
189
            }
190
        }
190
        }
191
        foreach ($this->_sys->getNetDevices() as $dev) {
191
        foreach ($this->_sys->getNetDevices() as $dev) {
-
 
192
            if (defined('PSI_HIDE_NETWORK_INTERFACE_REGEX') && PSI_HIDE_NETWORK_INTERFACE_REGEX) {
-
 
193
                $hide = false;
-
 
194
                foreach ($hideDevices as $hidedev) {
-
 
195
                    if (preg_match('/^'.$hidedev.'$/', trim($dev->getName()))) {
-
 
196
                        $hide = true;
-
 
197
                        break;
-
 
198
                    }
-
 
199
                }
-
 
200
            } else {
192
            if (!in_array(trim($dev->getName()), $hideDevices)) {
201
                $hide =in_array(trim($dev->getName()), $hideDevices);
-
 
202
            }
-
 
203
            if (!$hide) {
193
                $device = $network->addChild('NetDevice');
204
                $device = $network->addChild('NetDevice');
194
                $device->addAttribute('Name', $dev->getName());
205
                $device->addAttribute('Name', $dev->getName());
195
                $device->addAttribute('RxBytes', $dev->getRxBytes());
206
                $device->addAttribute('RxBytes', $dev->getRxBytes());
196
                $device->addAttribute('TxBytes', $dev->getTxBytes());
207
                $device->addAttribute('TxBytes', $dev->getTxBytes());
197
                $device->addAttribute('Err', $dev->getErrors());
208
                $device->addAttribute('Err', $dev->getErrors());
Line 208... Line 219...
208
     * @return void
219
     * @return void
209
     */
220
     */
210
    private function _buildHardware()
221
    private function _buildHardware()
211
    {
222
    {
212
        $hardware = $this->_xml->addChild('Hardware');
223
        $hardware = $this->_xml->addChild('Hardware');
213
        if ($this->_sys->getMachine() != "") {
224
        if (($machine = $this->_sys->getMachine()) != "") {
-
 
225
            if ((preg_match('/^(.* (.*\/.*\/.*))\/(.*\/.*\/.*)(, BIOS .*)$/', $machine, $mbuf)
-
 
226
               || preg_match('/^(.* (.*\/.*))\/(.*\/.*)(, BIOS .*)$/', $machine, $mbuf)
-
 
227
               || preg_match('/^(.* (.*))\/(.*)(, BIOS .*)$/', $machine, $mbuf)
-
 
228
               || preg_match('/^((.*\/.*\/.*))\/(.*\/.*\/.*)(, BIOS .*)$/', $machine, $mbuf)
-
 
229
               || preg_match('/^((.*\/.*))\/(.*\/.*)(, BIOS .*)$/', $machine, $mbuf)
-
 
230
               || preg_match('/^((.*))\/(.*)(, BIOS .*)$/', $machine, $mbuf))
-
 
231
               && ($mbuf[2] === $mbuf[3])) { // find duplicates
-
 
232
                $machine = $mbuf[1].$mbuf[4]; // minimized machine name
-
 
233
            }
-
 
234
            $machine = trim(preg_replace("/^\s*\/?,?/", "", $machine)); // remove leading slash and comma
-
 
235
 
-
 
236
            if ($machine != "") {
214
            $hardware->addAttribute('Name', $this->_sys->getMachine());
237
                $hardware->addAttribute('Name', $machine);
-
 
238
            }
-
 
239
        }
-
 
240
 
-
 
241
        if (defined('PSI_SHOW_VIRTUALIZER_INFO') && PSI_SHOW_VIRTUALIZER_INFO) {
-
 
242
            $virt = $this->_sys->getVirtualizer();
-
 
243
            $first = true;
-
 
244
            $virtstring = "";
-
 
245
            foreach ($virt as $virtkey=>$virtvalue) if ($virtvalue) {
-
 
246
                if ($first) {
-
 
247
                    $first = false;
-
 
248
                } else {
-
 
249
                    $virtstring .= ", ";
-
 
250
                }
-
 
251
                if ($virtkey === 'microsoft') {
-
 
252
                    $virtstring .= 'hyper-v';
-
 
253
                } elseif ($virtkey === 'kvm') {
-
 
254
                    $virtstring .= 'qemu-kvm';
-
 
255
                } elseif ($virtkey === 'oracle') {
-
 
256
                    $virtstring .= 'virtualbox';
-
 
257
                } elseif ($virtkey === 'zvm') {
-
 
258
                    $virtstring .= 'z/vm';
-
 
259
                } else {
-
 
260
                    $virtstring .= $virtkey;
-
 
261
                }
-
 
262
            }
-
 
263
            if ($virtstring !== "") {
-
 
264
                $hardware->addAttribute('Virtualizer', $virtstring);
-
 
265
            }
215
        }
266
        }
-
 
267
 
216
        $cpu = null;
268
        $cpu = null;
217
        $vendortab = null;
269
        $vendortab = null;
218
        foreach ($this->_sys->getCpus() as $oneCpu) {
270
        foreach ($this->_sys->getCpus() as $oneCpu) {
219
            if ($cpu === null) $cpu = $hardware->addChild('CPU');
271
            if ($cpu === null) $cpu = $hardware->addChild('CPU');
220
            $tmp = $cpu->addChild('CpuCore');
272
            $tmp = $cpu->addChild('CpuCore');
221
            $tmp->addAttribute('Model', $oneCpu->getModel());
273
            $tmp->addAttribute('Model', $oneCpu->getModel());
-
 
274
            if ($oneCpu->getVoltage() > 0) {
-
 
275
                $tmp->addAttribute('Voltage', $oneCpu->getVoltage());
-
 
276
            }
222
            if ($oneCpu->getCpuSpeed() !== 0) {
277
            if ($oneCpu->getCpuSpeed() > 0) {
223
                $tmp->addAttribute('CpuSpeed', max($oneCpu->getCpuSpeed(), 0));
278
                $tmp->addAttribute('CpuSpeed', $oneCpu->getCpuSpeed());
-
 
279
            } elseif ($oneCpu->getCpuSpeed() == -1) {
-
 
280
                $tmp->addAttribute('CpuSpeed', 0); // core stopped
224
            }
281
            }
225
            if ($oneCpu->getCpuSpeedMax() !== 0) {
282
            if ($oneCpu->getCpuSpeedMax() > 0) {
226
                $tmp->addAttribute('CpuSpeedMax', $oneCpu->getCpuSpeedMax());
283
                $tmp->addAttribute('CpuSpeedMax', $oneCpu->getCpuSpeedMax());
227
            }
284
            }
228
            if ($oneCpu->getCpuSpeedMin() !== 0) {
285
            if ($oneCpu->getCpuSpeedMin() > 0) {
229
                $tmp->addAttribute('CpuSpeedMin', $oneCpu->getCpuSpeedMin());
286
                $tmp->addAttribute('CpuSpeedMin', $oneCpu->getCpuSpeedMin());
230
            }
287
            }
231
/*
288
/*
232
            if ($oneCpu->getTemp() !== null) {
289
            if ($oneCpu->getTemp() !== null) {
233
                $tmp->addAttribute('CpuTemp', $oneCpu->getTemp());
290
                $tmp->addAttribute('CpuTemp', $oneCpu->getTemp());
Line 242... Line 299...
242
            if ($oneCpu->getVirt() !== null) {
299
            if ($oneCpu->getVirt() !== null) {
243
                $tmp->addAttribute('Virt', $oneCpu->getVirt());
300
                $tmp->addAttribute('Virt', $oneCpu->getVirt());
244
            }
301
            }
245
            if ($oneCpu->getVendorId() !== null) {
302
            if ($oneCpu->getVendorId() !== null) {
246
                if ($vendortab === null) $vendortab = @parse_ini_file(PSI_APP_ROOT."/data/cpus.ini", true);
303
                if ($vendortab === null) $vendortab = @parse_ini_file(PSI_APP_ROOT."/data/cpus.ini", true);
247
                $shortvendorid = preg_replace('/[\s!]/', '', $oneCpu->getVendorId());
304
                $shortvendorid = $oneCpu->getVendorId();
248
                if ($vendortab && ($shortvendorid != "") && isset($vendortab['manufacturer'][$shortvendorid])) {
305
                if ($vendortab && ($shortvendorid != "") && isset($vendortab['manufacturer'][$shortvendorid])) {
249
                    $tmp->addAttribute('Manufacturer', $vendortab['manufacturer'][$shortvendorid]);
306
                    $tmp->addAttribute('Manufacturer', $vendortab['manufacturer'][$shortvendorid]);
250
                }
307
                }
251
            }
308
            }
252
            if ($oneCpu->getBogomips() !== null) {
309
            if ($oneCpu->getBogomips() !== null) {
Line 440... Line 497...
440
    /**
497
    /**
441
     * fill a xml element with atrributes from a disk device
498
     * fill a xml element with atrributes from a disk device
442
     *
499
     *
443
     * @param SimpleXmlExtended $mount Xml-Element
500
     * @param SimpleXmlExtended $mount Xml-Element
444
     * @param DiskDevice        $dev   DiskDevice
501
     * @param DiskDevice        $dev   DiskDevice
445
     * @param Integer           $i     counter
502
     * @param int               $i     counter
446
     *
503
     *
447
     * @return Void
504
     * @return void
448
     */
505
     */
449
    private function _fillDevice(SimpleXMLExtended $mount, DiskDevice $dev, $i)
506
    private function _fillDevice(SimpleXMLExtended $mount, DiskDevice $dev, $i)
450
    {
507
    {
451
        $mount->addAttribute('MountPointID', $i);
508
        $mount->addAttribute('MountPointID', $i);
452
        if ($dev->getFsType()!=="") {
509
        if ($dev->getFsType()!=="") {
Line 460... Line 517...
460
        $mount->addAttribute('Percent', $percentUsed);
517
        $mount->addAttribute('Percent', $percentUsed);
461
        if ($dev->getPercentInodesUsed() !== null) {
518
        if ($dev->getPercentInodesUsed() !== null) {
462
            $mount->addAttribute('Inodes', $dev->getPercentInodesUsed());
519
            $mount->addAttribute('Inodes', $dev->getPercentInodesUsed());
463
        }
520
        }
464
        if ($dev->getIgnore() > 0) $mount->addAttribute('Ignore', $dev->getIgnore());
521
        if ($dev->getIgnore() > 0) $mount->addAttribute('Ignore', $dev->getIgnore());
465
        if (PSI_SHOW_MOUNT_OPTION === true) {
522
        if (PSI_SHOW_MOUNT_OPTION) {
466
            if ($dev->getOptions() !== null) {
523
            if ($dev->getOptions() !== null) {
467
                $mount->addAttribute('MountOptions', preg_replace("/,/", ", ", $dev->getOptions()));
524
                $mount->addAttribute('MountOptions', preg_replace("/,/", ", ", $dev->getOptions()));
468
            }
525
            }
469
        }
526
        }
470
        if (PSI_SHOW_MOUNT_POINT === true) {
527
        if (PSI_SHOW_MOUNT_POINT && ($dev->getMountPoint() !== null)) {
471
            $mount->addAttribute('MountPoint', $dev->getMountPoint());
528
            $mount->addAttribute('MountPoint', $dev->getMountPoint());
472
        }
529
        }
473
    }
530
    }
474
 
531
 
475
    /**
532
    /**
Line 478... Line 535...
478
     * @return void
535
     * @return void
479
     */
536
     */
480
    private function _buildFilesystems()
537
    private function _buildFilesystems()
481
    {
538
    {
482
        $hideMounts = $hideFstypes = $hideDisks = $ignoreFree = $ignoreTotal = $ignoreUsage = $ignoreThreshold = array();
539
        $hideMounts = $hideFstypes = $hideDisks = $ignoreFree = $ignoreTotal = $ignoreUsage = $ignoreThreshold = array();
483
        $i = 1;
-
 
484
        if (defined('PSI_HIDE_MOUNTS') && is_string(PSI_HIDE_MOUNTS)) {
540
        if (defined('PSI_HIDE_MOUNTS') && is_string(PSI_HIDE_MOUNTS)) {
485
            if (preg_match(ARRAY_EXP, PSI_HIDE_MOUNTS)) {
541
            if (preg_match(ARRAY_EXP, PSI_HIDE_MOUNTS)) {
486
                $hideMounts = eval(PSI_HIDE_MOUNTS);
542
                $hideMounts = eval(PSI_HIDE_MOUNTS);
487
            } else {
543
            } else {
488
                $hideMounts = array(PSI_HIDE_MOUNTS);
544
                $hideMounts = array(PSI_HIDE_MOUNTS);
Line 533... Line 589...
533
            } else {
589
            } else {
534
                $ignoreThreshold = array(PSI_IGNORE_THRESHOLD_FS_TYPES);
590
                $ignoreThreshold = array(PSI_IGNORE_THRESHOLD_FS_TYPES);
535
            }
591
            }
536
        }
592
        }
537
        $fs = $this->_xml->addChild('FileSystem');
593
        $fs = $this->_xml->addChild('FileSystem');
-
 
594
        $i = 1;
538
        foreach ($this->_sys->getDiskDevices() as $disk) {
595
        foreach ($this->_sys->getDiskDevices() as $disk) {
539
            if (!in_array($disk->getMountPoint(), $hideMounts, true) && !in_array($disk->getFsType(), $hideFstypes, true) && !in_array($disk->getName(), $hideDisks, true)) {
596
            if (!in_array($disk->getMountPoint(), $hideMounts, true) && !in_array($disk->getFsType(), $hideFstypes, true) && !in_array($disk->getName(), $hideDisks, true)) {
540
                $mount = $fs->addChild('Mount');
597
                $mount = $fs->addChild('Mount');
541
                if (in_array($disk->getFsType(), $ignoreThreshold, true)) {
598
                if (in_array($disk->getFsType(), $ignoreThreshold, true)) {
542
                    $disk->setIgnore(4);
599
                    $disk->setIgnore(4);
Line 572... Line 629...
572
                        $temp = $mbinfo->addChild('Temperature');
629
                        $temp = $mbinfo->addChild('Temperature');
573
                    }
630
                    }
574
                    $item = $temp->addChild('Item');
631
                    $item = $temp->addChild('Item');
575
                    $item->addAttribute('Label', $dev->getName());
632
                    $item->addAttribute('Label', $dev->getName());
576
                    $item->addAttribute('Value', $dev->getValue());
633
                    $item->addAttribute('Value', $dev->getValue());
-
 
634
                    $alarm = false;
577
                    if ($dev->getMax() !== null) {
635
                    if ($dev->getMax() !== null) {
578
                        $item->addAttribute('Max', $dev->getMax());
636
                        $item->addAttribute('Max', $dev->getMax());
-
 
637
                        $alarm = true;
579
                    }
638
                    }
580
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") {
639
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && ($dev->getEvent() !== "") && (((strtolower($dev->getEvent())) !== "alarm") || $alarm || ($dev->getValue() == 0))) {
581
                        $item->addAttribute('Event', $dev->getEvent());
640
                        $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
582
                    }
641
                    }
583
                }
642
                }
584
 
643
 
585
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='fans') foreach ($mbinfo_detail->getMbFan() as $dev) {
644
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='fans') foreach ($mbinfo_detail->getMbFan() as $dev) {
586
                    if ($fan == null) {
645
                    if ($fan == null) {
587
                        $fan = $mbinfo->addChild('Fans');
646
                        $fan = $mbinfo->addChild('Fans');
588
                    }
647
                    }
589
                    $item = $fan->addChild('Item');
648
                    $item = $fan->addChild('Item');
590
                    $item->addAttribute('Label', $dev->getName());
649
                    $item->addAttribute('Label', $dev->getName());
591
                    $item->addAttribute('Value', $dev->getValue());
650
                    $item->addAttribute('Value', $dev->getValue());
-
 
651
                    $alarm = false;
592
                    if ($dev->getMin() !== null) {
652
                    if ($dev->getMin() !== null) {
593
                        $item->addAttribute('Min', $dev->getMin());
653
                        $item->addAttribute('Min', $dev->getMin());
-
 
654
                        $alarm = true;
594
                    }
655
                    }
595
                    if ($dev->getUnit() !== "") {
656
                    if ($dev->getUnit() !== "") {
596
                        $item->addAttribute('Unit', $dev->getUnit());
657
                        $item->addAttribute('Unit', $dev->getUnit());
597
                    }
658
                    }
598
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") {
659
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && ($dev->getEvent() !== "") && (((strtolower($dev->getEvent())) !== "alarm") || $alarm || ($dev->getValue() == 0))) {
599
                        $item->addAttribute('Event', $dev->getEvent());
660
                        $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
600
                    }
661
                    }
601
                }
662
                }
602
 
663
 
603
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='voltage') foreach ($mbinfo_detail->getMbVolt() as $dev) {
664
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='voltage') foreach ($mbinfo_detail->getMbVolt() as $dev) {
604
                    if ($volt == null) {
665
                    if ($volt == null) {
605
                        $volt = $mbinfo->addChild('Voltage');
666
                        $volt = $mbinfo->addChild('Voltage');
606
                    }
667
                    }
607
                    $item = $volt->addChild('Item');
668
                    $item = $volt->addChild('Item');
608
                    $item->addAttribute('Label', $dev->getName());
669
                    $item->addAttribute('Label', $dev->getName());
609
                    $item->addAttribute('Value', $dev->getValue());
670
                    $item->addAttribute('Value', $dev->getValue());
-
 
671
                    $alarm = false;
610
                    if (($dev->getMin() === null) || ($dev->getMin() != 0) || ($dev->getMax() === null) || ($dev->getMax() != 0)) {
672
                    if (($dev->getMin() === null) || ($dev->getMin() != 0) || ($dev->getMax() === null) || ($dev->getMax() != 0)) {
611
                        if ($dev->getMin() !== null) {
673
                        if ($dev->getMin() !== null) {
612
                            $item->addAttribute('Min', $dev->getMin());
674
                            $item->addAttribute('Min', $dev->getMin());
-
 
675
                            $alarm = true;
613
                        }
676
                        }
614
                        if ($dev->getMax() !== null) {
677
                        if ($dev->getMax() !== null) {
615
                            $item->addAttribute('Max', $dev->getMax());
678
                            $item->addAttribute('Max', $dev->getMax());
-
 
679
                            $alarm = true;
616
                        }
680
                        }
617
                    }
681
                    }
618
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") {
682
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && ($dev->getEvent() !== "") && (((strtolower($dev->getEvent())) !== "alarm") || $alarm || ($dev->getValue() == 0))) {
619
                        $item->addAttribute('Event', $dev->getEvent());
683
                        $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
620
                    }
684
                    }
621
                }
685
                }
622
 
686
 
623
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='power') foreach ($mbinfo_detail->getMbPower() as $dev) {
687
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='power') foreach ($mbinfo_detail->getMbPower() as $dev) {
624
                    if ($power == null) {
688
                    if ($power == null) {
625
                        $power = $mbinfo->addChild('Power');
689
                        $power = $mbinfo->addChild('Power');
626
                    }
690
                    }
627
                    $item = $power->addChild('Item');
691
                    $item = $power->addChild('Item');
628
                    $item->addAttribute('Label', $dev->getName());
692
                    $item->addAttribute('Label', $dev->getName());
629
                    $item->addAttribute('Value', $dev->getValue());
693
                    $item->addAttribute('Value', $dev->getValue());
-
 
694
                    $alarm = false;
630
                    if ($dev->getMax() !== null) {
695
                    if ($dev->getMax() !== null) {
631
                        $item->addAttribute('Max', $dev->getMax());
696
                        $item->addAttribute('Max', $dev->getMax());
-
 
697
                        $alarm = true;
632
                    }
698
                    }
633
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") {
699
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && ($dev->getEvent() !== "") && (((strtolower($dev->getEvent())) !== "alarm") || $alarm || ($dev->getValue() == 0))) {
634
                        $item->addAttribute('Event', $dev->getEvent());
700
                        $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
635
                    }
701
                    }
636
                }
702
                }
637
 
703
 
638
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='current') foreach ($mbinfo_detail->getMbCurrent() as $dev) {
704
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='current') foreach ($mbinfo_detail->getMbCurrent() as $dev) {
639
                    if ($current == null) {
705
                    if ($current == null) {
640
                        $current = $mbinfo->addChild('Current');
706
                        $current = $mbinfo->addChild('Current');
641
                    }
707
                    }
642
                    $item = $current->addChild('Item');
708
                    $item = $current->addChild('Item');
643
                    $item->addAttribute('Label', $dev->getName());
709
                    $item->addAttribute('Label', $dev->getName());
644
                    $item->addAttribute('Value', $dev->getValue());
710
                    $item->addAttribute('Value', $dev->getValue());
-
 
711
                    $alarm = false;
645
                    if (($dev->getMin() === null) || ($dev->getMin() != 0) || ($dev->getMax() === null) || ($dev->getMax() != 0)) {
712
                    if (($dev->getMin() === null) || ($dev->getMin() != 0) || ($dev->getMax() === null) || ($dev->getMax() != 0)) {
646
                        if ($dev->getMin() !== null) {
713
                        if ($dev->getMin() !== null) {
647
                            $item->addAttribute('Min', $dev->getMin());
714
                            $item->addAttribute('Min', $dev->getMin());
-
 
715
                            $alarm = true;
648
                        }
716
                        }
649
                        if ($dev->getMax() !== null) {
717
                        if ($dev->getMax() !== null) {
650
                            $item->addAttribute('Max', $dev->getMax());
718
                            $item->addAttribute('Max', $dev->getMax());
-
 
719
                            $alarm = true;
651
                        }
720
                        }
652
                    }
721
                    }
653
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") {
722
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && ($dev->getEvent() !== "") && (((strtolower($dev->getEvent())) !== "alarm") || $alarm || ($dev->getValue() == 0))) {
654
                        $item->addAttribute('Event', $dev->getEvent());
723
                        $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
655
                    }
724
                    }
656
                }
725
                }
657
 
726
 
658
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='other') foreach ($mbinfo_detail->getMbOther() as $dev) {
727
                if (!$this->_sysinfo->getBlockName() || $this->_sysinfo->getBlockName()==='other') foreach ($mbinfo_detail->getMbOther() as $dev) {
659
                    if ($other == null) {
728
                    if ($other == null) {
Line 664... Line 733...
664
                    $item->addAttribute('Value', $dev->getValue());
733
                    $item->addAttribute('Value', $dev->getValue());
665
                    if ($dev->getUnit() !== "") {
734
                    if ($dev->getUnit() !== "") {
666
                        $item->addAttribute('Unit', $dev->getUnit());
735
                        $item->addAttribute('Unit', $dev->getUnit());
667
                    }
736
                    }
668
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") {
737
                    if (defined('PSI_SENSOR_EVENTS') && PSI_SENSOR_EVENTS && $dev->getEvent() !== "") {
669
                        $item->addAttribute('Event', $dev->getEvent());
738
                        $item->addAttribute('Event', ucfirst(strtolower($dev->getEvent())));
670
                    }
739
                    }
671
                }
740
                }
672
            }
741
            }
673
        }
742
        }
674
    }
743
    }
Line 679... Line 748...
679
     * @return void
748
     * @return void
680
     */
749
     */
681
    private function _buildUpsinfo()
750
    private function _buildUpsinfo()
682
    {
751
    {
683
        $upsinfo = $this->_xml->addChild('UPSInfo');
752
        $upsinfo = $this->_xml->addChild('UPSInfo');
684
        if (defined('PSI_UPS_APCUPSD_CGI_ENABLE') && PSI_UPS_APCUPSD_CGI_ENABLE) {
753
        if (!defined('PSI_EMU_HOSTNAME') && defined('PSI_UPS_APCUPSD_CGI_ENABLE') && PSI_UPS_APCUPSD_CGI_ENABLE) {
685
            $upsinfo->addAttribute('ApcupsdCgiLinks', true);
754
            $upsinfo->addAttribute('ApcupsdCgiLinks', true);
686
        }
755
        }
687
        if (sizeof(unserialize(PSI_UPSINFO))>0) {
756
        if (sizeof(unserialize(PSI_UPSINFO))>0) {
688
            foreach (unserialize(PSI_UPSINFO) as $upsinfoclass) {
757
            foreach (unserialize(PSI_UPSINFO) as $upsinfoclass) {
689
                $upsinfo_data = new $upsinfoclass();
758
                $upsinfo_data = new $upsinfoclass();
Line 699... Line 768...
699
                    }
768
                    }
700
                    if ($ups->getStartTime() !== "") {
769
                    if ($ups->getStartTime() !== "") {
701
                        $item->addAttribute('StartTime', $ups->getStartTime());
770
                        $item->addAttribute('StartTime', $ups->getStartTime());
702
                    }
771
                    }
703
                    $item->addAttribute('Status', $ups->getStatus());
772
                    $item->addAttribute('Status', $ups->getStatus());
-
 
773
                    if ($ups->getBeeperStatus() !== null) {
-
 
774
                        $item->addAttribute('BeeperStatus', $ups->getBeeperStatus());
-
 
775
                    }
704
                    if ($ups->getTemperatur() !== null) {
776
                    if ($ups->getTemperatur() !== null) {
705
                        $item->addAttribute('Temperature', $ups->getTemperatur());
777
                        $item->addAttribute('Temperature', $ups->getTemperatur());
706
                    }
778
                    }
707
                    if ($ups->getOutages() !== null) {
779
                    if ($ups->getOutages() !== null) {
708
                        $item->addAttribute('OutagesCount', $ups->getOutages());
780
                        $item->addAttribute('OutagesCount', $ups->getOutages());
Line 746... Line 818...
746
     */
818
     */
747
    private function _buildXml()
819
    private function _buildXml()
748
    {
820
    {
749
        if (($this->_plugin == '') || $this->_complete_request) {
821
        if (($this->_plugin == '') || $this->_complete_request) {
750
            if ($this->_sys === null) {
822
            if ($this->_sys === null) {
751
                if (PSI_DEBUG === true) {
823
                if (PSI_DEBUG) {
752
                    // unstable version check
824
                    // unstable version check
753
                    if (!is_numeric(substr(PSI_VERSION, -1))) {
825
                    if (!is_numeric(substr(PSI_VERSION, -1))) {
754
                        $this->_errors->addError("WARN", "This is an unstable version of phpSysInfo, some things may not work correctly");
826
                        $this->_errors->addWarning("This is an unstable version of phpSysInfo, some things may not work correctly");
755
                    }
827
                    }
756
 
828
 
757
                    // Safe mode check
829
                    // Safe mode check
758
                    $safe_mode = @ini_get("safe_mode") ? true : false;
830
                    $safe_mode = @ini_get("safe_mode") ? true : false;
759
                    if ($safe_mode) {
831
                    if ($safe_mode) {
Line 769... Line 841...
769
                    }
841
                    }
770
                    if ($include_path != ".") {
842
                    if ($include_path != ".") {
771
                        $this->_errors->addError("WARN", "PhpSysInfo requires '.' inside the 'include_path' in php.ini");
843
                        $this->_errors->addError("WARN", "PhpSysInfo requires '.' inside the 'include_path' in php.ini");
772
                    }
844
                    }
773
                    // popen mode check
845
                    // popen mode check
774
                    if (defined("PSI_MODE_POPEN") && PSI_MODE_POPEN === true) {
846
                    if (defined("PSI_MODE_POPEN") && PSI_MODE_POPEN) {
775
                        $this->_errors->addError("WARN", "Installed version of PHP does not support proc_open() function, popen() is used");
847
                        $this->_errors->addError("WARN", "Installed version of PHP does not support proc_open() function, popen() is used");
776
                    }
848
                    }
777
                }
849
                }
778
                $this->_sys = $this->_sysinfo->getSys();
850
                $this->_sys = $this->_sysinfo->getSys();
779
            }
851
            }
Line 852... Line 924...
852
        $options = $this->_xml->addChild('Options');
924
        $options = $this->_xml->addChild('Options');
853
        $options->addAttribute('tempFormat', defined('PSI_TEMP_FORMAT') ? strtolower(PSI_TEMP_FORMAT) : 'c');
925
        $options->addAttribute('tempFormat', defined('PSI_TEMP_FORMAT') ? strtolower(PSI_TEMP_FORMAT) : 'c');
854
        $options->addAttribute('byteFormat', defined('PSI_BYTE_FORMAT') ? strtolower(PSI_BYTE_FORMAT) : 'auto_binary');
926
        $options->addAttribute('byteFormat', defined('PSI_BYTE_FORMAT') ? strtolower(PSI_BYTE_FORMAT) : 'auto_binary');
855
        $options->addAttribute('datetimeFormat', defined('PSI_DATETIME_FORMAT') ? strtolower(PSI_DATETIME_FORMAT) : 'utc');
927
        $options->addAttribute('datetimeFormat', defined('PSI_DATETIME_FORMAT') ? strtolower(PSI_DATETIME_FORMAT) : 'utc');
856
        if (defined('PSI_REFRESH')) {
928
        if (defined('PSI_REFRESH')) {
857
            $options->addAttribute('refresh',  max(intval(PSI_REFRESH), 0));
929
            $options->addAttribute('refresh', max(intval(PSI_REFRESH), 0));
858
        } else {
930
        } else {
859
            $options->addAttribute('refresh', 60000);
931
            $options->addAttribute('refresh', 60000);
860
        }
932
        }
861
        if (defined('PSI_FS_USAGE_THRESHOLD')) {
933
        if (defined('PSI_FS_USAGE_THRESHOLD')) {
862
            if ((($fsut = intval(PSI_FS_USAGE_THRESHOLD)) >= 1) && ($fsut <= 99)) {
934
            if ((($fsut = intval(PSI_FS_USAGE_THRESHOLD)) >= 1) && ($fsut <= 99)) {