/usr/bin/fusioninventory-esx is in fusioninventory-agent-task-esx 1:2.3.16-1.
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 | #!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if 0; # not running under some shell
use strict;
use warnings;
use lib "/usr/share/fusioninventory/lib";
use English qw(-no_match_vars) ;
use Getopt::Long;
use Pod::Usage;
use FusionInventory::Agent::Task::ESX;
use FusionInventory::Agent::Logger;
my $options = {
};
GetOptions(
$options,
'host=s',
'user=s',
'password=s',
'directory=s',
'tag=s',
'help',
'version',
) or pod2usage(-verbose => 0);
pod2usage(-verbose => 0, -exitstatus => 0) if $options->{help};
if ($options->{version}) {
print "fusioninventory-esx $FusionInventory::Agent::Task::ESX::VERSION\n";
exit 0;
}
pod2usage(-verbose => 0) unless
$options->{host} and
$options->{user} and
$options->{password} and
$options->{directory};
my $esx = FusionInventory::Agent::Task::ESX->new(
target => {},
);
if (!$esx->connect(
host => $options->{host},
user => $options->{user},
password => $options->{password},
)) {
exit 1;
}
my $logger = FusionInventory::Agent::Logger->new();
my $hasError = 0;
my $hostIds = $esx->getHostIds();
foreach my $hostId (@$hostIds) {
my $inventory = $esx->createInventory($hostId, $options->{tag});
my $file = $options->{directory} . '/' . $inventory->{deviceid} . ".ocs";
if (open my $handle, '>', $file) {
my $tpp = XML::TreePP->new(indent => 2);
print $handle $tpp->write({
REQUEST => {
CONTENT => $inventory->{content},
DEVICEID => $inventory->{deviceid},
QUERY => "INVENTORY",
}
});
close $handle;
print("Inventory saved in $file\n");
} else {
$hasError = 1;
print("Can't write to $file: $ERRNO\n");
}
}
exit($hasError);
__END__
=head1 NAME
fusioninventory-esx - vCenter/ESX/ESXi remote inventory from command line
=head1 SYNOPSIS
fusioninventory-esx --host <host> --user <user> --password <password> --directory <directory>
Options:
--help this menu
--host hostname ESX server hostname
--user username user name
--password xxxx user password
--directory directory output directory
--tag tag tag for the inventoried machine
=head1 EXAMPLES
% fusioninventory-esx --host myesx --user foo --password bar --directory /tmp
You can import the .ocs file in your inventory server with the fusioninventory-injector tool.
%fusioninventory-injector -v --file /tmp/*.ocs -u https://myserver/ocsinventory
=head1 DESCRIPTION
F<fusioninventory-esx> creates inventory of remote ESX/ESXi and vCenter VMware.
It uses the SOAP interface of the remote server.
Supported systems:
=over 4
=item F<ESX and ESXi 3.5>
=item F<ESX and ESXi 4.1>
=item F<ESXi 5.0>
=item F<vCenter 4.1>
=item F<vCenter 5.0>
=back
Active Directory users, please note the AD authentication doesn't work. You must
create a account on the VMware server.
=head1 LIMITATION
So far, ESX serial number are not collected.
=head1 SECURITY
The SSL hostname check of the server is disabled.
|