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 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367
|
#!/usr/bin/perl
#Copyright (C) 2006-2010 OCS Inventory Developers
#Copyright (C) 2010 FusionInventory Team
#
#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 program; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
#USA.
#
use strict;
use warnings;
my $devlib;
foreach (@ARGV) {
if (/^--devlib$/) {
print "[info] --devlib are found, Developer mode enabled\n";
eval "use lib 'lib';";
}
}
eval "use FusionInventory::Agent;";
if ($@) {
print "Failed to load FusionInventory::Agent, $@\n";
print "you can run the agent directly for its source directory ";
print "with --devlib\n";
exit 1;
}
eval '
my $agent = new FusionInventory::Agent;
$agent->main();
';
if ($@) {
print "Execution failed. Are you sur the software is fully ";
print "installed\n";
print "and an old version of the agent not already present on the ";
print "system?\n";
print "___\n";
print $@;
exit 1;
}
__END__
=head1 NAME
fusioninventory-agent - FusionInventory agent For Linux/UNIX and MacOSX
=head1 SYNOPSIS
B<fusioninventory-agent> S<[ ... ]> S<[ I<--server server> | I<--local /tmp> ]>...
=head1 EXAMPLES
% fusioninventory-agent --server localhost
# send an inventory to the OCS server
% fusioninventory-agent --server http://localhost/ocsinventory2
# send an inventory over http to a server with a non standard
# virtual directory
% fusioninventory-agent --server https://localhost/ocsinventory
# send an inventory over https to the OCS server
% fusioninventory-agent --local /tmp
# write an inventory in the /tmp directory
% fusioninventory-agent --server localhost --user=toto --password=pw
--realm="Restricted Area"
# send a report to a server protected by a basic authentication
% fusioninventory-agent --lazy
# send an inventory only if the a random delay between 0 and PROLOG_FREQ
had been run over.
% fusioninventory-agent --delaytime 60 -d
# If NO PROLOG_FREQ has been preset, pick a time between execution and
--delaytime for the agent to contact the server [default is 3600 seconds]
=head1 DESCRIPTION
F<fusioninventory-agent> creates inventory and send or write them. This agent is the
successor of the former linux_agent which was released with OCS 1.01 and prior. It also
replaces the Solaris/AIX/BSD unofficial agents. The detailed list of supported
Operating System is available in the Wiki.
=over 4
=item F<GNU/Linux>
=item F<Solaris>
=item F<FreeBSD>
=item F<NetBSD>
=item F<OpenBSD>
=item F<AIX>
=item F<MacOSX>
=item F<GNU/kFreeBSD>
=item F<HP-UX>
=back
=head1 OPTIONS
Most of the options are available in a I<short> form and a I<long> form. For
example, the two lines below are all equivalent:
% fusioninventory-agent -s localhost
% fusioninventory-agent --server localhost
=over 4
=item B<--backend-collect-timeout=SECONDS_BEFORE_KILL>
Time before the agent kills modules processing which don't end before the
timeout.
=item B<--basevardir>=I<DIR>
Indicate the place where the agent should store its files.
=item B<--color>
Display color on the terminal.
=item B<-d>, B<--daemon>
Launch fusioninventory-agent as daemon in background. Proc::Daemon is needed.
=item B<-D>, B<--daemon-no-fork>
Launch fusioninventory-agent in daemon but do fork in background.
=item B<--ca-cert-dir=PATH>
The directory where public SSL certificat are stored. In general it
/etc/ssl/certs;
=item B<--ca-cert-file=FILE>
The path to the public certificat (e.g: /etc/ssl/certs/cacert.pem). If
--ca-cert-file is used, --ca-cert-dir is ignored.
=item B<--debug>
Turn the debug mode on.
=item B<--devlib>
This option is designed for the developer. With it enabled,
fusioninventory-agent won't try to load the Backend module installed
on the system. Instead it will scan the ./lib directory.
It may also be useful if you don't want to install the agent on
your system.
=item B<--delaytime=SECONDS_TO_WAIT>
This option defaults to waiting a random() time between 0 and 3600 before
initially contacting the server assuming NO PROLOG_FREQ has been set.
Once PROLOG_FREQ has been set, it uses that number at the top end of
it's random setting. Useful for pre-setting a deployed agent's initial
start time (so you don't jam the server all at once, but don't have to
wait an hour to make sure the deployment worked).
=item B<-f>, B<--force>
The agent ask first the server if it should send an inventoroy of the
machine. If the server doesn't know the machine or has outdated
informations, it will request it.
With this option, the agent ignore the server anwser and send an inventory.
=item B<-i>, B<--info>
Turn the verbose mode on. The flag is ignored if B<--debug> is enable.
=item B<--lazy>
Do not contact the server more than one time during the PROLOG_FREQ and do
an exit if there is nothing to do. Useful if you want to start the agent
script regulary from the crontab but don't want to overload the server.
=item B<-l>, B<--local>=I<DIR>
Write an inventory in the I<DIR> directory. A new file will be created if needed.
=item B<--logfile>=I<FILE>
Log message in I<FILE> and turn off STDERR
=item B<--no-ocsdeploy>
Disable the software deployment.
=item B<--no-inventory>
Do not generate inventory.
=item B<--no-wakeonlan>
Do not use the wakeonlan.
=item B<--no-software>
Do not inventory the software installed on the machine.
=item B<-p>, B<--password>=I<PASSWORD>
Use I<PASSWORD> for an HTTP identification with the server.
=item B<-P>, B<--proxy>=I<PROXY>
Use I<PROXY> to specify a proxy HTTP server. By default, the agent uses
HTTP_PROXY environment variable.
=item B<-r>, B<--realm>=I<REALM>
Use I<REALM> for an HTTP identification with the server. For example, the
value can be 'Restricted Area'. You can find it in the login popup of your
Internet browser.
=item B<--rpc-ip>=I<IP>
The IP address of the interface to use for the P2P exchange. The default
is 'all' the IP addresses with a 255.255.255.0 mask except 127.0.0.1.
=item B<--scan-homedirs>
Should the VirtualMachine inventory include users own VM?
=item B<-s>, B<--server>=I<URI>
The uri of the server. If I<URI> doesn't start with http:// or https://, the
assume the parameter is a hostname and rewrite it like that:
% --server=http://servername/ocsinventory
If you want to use https or another virtual directory (e.g: /ocsinventory2)
you need to enter the full path.
You can declare more than one server if you use the ',' delimiter.
% --server=http://servername/ocsinventory,server2
B<--server> is ignored if B<--local> is in use.
=item B<--stdout>
Print the inventory on stdout.
% fusioninventory-agent --stdout > /tmp/report.xml
# prepare an inventory and write it in the /tmp/report.xml file.
# A file will be created.
=item B<--scan-homedirs>
Authorized the agent to scan home directories to increase the Virtual Machine
inventory.
=item B<--tag>=I<TAG>
Mark the machine with the I<TAG> tag. Once the initial inventory
is accepted by the server this value is ignored and you've to
change the information directly on the server. The server do so
in order to centralize the administration of the machine.
=item B<--no-ssl-check>
Do now validate HTTPS certificat with the servers. Please never use this
option in production. This is just a very bad idea.
=item B<-u> I<USER>, B<--user>=I<USER>
Use I<USER> for the server authentication.
=item B<--version>
Print the version and exit.
=item B<-w> I<DURATION>, B<--wait>=I<DURATION>
Wait during a random period between 0 and DURATION second before initializing
the connexion with the server.
% fusioninventory-agent --wait 5 --server localhost
=back
=head1 CONFIG FILE
The agent try to initialize the settings from the B<agent.cfg>
config file.
It looks for the file in these location:
=over
=item /etc/fusioninventory/agent.cfg
=item /usr/local/etc/fusioninventory/agent.cfg
=back
=head1 AUTHORS
The maintainer is Goneri LE BOUDER <goneri@rulezlan.org>
Please read the AUTHORS, Changes and THANKS files to see who is behind
FusionInventory.
=head1 SEE ALSO
=over 4
=item FusionInventory website: L<http://www.FusionInventory.org/>
=item LaunchPad project page: L<http://launchpad.net/fusioninventory-agent>
=item the Mailing lists and IRC
=back
=head1 BUGS
Please, use the mailing lists as much as possible. You can open your own bug
tickets. Patches are welcome. You can also use LaunchPad bugtracker or
push your Bazaar branch on LaunchPad and do a merge request.
=head1 COPYRIGHT
Copyright (C) 2006-2010 OCS Inventory contributors
Copyright (C) 2010 FusionInventory Team
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 program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
=cut
|