/usr/bin/imvirt-report is in imvirt-helper 0.9.6-4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | #!/usr/bin/perl
# imvirt - I'm virtualized?
#
# Authors:
# Thomas Liske <liske@ibh.de>
#
# Copyright Holder:
# 2012 - 2013 (C) IBH IT-Service GmbH [http://www.ibh.de/]
#
# License:
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this package; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
use strict;
use warnings;
use Getopt::Std;
use MIME::Lite;
use ImVirt;
$|++;
eval 'use File::Which;';
my $nowhich = $@;
my $hostname = `hostname -f`;
chomp($hostname);
$Getopt::Std::STANDARD_HELP_VERSION++;
sub HELP_MESSAGE {
print <<USG;
About:
imvirt-report collects various system information and saves them to a
mime encoded file. It might help the upstream author to provide a better
detection support of virtualizing technologies. It might be helpful to
attach the output to bug reports.
Usage:
imvirt-report [-s <filename>]
-s <filename> where to write the collected data
USG
}
sub VERSION_MESSAGE {
print <<LIC;
imvirt $ImVirt::VERSION - I'm virtualized?
Authors:
Thomas Liske <liske\@ibh.de>
Copyright Holder:
2008 - 2013 (C) IBH IT-Service GmbH [http://www.ibh.de/]
License:
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LIC
#'
}
our $opt_s = "imvirt-report_${hostname}_$$.eml";
getopts('s:') || exit(1);
my $ivout = imv_get(IMV_PROB_DEFAULT);
my $msg = MIME::Lite->new(
Subject => $hostname,
Type => 'multipart/mixed',
);
$msg->attach(
Type => 'TEXT',
Data => "Hostname: $hostname\nImVirt Version: $ImVirt::VERSION\nImVirt Output: $ivout\n",
);
sub attach_path($$) {
my ($msg, $glob) = @_;
foreach my $path (glob $glob) {
my $fn = $path;
$fn =~ s@/@_@g;
unless (-r $path) {
$msg->attach(
Type => 'TEXT',
Data => "File $path not readable!",
Filename => $fn,
);
}
else {
print STDERR " Attaching '$path'.\n";
$msg->attach(
Type => 'TEXT',
Path => $path,
Filename => $fn,
);
}
}
}
sub attach_cmd($$$) {
my ($msg, $cmd, $params) = @_;
my $run = ($nowhich ne '' ? $cmd : which($cmd));
unless (defined($run)) {
$msg->attach(
Type => 'TEXT',
Data => "Command $cmd not available!",
Filename => $cmd,
);
return;
}
print STDERR " Attaching `$cmd $params`.\n";
$msg->attach(
Type => 'TEXT',
Data => scalar `$run $params 2>&1`,
Filename => $cmd,
);
}
print STDERR "Collecting data...\n";
attach_path($msg, '/proc/1/cgroup');
attach_path($msg, '/proc/1/environ');
attach_path($msg, '/proc/1/stat');
attach_path($msg, '/proc/cmdline');
attach_path($msg, '/proc/cpuinfo');
attach_path($msg, '/proc/kallsyms');
attach_path($msg, '/proc/mounts');
attach_path($msg, '/proc/modules');
attach_path($msg, '/proc/bus/input/devices');
attach_path($msg, '/proc/uptime');
attach_path($msg, '/proc/timer_list');
attach_path($msg, '/sys/devices/system/clocksource/clocksource*/available_clocksource');
attach_path($msg, '/sys/devices/system/cpu/cpu*/cpufreq/scaling_driver');
attach_path($msg, '/var/log/dmesg');
attach_cmd($msg, 'dmesg', '');
attach_cmd($msg, 'dmidecode', '');
attach_cmd($msg, 'find', '/dev');
attach_cmd($msg, 'find', '/proc');
attach_cmd($msg, 'find', '/sys');
attach_cmd($msg, 'imvirt', '-d');
attach_cmd($msg, 'lsb_release', '-a');
attach_cmd($msg, 'lspci', '');
attach_cmd($msg, 'uname', '-a');
open(HSAVE, '>', $opt_s) || die "Could not open $opt_s: $!\n";
$msg->print(\*HSAVE);
close(HSAVE);
print STDERR "Data saved to '$opt_s'.\n";
|