Added Dokcer/VM XML files to diagnostics

This commit is contained in:
bergware
2019-08-27 09:11:21 +02:00
parent a6173e99b5
commit 8f3191f389

View File

@@ -1,7 +1,7 @@
#!/usr/bin/php -q
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2019, Lime Technology
* Copyright 2012-2019, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -72,7 +72,7 @@ if ($cli) {
$date = "{$split[2]}-{$split[3]}";
}
// create folder structure
exert("mkdir -p ".escapeshellarg("/$diag/system")." ".escapeshellarg("/$diag/config")." ".escapeshellarg("/$diag/logs")." ".escapeshellarg("/$diag/shares")." ".escapeshellarg("/$diag/smart")." ".escapeshellarg("/$diag/qemu"));
exert("mkdir -p ".escapeshellarg("/$diag/system")." ".escapeshellarg("/$diag/config")." ".escapeshellarg("/$diag/logs")." ".escapeshellarg("/$diag/shares")." ".escapeshellarg("/$diag/smart")." ".escapeshellarg("/$diag/qemu")." ".escapeshellarg("/$diag/xml"));
// get utilization of running processes
exert("top -bn1 -o%CPU 2>/dev/null|todos >".escapeshellarg("/$diag/system/top.txt"));
// make Unraid version reference
@@ -174,6 +174,9 @@ if (file_exists($docker)) {
exert("truncate -s '<$max' ".escapeshellarg("$log.txt"));
}
}
// copy docker XML config files
exert("cp /boot/config/plugins/dockerMan/templates-user/my-*.xml ".escapeshellarg("/$diag/xml")." 2>/dev/null");
// create SMART reports (suppress errors)
$disks = file_exists("$get/disks.ini") ? parse_ini_file("$get/disks.ini", true) : [];
include_once "$docroot/webGui/include/CustomMerge.php";
@@ -227,8 +230,12 @@ if ($qemu) {
exert("truncate -s '<$max' ".escapeshellarg("$log.txt"));
}
}
} else
} else {
file_put_contents("/$diag/qemu/no qemu log files","");
}
// copy VM XML config files
exert("cp /etc/libvirt/qemu/*.xml ".escapeshellarg("/$diag/xml")." 2>/dev/null");
// copy syslog information (anonymize if applicable)
$max = 2*1024*1024; //=2MB
foreach (glob("/var/log/syslog*") as $file) {