source: ocsinventory-agent/trunk/fuentes/ocsinventory-agent @ 469

Last change on this file since 469 was 468, checked in by mabarracus, 4 years ago

Copyt trusty code

  • Property svn:executable set to *
File size: 8.7 KB
RevLine 
[468]1#!/usr/bin/perl
2
3#Copyright (C) 2006-2011 OCS Inventory Developers
4#
5#This program is free software; you can redistribute it and/or
6#modify it under the terms of the GNU General Public License
7#as published by the Free Software Foundation; either version 2
8#of the License, or (at your option) any later version.
9#
10#This program is distributed in the hope that it will be useful,
11#but WITHOUT ANY WARRANTY; without even the implied warranty of
12#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13#GNU General Public License for more details.
14#
15#You should have received a copy of the GNU General Public License
16#along with this program; if not, write to the Free Software
17#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
18#USA.
19#
20
21use strict;
22use warnings;
23
24my $devlib;
25foreach (@ARGV) {
26    if (/^--devlib$/) {
27        print "[info] --devlib are found, Developer mode enabled\n";
28        eval "use lib 'lib';";
29    }
30}
31
32eval "use Ocsinventory::Agent;";
33if ($@) {
34    print "Failed to load Ocsinventory::Agent, $@\n";
35    print "you can run the agent directly for its source directory ";
36    print "with --devlib\n";
37    exit 1;
38}
39
40eval "Ocsinventory::Agent::run();";
41print $@;
42__END__
43
44=head1 NAME
45
46ocsinventory-agent - Unified client for OCS-Inventory
47
48=head1 SYNOPSIS
49
50B<ocsinventory-agent> S<[ B<-fhilpruw> ]> S<[ I<--server server> | I<--local /tmp> ]>...
51
52=head1 EXAMPLES
53
54    % ocsinventory-agent --server localhost
55    # send an inventory to the OCS server
56
57    % ocsinventory-agent --server http://localhost/ocsinventory2
58    # send an inventory over http to a server with a non standard
59    # virtual directory
60
61    % ocsinventory-agent --server https://localhost/ocsinventory
62    # send an inventory over https to the OCS server
63
64    % ocsinventory-agent --local /tmp
65    # write an inventory in the /tmp directory
66
67    % ocsinventory-agent --server localhost --user=toto --password=pw --realm="Restricted Area"
68    # send a report to a server protected by a basic authentication
69    % ocsinventory-agent --lazy
70    # send an inventory only if the a random delay between 0 and PROLOG_FREQ had been run over.
71
72    % ocsinventory-agent --delaytime 60 -d
73    # 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]
74
75=head1 DESCRIPTION
76
77F<ocsinventory-agent> creates inventory and send or write them. This agent is the
78successor of the former linux_agent which was released with OCS 1.01 and prior. It also
79replaces the Solaris/AIX/BSD unofficial agents. The detailed list of supported
80Operating System is available in the Wiki.
81
82=over 4
83
84=item F<GNU/Linux>
85
86=item F<Solaris>
87
88=item F<FreeBSD>
89
90=item F<NetBSD>
91
92=item F<OpenBSD>
93
94=item F<AIX>
95
96=item F<MacOSX>
97
98=item F<GNU/kFreeBSD>
99
100=back
101
102=head1 OPTIONS
103
104Most of the options are available in a I<short> form and a I<long> form.  For
105example, the two lines below are all equivalent:
106
107    % ocsinventory-agent -s localhost
108    % ocsinventory-agent --server localhost
109
110=over 4
111
112=item B<--backend-collect-timeout=SECONDS_BEFORE_KILL>
113
114Time before OCS kills modules processing which don't end before the timeout.
115
116=item B<--basevardir>=I<DIR>
117
118Indicate the place where the agent should store its files.
119
120=item B<-d>, B<--daemon>
121
122Launch ocsinventory-agent in background. Proc::Daemon is needed.
123
124=item B<--debug>
125
126Turn the debug mode on.
127
128=item B<--devlib>
129
130This option is designed for backend module developer. With it enabled, ocsinventry-agent won't try to load the Backend module installed on the system. Instead it will scan the ./lib directory.
131
132=item B<--delaytime=SECONDS_TO_WAIT>
133
134This 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).
135
136=item B<-f>, B<--force>
137
138The agent will first contact the server during the PROLOG period. If the server doesn't know the machine or has outdated informations, it will ask for an inventory.
139With this option, the agent doesn't run the PROLOG with the server first but directly sends an inventory.
140
141=item B<-i>, B<--info>
142
143Turn the verbose mode on. The flag is ignored if B<--debug> is enable.
144
145=item B<--lazy>
146
147Do not contact the server more than one time during the PROLOG_FREQ and do
148an exit if there is nothing to do. Useful if you want to start the agent
149script regulary from the crontab but don't want to overload the server.
150
151=item B<-l>, B<--local>=I<DIR>
152
153Write an inventory in the I<DIR> directory. A new file will be created if needed.
154
155=item B<--logfile>=I<FILE>
156
157Log message in I<FILE> and turn off STDERR
158
159=item B<-p>, B<--password>=I<PASSWORD>
160
161Use I<PASSWORD> for an HTTP identification with the server.
162
163=item B<-P>, B<--proxy>=I<PROXY>
164
165Use I<PROXY> to specify a proxy HTTP server. By default, the agent uses HTTP_PROXY environment variable.
166
167=item B<-r>, B<--realm>=I<REALM>
168
169Use 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.
170
171=item B<-s>, B<--server>=I<URI>
172
173The 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:
174
175    % http://servername/ocsinventory
176
177If you want to use https or another virtual directory you need to enter the full path.
178
179B<--server> is ignored if B<--local> is in use.
180
181=item B<--stdout>
182
183Print the inventory on stdout.
184
185    % ocsinventory-agent --stdout > /tmp/report.xml
186    # prepare an inventory and write it in the /tmp/report.xml file.
187    # A file will be created.
188
189=item B<--scan-homedirs>
190
191Authorized OCS to scan home directories to increase the Virtual Machine inventory.
192WARNING: beware with user privacy by using this option because it may encounter private data scans (even if it's not designed for !).
193
194=item B<--tag>=I<TAG>
195
196Mark 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.
197
198=item B<-u> I<USER>, B<--user>=I<USER>
199
200Use I<USER> for the server authentication.
201
202=item B<--version>=I<USER>
203
204Print the version and exit.
205
206=item B<-w> I<DURATION>, B<--wait>=I<DURATION>
207
208Wait before initializing the connexion with the server. If I<DURATION> equal I<server> the agent will use the PROLOG_FREQ of the server to determine the duration of this periode. Exactly like it would had done if it was in --daemon mode.
209Else if duration is a numerical value, it will be used directly.
210
211    % ocsinventory-agent --wait 5 --server localhost
212
213=item B<--nosoftware>
214
215Do not inventory the software installed on the machine. B<--nosoft> also
216works but is deperecated.
217
218=item B<--nolocal>
219
220Desactivate local mode even if it is set in config file or command line
221
222=back
223
224=head1 CONFIG FILE
225
226The agent try to initialize the settings from the B<ocsinventory-agent.cfg>
227config file.
228
229It looks for the file in these directories:
230
231=over
232
233=item /etc/ocsinventory
234
235=item /usr/local/etc/ocsinventory
236
237=item /etc/ocsinventory-agent
238
239=back
240
241=head1 AUTHORS
242
243The maintainer is Guillaume PROTET <guillaume.protet@mortheres.info>
244
245Please read the AUTHORS, Changes and THANKS files to see who is behind OCS
246Inventory Agent.
247
248=head1 SEE ALSO
249
250=over 4
251
252=item OCS-Inventory website,
253
254 http://www.ocsinventory-ng.org/
255
256=item LaunchPad project page,
257
258 http://launchpad.net/ocsinventory-unix-agent
259
260=item forum,
261
262 http://forums.ocsinventory-ng.org/
263
264=item and wiki
265
266 http://wiki.ocsinventory-ng.org/
267
268=back
269
270=head1 BUGS
271
272Please, use the forum as much as possible. You can open your own bug tickets.
273Patches are welcome. You can also use LaunchPad bugtracker or
274push your Bazaar branch on LaunchPad and do a merge request.
275
276=head1 COPYRIGHT
277
278Copyright (C) 2006-2011 OCS Inventory contributors
279
280 This program is free software; you can redistribute it and/or modify
281 it under the terms of the GNU General Public License as published by
282 the Free Software Foundation; either version 2 of the License, or
283 (at your option) any later version.
284
285 This program is distributed in the hope that it will be useful,
286 but WITHOUT ANY WARRANTY; without even the implied warranty of
287 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
288 GNU General Public License for more details.
289
290 You should have received a copy of the GNU General Public License
291 along with this program; if not, write to the Free Software
292 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
293
294=cut
Note: See TracBrowser for help on using the repository browser.