Codebase list fusioninventory-agent / 53a5fb3
Import Debian changes 2.2.3-1 fusioninventory-agent (2.2.3-1) unstable; urgency=low * New upstream release fusioninventory-agent (2.2.2-1) unstable; urgency=low * New upstream release Gonéri Le Bouder authored 11 years ago Guillaume Bougard committed 5 years ago
30 changed file(s) with 939 addition(s) and 130 deletion(s). Raw diff Collapse all Expand all
00 Revision history for FusionInventory agent
11
2 2.2.1
2 2.2.3 Mon, 25 Jun 2012 21:36:29 +0200
3 General:
4 * Fix battery voltage and capacity retrieval
5 * Add --timeout option
6
7 MacOSX:
8 * Fix global memory and CPU inventory
9 * Fix drives inventory
10
11 Linux:
12 * LXC support (Egor Morozov)
13
14 2.2.2 Wed, 30 May 2012 16:56:43 +0200
15 General:
16 * Improve README
17 * Fix Screen.pm syntax error
18 * Add a test_requires dependency on LWP::Protocol::https
19
20 Windows:
21 * fix command execution
22
23 7ff3260 fix warning if getDevicesFromUdev returns nothing
24
25 Linux:
26 * detect Virtuozzo VM (Alexander Evseev)
27
28 2.2.1 Thu, 24 May 2012 14:39:50 +0200
329 General:
430 * failure encoding with UTF8 content when using Fusion protocol (#1663)
531 * wrong CSS path (#1580)
77 contrib/yum-plugin/INSTALL
88 etc/agent.cfg
99 fusioninventory-agent
10 fusioninventory-agent.1.html
1011 fusioninventory-injector
1112 fusioninventory-win32-service
1213 inc/Module/AutoInstall.pm
160161 lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization.pm
161162 lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Hpvm.pm
162163 lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Libvirt.pm
164 lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Lxc.pm
163165 lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Parallels.pm
164166 lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/Qemu.pm
165167 lib/FusionInventory/Agent/Task/Inventory/Input/Virtualization/SolarisZones.pm
621623 resources/solaris/showrev/x86-3
622624 resources/solaris/smbios/x86-1
623625 resources/solaris/smbios/x86-3
626 resources/virtualization/lxc/config
627 resources/virtualization/lxc/lxc-info_-n_name1
628 resources/virtualization/lxc/lxc-ls_-1
624629 resources/virtualization/prlctl/sample1
625630 resources/virtualization/README
626631 resources/virtualization/vboxmanage/sample1
759764 t/inventory/solaris/networks.t
760765 t/inventory/solaris/storages.t
761766 t/inventory/virtualization/libvirt.t
767 t/inventory/virtualization/lxc.t
762768 t/inventory/virtualization/parallels.t
763769 t/inventory/virtualization/virtualbox.t
764770 t/inventory/virtualization/xen.t
77 IO::Capture::Stderr: 0
88 IO::Socket::SSL: 0
99 IPC::Run: 0
10 LWP::Protocol::https: 0
1011 Test::Exception: 0
1112 Test::MockModule: 0
1213 Test::More: 0.93
3031 Compress::Zlib: 0
3132 HTTP::Daemon: 0
3233 IO::Socket::SSL: 0
34 LWP::Protocol::https: 0
3335 Net::CUPS: 0.6
3436 Proc::Daemon: 0
3537 Proc::PID::File: 0
4446 perl: 5.8.0
4547 resources:
4648 license: http://opensource.org/licenses/gpl-license.php
47 version: 2.2.1
49 version: 2.2.3
2828 "IO::Capture::Stderr" : "0",
2929 "IO::Socket::SSL" : "0",
3030 "IPC::Run" : "0",
31 "LWP::Protocol::https" : "0",
3132 "Test::Exception" : "0",
3233 "Test::MockModule" : "0",
3334 "Test::More" : "0.93",
5354 }
5455 },
5556 "release_status" : "stable",
56 "version" : "v2.2.1"
57 "version" : "v2.2.3"
5758 }
99 IO::Capture::Stderr: 0
1010 IO::Socket::SSL: 0
1111 IPC::Run: 0
12 LWP::Protocol::https: 0
1213 Test::Exception: 0
1314 Test::MockModule: 0
1415 Test::More: 0.93
3536 UNIVERSAL::require: 0
3637 XML::TreePP: 0.26
3738 perl: 5.008
38 version: v2.2.1
39 version: v2.2.3
2626 recommends 'HTTP::Daemon' => undef;
2727 recommends 'Net::CUPS' => 0.60;
2828 recommends 'IO::Socket::SSL' => undef;
29 recommends 'LWP::Protocol::https' => undef;
2930
3031 if ($OSNAME ne 'MSWin32') {
3132 recommends 'Proc::Daemon' => undef;
4647 test_requires 'Test::MockModule' => undef;
4748 test_requires 'Test::More' => '0.93'; # subtest
4849 test_requires 'YAML' => undef;
50 test_requires 'LWP::Protocol::https' => undef;
4951
5052 install_script 'fusioninventory-agent';
5153 install_script 'fusioninventory-win32-service' if $OSNAME eq 'MSWin32';
22
33 Description
44 -----------
5 The fusioinventory agent is a generic agent, running on each managed node. It
6 can perform a certain number of actions, called tasks, according to its own
7 execution plan, or on behalf of a GLPI server with fusioninventory plugin,
8 acting as a control point.
5 The FusionInventory agent is a generic management agent. It can perform a
6 certain number of tasks, according to its own execution plan, or on behalf of a
7 GLPI server with fusioninventory plugin, acting as a control point.
98
109 Two of these tasks are included in agent source distribution, local inventory
1110 and wake on lan. Other tasks are distributed separatly, excepted for binary
0 fusioninventory-agent (2.2.3-1) unstable; urgency=low
1
2 * New upstream release
3
4 -- Gonéri Le Bouder <goneri@rulezlan.org> Tue, 26 Jun 2012 16:45:48 +0200
5
6 fusioninventory-agent (2.2.2-1) unstable; urgency=low
7
8 * New upstream release
9
10 -- Gonéri Le Bouder <goneri@rulezlan.org> Wed, 30 May 2012 18:01:10 +0200
11
012 fusioninventory-agent (2.2.1-1) unstable; urgency=low
113
214 * New upstream release
7676 ca-cert-file =
7777 # do not check server SSL certificates
7878 no-ssl-check = 0
79 # connection timeout
80 timeout = 180
7981
8082 #
8183 # Web interface options
5050 'server|s=s',
5151 'stdout',
5252 'tag|t=s',
53 'timeout=i',
5354 'user|u=s',
5455 'version',
5556 'wait|w=s',
158159 --ca-cert-dir=D path to the CA certificates directory
159160 --ca-cert-file=F path to the CA certificates file
160161 --no-ssl-check do not check server SSL certificates (false)
162 --timeout connection timeout (180)
161163
162164 Web interface options
163165 --no-httpd disable embedded web server (false)
452454
453455 Trust requests from given range without authentication token (false).
454456
457 For example: "192.168.0.0/24", "192.68.168.0.5" or an IP range like
458 "20.34.101.207 - 201.3.9.99". See L<Net::IP> documentation to get more example.
459
455460 =back
456461
457462 =head2 Logging options
0 <?xml version="1.0" ?>
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <title>fusioninventory-agent - FusionInventory agent For Linux/UNIX, Windows and MacOSX</title>
5 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
6 <link rev="made" href="mailto:root@localhost" />
7 </head>
8
9 <body style="background-color: white">
10
11
12 <!-- INDEX BEGIN -->
13 <div name="index">
14 <p><a name="__index__"></a></p>
15
16 <ul>
17
18 <li><a href="#name">NAME</a></li>
19 <li><a href="#synopsis">SYNOPSIS</a></li>
20 <li><a href="#examples">EXAMPLES</a></li>
21 <li><a href="#description">DESCRIPTION</a></li>
22 <li><a href="#ocs_inventory_protocol">OCS INVENTORY PROTOCOL</a></li>
23 <ul>
24
25 <li><a href="#first__the_prolog">First, The PROLOG</a></li>
26 <li><a href="#module_execution">Module execution</a></li>
27 <li><a href="#server_mode__windows_service_or_unix_daemon_">Server mode (Windows service or Unix daemon)</a></li>
28 </ul>
29
30 <li><a href="#options">OPTIONS</a></li>
31 <ul>
32
33 <li><a href="#target_definition_options">Target definition options</a></li>
34 <li><a href="#target_scheduling_options">Target scheduling options</a></li>
35 <li><a href="#task_selection_options">Task selection options</a></li>
36 <li><a href="#inventory_task_specific_options">Inventory task specific options</a></li>
37 <li><a href="#package_deployment_task_specific_options">Package deployment task specific options</a></li>
38 <li><a href="#server_target_specific_options">Server target specific options</a></li>
39 <li><a href="#web_interface_options">Web interface options</a></li>
40 <li><a href="#logging_options">Logging options</a></li>
41 <li><a href="#configuration_options">Configuration options</a></li>
42 <li><a href="#execution_mode_options">Execution mode options</a></li>
43 </ul>
44
45 <li><a href="#configuration">CONFIGURATION</a></li>
46 </ul>
47
48 <hr name="index" />
49 </div>
50 <!-- INDEX END -->
51
52 <p>
53 </p>
54 <h1><a name="name">NAME</a></h1>
55 <p>fusioninventory-agent - FusionInventory agent For Linux/UNIX, Windows and MacOSX</p>
56 <p>
57 </p>
58 <hr />
59 <h1><a name="synopsis">SYNOPSIS</a></h1>
60 <p><strong>fusioninventory-agent</strong> [options] [--server server|--local directory|--sdout]</p>
61 <pre>
62 Target definition options
63 -s --server=URI send tasks result to a server
64 -l --local=DIR write tasks results in a directory
65 --stdout write tasks result on STDOUT</pre>
66 <pre>
67 Target scheduling options
68 --delaytime=DURATION maximum initial delay before first target, in seconds (3600)
69 -w --wait=DURATION maximum delay between each target, in seconds
70 --lazy do not contact the target before next scheduled time</pre>
71 <pre>
72 Task selection options
73 --list-tasks list available tasks and exit
74 --no-task=TASK do not run given task</pre>
75 <pre>
76 Inventory task specific options
77 --no-category=CATEGORY do not list given category items
78 --scan-homedirs allow to scan use home directories (false)
79 --html save the inventory as HTML (false)
80 -f --force always send data to server (false)
81 -t --tag=TAG mark the machine with given tag
82 --backend-collect-timeout timeout for inventory modules execution (30)
83 --additional-content=FILE additional inventory content</pre>
84 <pre>
85 Package deployment task specific options
86 --no-p2p do not use peer to peer to download files (false)</pre>
87 <pre>
88 Network options:
89 -P --proxy=PROXY proxy address
90 -u --user=USER user name for server authentication
91 -p --password=PWD password for server authentication
92 --ca-cert-dir=D path to the CA certificates directory
93 --ca-cert-file=F path to the CA certificates file
94 --no-ssl-check do not check server SSL certificates (false)
95 --timeout connection timeout (180)</pre>
96 <pre>
97 Web interface options
98 --no-httpd disable embedded web server (false)
99 --httpd-ip=IP network interface to listen to
100 --httpd-port=PORT network port to listen to (62354)
101 --httpd-trust=RANGE trust requests from range without authentication token (false)</pre>
102 <pre>
103 Logging options
104 --logger=BACKEND logger backend [Stderr|File|Syslog] (Stderr)
105 --logfile=FILE log file
106 --logfile-maxsize=X maximum size of the log file in MB (0)
107 --logfacility=FACILITY syslog facility (LOG_USER)
108 --color use color in the console (false)</pre>
109 <pre>
110 Configuration options
111 --config=BACKEND configuration backend [file|registry|none]
112 --conf-file=FILE configuration file</pre>
113 <pre>
114 Execution mode options
115 -d --daemon run the agent as a daemon (false)
116 --no-fork don't fork in background (false)
117 --debug debug mode (false)
118 --version print the version and exit</pre>
119 <p>
120 </p>
121 <hr />
122 <h1><a name="examples">EXAMPLES</a></h1>
123 <pre>
124 % fusioninventory-agent --server localhost
125 # execute all available tasks required by a local server</pre>
126 <pre>
127 % fusioninventory-agent --server <a href="http://localhost/ocsinventory2">http://localhost/ocsinventory2</a>
128 # execute all available tasks required by a local server, using a specific
129 # URI</pre>
130 <pre>
131 % fusioninventory-agent --server https://localhost/ocsinventory
132 # execute all available tasks required by a local server, using a secure
133 # connection</pre>
134 <pre>
135 % fusioninventory-agent --server localhost --user test --password s3cr3t
136 # execute all available tasks required by a local server, using HTTP
137 # authentication</pre>
138 <pre>
139 % fusioninventory-agent --local /tmp
140 # execute all available tasks and write the result in /tmp directory</pre>
141 <pre>
142 % fusioninventory-agent --local /tmp --html
143 # execute all available tasks and write the result in /tmp directory in
144 # HTML format</pre>
145 <p>
146 </p>
147 <hr />
148 <h1><a name="description">DESCRIPTION</a></h1>
149 <p><em class="file">fusioninventory-agent</em> is an agent for OCS Inventory server and
150 FusionInventory for GLPI servers. It creates local inventory of the machines
151 (hardware and software) and send it to the server. It can also write it
152 in a local XML file.
153 This agent is the successor of the former linux_agent which was released with
154 OCS 1.01 and prior. It also replaces the Solaris/AIX/BSD unofficial agents.</p>
155 <p>Supported systems:</p>
156 <dl>
157 <dt><strong><a name="windows" class="item"><em class="file">Windows</em> (since Windows 2000)</a></strong></dt>
158
159 <dt><strong><a name="gnu_linux" class="item"><em class="file">GNU/Linux</em></a></strong></dt>
160
161 <dt><strong><a name="macosx" class="item"><em class="file">MacOSX</em></a></strong></dt>
162
163 <dt><strong><a name="solaris" class="item"><em class="file">Solaris</em></a></strong></dt>
164
165 <dt><strong><a name="freebsd" class="item"><em class="file">FreeBSD</em></a></strong></dt>
166
167 <dt><strong><a name="netbsd" class="item"><em class="file">NetBSD</em></a></strong></dt>
168
169 <dt><strong><a name="openbsd" class="item"><em class="file">OpenBSD</em></a></strong></dt>
170
171 <dt><strong><a name="aix" class="item"><em class="file">AIX</em></a></strong></dt>
172
173 <dt><strong><a name="hp_ux" class="item"><em class="file">HP-UX</em></a></strong></dt>
174
175 <dt><strong><a name="gnu_kfreebsd" class="item"><em class="file">GNU/kFreeBSD</em></a></strong></dt>
176
177 </dl>
178 <p>
179 </p>
180 <hr />
181 <h1><a name="ocs_inventory_protocol">OCS INVENTORY PROTOCOL</a></h1>
182 <p>FusionInventory Agent uses OCS Inventory protocol and is compatible with OCS
183 Inventory server. The agent uses the same protocol with the FusionInventory
184 For GLPI plugin.</p>
185 <p>The OCS protocol is basicly an exchange of XML file done over HTTP(S).</p>
186 <p>
187 </p>
188 <h2><a name="first__the_prolog">First, The PROLOG</a></h2>
189 <p>The agent send a first message to give it's ID (DEVICEID). The
190 server send back to the agent an XML file with a list of parameter. It's the
191 PROLOG RESP. You can see it if you're in Debug mode.
192 In this PROLOG, the server send the PROLOG_FREQ. The agent will use it to
193 know when it need to contact the server for the next time.</p>
194 <p>The agent compute the next query date this way:</p>
195 <pre>
196 PROLOG_FREQ/2+RANDOM(PROLOG_FREQ/2)</pre>
197 <p>
198 </p>
199 <h2><a name="module_execution">Module execution</a></h2>
200 <p>The agent will launch each modules and pass the list of options found in the
201 PROLOG RESP as parameter. The module can send information directly to the
202 server (inventory, SNMP scan result, etc)</p>
203 <p>
204 </p>
205 <h2><a name="server_mode__windows_service_or_unix_daemon_">Server mode (Windows service or Unix daemon)</a></h2>
206 <p>In server mode, the agent wait during a period between the last PROLOG and
207 PROLOG_FREQ. If PROLOG_FREQ is not set, it will use --delaytime value.
208 The default value is 3600.</p>
209 <p>
210 </p>
211 <hr />
212 <h1><a name="options">OPTIONS</a></h1>
213 <p>Most of the options are available in a <em>short</em> form and a <em>long</em> form. For
214 example, the two lines below are all equivalent:</p>
215 <pre>
216 % fusioninventory-agent -s localhost
217 % fusioninventory-agent --server localhost</pre>
218 <p>
219 </p>
220 <h2><a name="target_definition_options">Target definition options</a></h2>
221 <dl>
222 <dt><strong><a name="s_server_uri" class="item"><strong>-s</strong>, <strong>--server</strong>=<em>URI</em></a></strong></dt>
223
224 <dd>
225 <p>Send results of tasks execution to given server.</p>
226 <p>If <em>URI</em> doesn't start with http:// or https://, the agent assume the
227 parameter is a hostname and rewrite it as:</p>
228 <pre>
229 % --server=<a href="http://servername/ocsinventory">http://servername/ocsinventory</a></pre>
230 <p>In general, OCS Inventory server URL have this format:</p>
231 <pre>
232 <a href="http://servername/ocsinventory">http://servername/ocsinventory</a></pre>
233 <p>and FusionInventory for GLPI this one:</p>
234 <pre>
235 <a href="http://servername/glpi/plugins/fusioninventory/front/plugin_fusioninventory.communication.php">http://servername/glpi/plugins/fusioninventory/front/plugin_fusioninventory.communication.php</a></pre>
236 <p>Multiple values can be specified, using comma as a separator.</p>
237 </dd>
238 <dt><strong><a name="l_local_dir" class="item"><strong>-l</strong>, <strong>--local</strong>=<em>DIR</em></a></strong></dt>
239
240 <dd>
241 <p>Write the results of tasks execution to given directory.</p>
242 </dd>
243 <dt><strong><a name="stdout" class="item"><strong>--stdout</strong></a></strong></dt>
244
245 <dd>
246 <p>Write the results of tasks execution on stdout.</p>
247 </dd>
248 </dl>
249 <p>
250 </p>
251 <h2><a name="target_scheduling_options">Target scheduling options</a></h2>
252 <dl>
253 <dt><strong><a name="delaytime_limit" class="item"><strong>--delaytime</strong>=<em>LIMIT</em></a></strong></dt>
254
255 <dd>
256 <p>Set an initial delay before the first target, whose value is computed randomly
257 between LIMIT / 2 and LIMIT seconds. This setting is ignored for server targets
258 after the initial contact, in favor of server-specified parameter
259 (PROLOG_FREQ).</p>
260 </dd>
261 <dt><strong><a name="w_limit_wait_limit" class="item"><strong>-w</strong> <em>LIMIT</em>, <strong>--wait</strong>=<em>LIMIT</em></a></strong></dt>
262
263 <dd>
264 <p>Set a delay between each targets, whose value is computed randomly between 0
265 and LIMIT seconds.</p>
266 </dd>
267 <dt><strong><a name="lazy" class="item"><strong>--lazy</strong></a></strong></dt>
268
269 <dd>
270 <p>Do not contact the target before next scheduled time.</p>
271 <p>This option is only available when the agent is not run as a server.</p>
272 </dd>
273 </dl>
274 <p>
275 </p>
276 <h2><a name="task_selection_options">Task selection options</a></h2>
277 <dl>
278 <dt><strong><a name="no_task_task" class="item"><strong>--no-task</strong>=<em>TASK</em></a></strong></dt>
279
280 <dd>
281 <p>Disable the given task</p>
282 </dd>
283 <dt><strong><a name="list_tasks" class="item"><strong>--list-tasks</strong></a></strong></dt>
284
285 <dd>
286 <p>List available tasks and exit</p>
287 </dd>
288 </dl>
289 <p>
290 </p>
291 <h2><a name="inventory_task_specific_options">Inventory task specific options</a></h2>
292 <dl>
293 <dt><strong><a name="no_category_category" class="item"><strong>--no-category</strong>=<em>CATEGORY</em></a></strong></dt>
294
295 <dd>
296 <p>Do not list given category items in inventory.</p>
297 </dd>
298 <dt><strong><a name="scan_homedirs" class="item"><strong>--scan-homedirs</strong></a></strong></dt>
299
300 <dd>
301 <p>Allow the agent to scan home directories for virtual machines.</p>
302 </dd>
303 <dt><strong><a name="html" class="item"><strong>--html</strong></a></strong></dt>
304
305 <dd>
306 <p>Save the inventory as HTML.</p>
307 <p>This is only used for local inventories.</p>
308 </dd>
309 <dt><strong><a name="f_force" class="item"><strong>-f</strong>, <strong>--force</strong></a></strong></dt>
310
311 <dd>
312 <p>Send an inventory to the server, even if this last one doesn't ask for it.</p>
313 </dd>
314 <dt><strong><a name="tag_tag" class="item"><strong>--tag</strong>=<em>TAG</em></a></strong></dt>
315
316 <dd>
317 <p>Mark the machine with given tag.</p>
318 </dd>
319 <dt><strong><a name="backend_collect_timeout_time" class="item"><strong>--backend-collect-timeout</strong>=<em>TIME</em></a></strong></dt>
320
321 <dd>
322 <p>Timeout for inventory modules execution.</p>
323 </dd>
324 </dl>
325 <p>
326 </p>
327 <h2><a name="package_deployment_task_specific_options">Package deployment task specific options</a></h2>
328 <dl>
329 <dt><strong><a name="no_p2p" class="item"><strong>--no-p2p</strong></a></strong></dt>
330
331 <dd>
332 <p>Do not use peer to peer to download files.</p>
333 </dd>
334 </dl>
335 <p>
336 </p>
337 <h2><a name="server_target_specific_options">Server target specific options</a></h2>
338 <dl>
339 <dt><strong><a name="p_proxy_proxy" class="item"><strong>-P</strong>, <strong>--proxy</strong>=<em>PROXY</em></a></strong></dt>
340
341 <dd>
342 <p>Use <em>PROXY</em> as HTTP proxy.</p>
343 <p>By default, the agent uses HTTP_PROXY environment variable.</p>
344 </dd>
345 <dt><strong><a name="u_user_user_user" class="item"><strong>-u</strong> <em>USER</em>, <strong>--user</strong>=<em>USER</em></a></strong></dt>
346
347 <dd>
348 <p>Use <em>USER</em> for server authentication.</p>
349 </dd>
350 <dt><strong><a name="p_password_password" class="item"><strong>-p</strong>, <strong>--password</strong>=<em>PASSWORD</em></a></strong></dt>
351
352 <dd>
353 <p>Use <em>PASSWORD</em> for server authentication.</p>
354 </dd>
355 <dt><strong><a name="ca_cert_dir_path" class="item"><strong>--ca-cert-dir</strong>=<em>PATH</em></a></strong></dt>
356
357 <dd>
358 <p>Path to the CA certificates directory.</p>
359 </dd>
360 <dt><strong><a name="ca_cert_file_file" class="item"><strong>--ca-cert-file</strong>=<em>FILE</em></a></strong></dt>
361
362 <dd>
363 <p>Path to the CA certificates file.</p>
364 </dd>
365 <dt><strong><a name="no_ssl_check" class="item"><strong>--no-ssl-check</strong></a></strong></dt>
366
367 <dd>
368 <p>Do not check server SSL certificates.</p>
369 <p>Hint: you can set HTTPS_DEBUG environment variable to get SSL error messages in
370 the console.</p>
371 </dd>
372 </dl>
373 <p>
374 </p>
375 <h2><a name="web_interface_options">Web interface options</a></h2>
376 <dl>
377 <dt><strong><a name="no_httpd" class="item"><strong>--no-httpd</strong></a></strong></dt>
378
379 <dd>
380 <p>Disable the embedded web server.</p>
381 </dd>
382 <dt><strong><a name="httpd_ip_ip" class="item"><strong>--httpd-ip</strong>=<em>IP</em></a></strong></dt>
383
384 <dd>
385 <p>The network interface to use for the embedded web server (all
386 available interfaces).</p>
387 </dd>
388 <dt><strong><a name="httpd_port_port" class="item"><strong>--httpd-port</strong>=<em>PORT</em></a></strong></dt>
389
390 <dd>
391 <p>The network port to use for the embedded web server (62354).</p>
392 </dd>
393 <dt><strong><a name="httpd_trust_range" class="item"><strong>--httpd-trust</strong>=<em>RANGE</em></a></strong></dt>
394
395 <dd>
396 <p>Trust requests from given range without authentication token (false).</p>
397 <p>For example: &quot;192.168.0.0/24&quot;, &quot;192.68.168.0.5&quot; or an IP range like
398 &quot;20.34.101.207 - 201.3.9.99&quot;. See <a href="/Net/IP.html">the Net::IP manpage</a> documentation to get more example.</p>
399 </dd>
400 </dl>
401 <p>
402 </p>
403 <h2><a name="logging_options">Logging options</a></h2>
404 <dl>
405 <dt><strong><a name="logger_backend" class="item"><strong>--logger</strong>=<em>BACKEND</em></a></strong></dt>
406
407 <dd>
408 <p>Logger backend to use. It can be:</p>
409 <dl>
410 <dt>
411 <dd>
412 <p>Stderr: log messages directly in the console.</p>
413 </dd>
414 <dt>
415 <dd>
416 <p>File: log messages in a file.</p>
417 </dd>
418 <dt>
419 <dd>
420 <p>Syslog: log messages through the local syslog server</p>
421 </dd>
422 </dl>
423 <p>Multiple values can be specified, using comma as a separator.</p>
424 </dd>
425 <dt><strong><a name="logfile_file" class="item"><strong>--logfile</strong>=<em>FILE</em></a></strong></dt>
426
427 <dd>
428 <p>Log message in <em>FILE</em> (implies File logger backend)</p>
429 </dd>
430 <dt><strong><a name="logfile_maxsize_file" class="item"><strong>--logfile-maxsize</strong>=<em>FILE</em></a></strong></dt>
431
432 <dd>
433 <p>Max logfile size in MB, default is unlimited. When the max size is reached, the
434 file is truncated. This is only useful if there is no log rotation mechanism on
435 the system.</p>
436 </dd>
437 <dt><strong><a name="logfacility_facility" class="item"><strong>--logfacility</strong>=<em>FACILITY</em></a></strong></dt>
438
439 <dd>
440 <p>Syslog facility to use (default LOG_USER)</p>
441 </dd>
442 <dt><strong><a name="color" class="item"><strong>--color</strong></a></strong></dt>
443
444 <dd>
445 <p>Display color on the terminal, when the Stderr backend is used.</p>
446 <p>This options is ignored on Windows.</p>
447 </dd>
448 </dl>
449 <p>
450 </p>
451 <h2><a name="configuration_options">Configuration options</a></h2>
452 <dl>
453 <dt><strong><a name="conf_file_file" class="item"><strong>--conf-file</strong>=<em>FILE</em></a></strong></dt>
454
455 <dd>
456 <p>Use <em>FILE</em> as configuration file (implies file configuration backend)</p>
457 </dd>
458 <dt><strong><a name="config_backend" class="item"><strong>--config</strong>=<em>BACKEND</em></a></strong></dt>
459
460 <dd>
461 <p>Configuration backend to use. It can be:</p>
462 <dl>
463 <dt>
464 <dd>
465 <p>file: read configuration from a file (default anywhere else as Windows)</p>
466 </dd>
467 <dt>
468 <dd>
469 <p>registry: read configuration from the registry (default on Windows)</p>
470 </dd>
471 <dt>
472 <dd>
473 <p>none: don't read any configuration</p>
474 </dd>
475 </dl>
476 </dd>
477 </dl>
478 <p>
479 </p>
480 <h2><a name="execution_mode_options">Execution mode options</a></h2>
481 <dl>
482 <dt><strong><a name="d_daemon" class="item"><strong>-d</strong>, <strong>--daemon</strong></a></strong></dt>
483
484 <dd>
485 <p>Run the agent as a daemon.</p>
486 </dd>
487 <dt><strong><a name="no_fork" class="item"><strong>--no-fork</strong></a></strong></dt>
488
489 <dd>
490 <p>Don't fork in background.</p>
491 <p>This is only useful when running as a daemon.</p>
492 </dd>
493 <dt><strong><a name="debug" class="item"><strong>--debug</strong></a></strong></dt>
494
495 <dd>
496 <p>Turn the debug mode on.</p>
497 </dd>
498 <dt><strong><a name="setup" class="item"><strong>--setup</strong></a></strong></dt>
499
500 <dd>
501 <p>Print the agent setup directories and exit.</p>
502 </dd>
503 <dt><strong><a name="version" class="item"><strong>--version</strong></a></strong></dt>
504
505 <dd>
506 <p>Print the version and exit.</p>
507 </dd>
508 </dl>
509 <p>
510 </p>
511 <hr />
512 <h1><a name="configuration">CONFIGURATION</a></h1>
513 <p>The agent is able to use multiple configuration backends. The registry backend
514 is the default on Windows platform, and the file backend is the default
515 everywhere else. Another backend can be specified using the <strong>--config</strong> option.</p>
516 <p>The <em>file</em> backend reads configuration directives from a configuration file,
517 whose default location is determined at installation time as
518 PREFIX/etc/agent.cfg. An alternative location can also be given with
519 <strong>--conf-file</strong> option.</p>
520 <p>The <em>registry</em> backend reads configuration directives from the Windows
521 registry, with an arch-dependant location:</p>
522 <ul>
523 <li><strong><a name="hkey_local_machine_software_fusioninventory_agent_for_32_bits_machines" class="item"><em class="file">HKEY_LOCAL_MACHINE\SOFTWARE\FusionInventory-Agent</em> for 32 bits machines</a></strong>
524
525 </li>
526 <li><strong><a name="hkey_local_machine_software_wow6432node_fusioninventory_agent_for_64_bits_machines" class="item"><em class="file">HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\FusionInventory-Agent</em> for 64 bits machines</a></strong>
527
528 </li>
529 </ul>
530 <p>The <em>none</em> backend doesn't read any configuration directive at all, allowing
531 to isolate the agent execution from any installed configuration.</p>
532
533 </body>
534
535 </html>
1313 'delaytime' => 3600,
1414 'backend-collect-timeout' => 30,
1515 'httpd-port' => 62354,
16 'timeout' => 180,
1617 };
1718
1819 my $deprecated = {
4343 $battery->{DATE} = _parseDate($info->{'Manufacture Date'});
4444 }
4545
46 if ($info->{Capacity} && $info->{Capacity} =~ /(\d+) \s m(W|A)h$/x) {
46 if ($info->{'Design Capacity'} &&
47 $info->{'Design Capacity'} =~ /(\d+) \s m(W|A)h$/x) {
4748 $battery->{CAPACITY} = $1;
4849 }
4950
50 if ($info->{Voltage} && $info->{Voltage} =~ /(\d+) \s mV$/x) {
51 if ($info->{'Design Voltage'} &&
52 $info->{'Design Voltage'} =~ /(\d+) \s mV$/x) {
5153 $battery->{VOLTAGE} = $1;
5254 }
5355
2929
3030
3131 ### mem convert it to meg's if it comes back in gig's
32 my $mem = $sysprofile->{'Memory'};
32 my $mem = $sysprofile->{'Hardware'}{'Hardware Overview'}{'Memory'};
3333 if ($mem =~ /GB$/){
3434 $mem =~ s/\sGB$//;
3535 $mem = ($mem * 1024);
9595
9696 my $cores =
9797 $info->{'Total Number Of Cores'} ? $info->{'Total Number Of Cores'} / $procs :
98 1 ;
98 $info->{'machdep.cpu.core_count'};
99
100 my $threads = $info->{'machdep.cpu.thread_count'};
101
99102
100103 my $manufacturer =
101104 $type =~ /Intel/i ? "Intel" :
107110 CORE => $cores,
108111 MANUFACTURER => $manufacturer,
109112 NAME => $type,
110 THREAD => 1,
113 THREAD => $threads,
111114 FAMILYNUMBER => $family,
112115 MODEL => $model,
113116 STEPPING => $stepping,
118121 push @cpus, $cpu;
119122 }
120123
121 return $cpu;
124 return @cpus;
122125
123126 }
124127
3535 # get additional informations
3636 foreach (`diskutil list`) {
3737 # partition identifiers look like disk0s1
38 next unless /(disk \d+ s \d+)$/;
38 next unless /(disk \d+ s \d+)$/x;
3939 my $id = $1;
4040 my $name = "/dev/$1";
4141
42 my $filesystem = $filesystems{$name};
43 next unless $filesystem;
44
4245 my $device;
4346 foreach (`diskutil info $id`) {
44 next unless /^\s+(.*?):\s*(\S.*)/;
47 next unless /(\S[^:]+) : \s+ (\S.*\S)/x;
4548 $device->{$1} = $2;
4649 }
4750
4851 my $size;
49 if ($device->{'Total Size'} =~ /^(.*) \s \(/x) {
52 if ($device->{'Total Size'} =~ /^([.\d]+ \s \S+)/x) {
5053 $size = getCanonicalSize($1);
5154 }
5255
53 $filesystems{$name}->{TOTAL} = $size;
54 $filesystems{$name}->{SERIAL} = $device->{'Volume UUID'} ||
55 $device->{'UUID'};
56 $filesystems{$name}->{FILESYSTEM} = $device->{'File System'} ||
57 $device->{'Partition Type'};
58 $filesystems{$name}->{LABEL} = $device->{'Volume Name'};
56 $filesystem->{TOTAL} = $size;
57 $filesystem->{SERIAL} = $device->{'Volume UUID'} ||
58 $device->{'UUID'};
59 $filesystem->{FILESYSTEM} = $device->{'File System'} ||
60 $device->{'Partition Type'};
61 $filesystem->{LABEL} = $device->{'Volume Name'};
5962 }
6063
6164 # add filesystems to the inventory
0 package FusionInventory::Agent::Task::Inventory::Input::Virtualization::Lxc;
1
2 # Authors: Egor Shornikov <se@wbr.su>, Egor Morozov <akrus@flygroup.st>
3 # License: GPLv2+
4
5 use strict;
6 use warnings;
7
8 use FusionInventory::Agent::Tools;
9
10 sub isEnabled {
11 return canRun('lxc-ls');
12 }
13
14 sub doInventory {
15 my (%params) = @_;
16
17 my $inventory = $params{inventory};
18 my $logger = $params{inventory};
19
20 my $vms = _getVirtualMachines( command => '/usr/bin/lxc-ls -1', logger => $logger );
21 foreach my $vm ( keys %{$vms}) {
22
23 my $state = _getVirtualMachineState( command => "/usr/bin/lxc-info -n $vm", logger => $logger );
24 my $conf = _getVirtualMachineConfig( file => "/var/lib/lxc/$vm/config", logger => $logger );
25
26 my %entry = ();
27 $entry{'NAME'} = $vm;
28 $entry{'VMTYPE'} = 'LXC';
29 $entry{'VMID'} = $state->{'VMID'};
30 $entry{'STATUS'} = $state->{'STATUS'};
31 $entry{'VCPU'} = $conf->{'VCPU'};
32 $entry{'MEMORY'} = $conf->{'MEMORY'};
33
34 $inventory->addEntry(
35 section => 'VIRTUALMACHINES', entry => \%entry
36 );
37 }
38 }
39
40 sub _getVirtualMachineState {
41 my (%params) = (
42 @_
43 );
44
45 my ( %state, %info );
46
47 my $handle = getFileHandle( %params );
48 return unless $handle;
49 while( <$handle> ){
50 chomp;
51 if( $_ =~ m/^(\S+):\s*(\S+)$/ ){ $info{$1} = $2; }
52 }
53 close $handle;
54
55 $state{'VMID'} = $info{'pid'};
56 if ( $info{'state'} eq 'RUNNING' ){
57 $state{'STATUS'} = lc( $info{'state'} );
58 } elsif ( $info{'state'} eq 'FROZEN' ){
59 $state{'STATUS'} = 'paused';
60 } elsif ( $info{'state'} eq 'STOPPED' ){
61 $state{'STATUS'} = 'off';
62 } else {
63 $state{'STATUS'} = $info{'state'};
64 }
65
66 return \%state;
67 }
68
69 sub _getVirtualMachineConfig {
70 my (%params) = (
71 @_
72 );
73
74 my %conf = ();
75
76 my $handle = getFileHandle( %params );
77 return unless $handle;
78 while( <$handle> ){
79 chomp;
80 s/^\s*//g;
81 s/\s*$//g;
82 s/^#.*//g;
83 if ( $_ =~ m/^(\S+)\s*=\s*(\S+)\s*$/ ){
84 my $key = $1;
85 my $val = $2;
86 if ( $key eq 'lxc.network.hwaddr' ){ $conf{'MAC'} = $val; }
87 if ( $key eq 'lxc.cgroup.memory.limit_in_bytes' ){ $conf{'MEMORY'} = $val; }
88 if ( $key eq 'lxc.cgroup.cpuset.cpus' ){
89 ###eg: lxc.cgroup.cpuset.cpus = 0,3-5,7,2,1
90 my $cpu_num = 0;
91 foreach my $cpu ( split( /,/, $val ) ){
92 if ( $cpu =~ /(\d+)-(\d+)/ ){
93 my @tmp = ($1..$2);
94 $cpu_num += $#tmp + 1;
95 } else {
96 $cpu_num += 1;
97 }
98 }
99 $conf{'VCPU'} = $cpu_num;
100 }
101 }
102 }
103 close $handle;
104
105 return \%conf;
106 }
107
108 sub _getVirtualMachines {
109 my (%params) = (
110 @_
111 );
112
113 my %vms = ();
114
115 my $handle = getFileHandle( %params );
116 return unless $handle;
117
118 while( <$handle> ){
119 chomp;
120 unless ( m/^(\S+)$/ ){ next; }
121 $vms{$1} = 1;
122 }
123 close $handle;
124
125 return \%vms;
126 }
127
128 1;
183183 }
184184 return $result if $result;
185185
186 # OpenVZ
187 if (-f '/proc/self/status') {
188 my $handle = getFileHandle(
189 file => '/proc/self/status',
190 logger => $logger
191 );
192 while (my $line = <$handle>) {
193 my ( $varID, $varValue ) = split( ":", $line );
194 $result = "Virtuozzo" if ( $varID eq 'envID' && $varValue > 0 );
195 }
196 }
197 return $result if $result;
198
186199 return 'Physical';
187200 }
188201
3232 file => $file,
3333 pattern => qr/^N:(\S+)/
3434 );
35 next unless $device;
3536 next unless $device =~ /([hsv]d[a-z]|sr\d+)$/;
3637 push (@devices, _parseUdevEntry(
3738 logger => $params{logger}, file => $file, device => $device
199200 my %seen;
200201 @names = grep { !$seen{$_}++ } @names;
201202
202 # extract informations
203 # extract information
203204 my @devices;
204205 foreach my $name (@names) {
205206 my $device = {
463464
464465 =head2 getInfoFromSmartctl(%params)
465466
466 Returns some informations about a drive, using smartctl.
467 Returns some information about a drive, using smartctl.
467468
468469 Availables parameters:
469470
281281 sub _build_detailed_timing {
282282 my ($pixel_clock, $vv) = @_;
283283
284 my $h = get_many_bits($vv, 'detailed_timing');
284 my $h = _get_many_bits($vv, 'detailed_timing');
285285 $h->{pixel_clock} = $pixel_clock / 100; # to have it in MHz
286286 my %detailed_timing_field_size = map { $_->[1], $_->[0] } @{$subfields{detailed_timing}};
287287 foreach my $field (keys %detailed_timing_field_size) {
300300 '4/3', '5/4', '16/9',
301301 );
302302 $v = [ map {
303 my $h = get_many_bits($_, 'standard_timing');
303 my $h = _get_many_bits($_, 'standard_timing');
304304 $h->{X} = ($h->{X} + 31) * 8;
305305 if ($_ ne "\x20\x20" && $h->{X} > 256) { # cf VALID_TIMING in Xorg edid.h
306306 $h->{vfreq} += 60;
425425 $dtd_offset -= 4;
426426
427427 while ($dtd_offset > 0) {
428 my $h = get_many_bits($v, 'cea_data_block_collection');
428 my $h = _get_many_bits($v, 'cea_data_block_collection');
429429 $dtd_offset -= $h->{size} + 1;
430430
431431 my $vv;
433433 if ($h->{type} == 0x02) { # Video Data Block
434434 my @vmodes = unpack("a" x $h->{size}, $vv);
435435 foreach my $vmode (@vmodes) {
436 $h = get_many_bits($vmode, 'cea_video_data_block');
436 $h = _get_many_bits($vmode, 'cea_video_data_block');
437437 my $cea_mode = $cea_video_modes[$h->{mode} - 1];
438438 if (!$cea_mode) {
439439 warn "parse_edid: unhandled CEA mode $h->{mode}\n" if $verbose;
503503 if ($error < 1 && $in_cm{vertical}) {
504504 # using it for the ratio
505505 $edid{ratio} = $in_cm{horizontal} / $in_cm{vertical};
506 $edid{ratio_name} = ratio_name($in_cm{horizontal}, $in_cm{vertical}, 'mm');
506 $edid{ratio_name} = _ratio_name($in_cm{horizontal}, $in_cm{vertical}, 'mm');
507507 $edid{ratio_precision} = 'mm';
508508 }
509509
532532 $h->{pixel_clock} / $horizontal_total / $vertical_total * 1000 * 1000 * ($h->{interlaced} ? 2 : 1),
533533 $h->{pixel_clock} / $horizontal_total * 1000,
534534 $h->{interlaced} ? "interlaced, " : '',
535 nearest_ratio($h->{horizontal_active} / $h->{vertical_active}, 0.01) || sprintf("%.2f", $h->{horizontal_active} / $h->{vertical_active}),
535 _nearest_ratio($h->{horizontal_active} / $h->{vertical_active}, 0.01) || sprintf("%.2f", $h->{horizontal_active} / $h->{vertical_active}),
536536 $dpi_string ? ", $dpi_string" : '';
537537
538538 $h->{ModeLine} = sprintf qq("%dx%d" $h->{pixel_clock} %d %d %d %d %d %d %d %d %shsync %svsync%s),
1717 qw/KEY_READ/
1818 );
1919
20 use File::Temp ();
21 use File::Temp qw(:seekable);
20 use File::Temp qw(:seekable tempfile);
2221 use Win32::Job;
22
23 use Cwd;
2324
2425 Win32::OLE->Option(CP => Win32::OLE::CP_UTF8);
2526
165166 my $buff = File::Temp->new();
166167 my $void = File::Temp->new();
167168
169 my $winCwd = Cwd::getcwd();
170 $winCwd =~ s{/}{\\}g;
171
172 my ($fh, $filename) = File::Temp::tempfile( "$ENV{TEMP}\\fusinvXXXXXXXXXXX", SUFFIX => '.bat');
173 print $fh "cd \"".$winCwd."\"\r\n";
174 print $fh $params{command}."\r\n";
175 print $fh "exit %ERRORLEVEL%\r\n";
176 close $fh;
177
168178 my $args = {
169179 stdout => $buff,
170180 stderr => $params{no_stderr} ? $void : $buff,
172182 };
173183
174184 $job->spawn(
175 "$ENV{SYSTEMROOT}/system32/cmd.exe",
176 "cmd.exe /c $params{command}",
185 "$ENV{SYSTEMROOT}\\system32\\cmd.exe",
186 "start /wait cmd /c $filename",
177187 $args
178188 );
179189
180190 $job->run($params{timeout});
191 unlink($filename);
181192
182193 $buff->seek(0, SEEK_SET);
183194
126126
127127 return 400 if $speed =~ /^PC3200U/;
128128
129 return undef unless $speed =~ /^([\,\.\d]+) \s? (\S+)$/x;
129 return undef unless $speed =~ /^([,.\d]+) \s? (\S+)$/x;
130130 my $value = $1;
131131 my $unit = lc($2);
132132
145145
146146 return $size if $size =~ /^\d+$/;
147147
148 return undef unless $size =~ /^(\d+) \s (\S+)$/x;
148 return undef unless $size =~ /^([,.\d]+) \s? (\S+)$/x;
149149 my $value = $1;
150150 my $unit = lc($2);
151151
2121 use FusionInventory::Agent::Tools::Hostname;
2222 use FusionInventory::Agent::XML::Query::Prolog;
2323
24 our $VERSION = '2.2.1';
24 our $VERSION = '2.2.3';
2525 our $VERSION_STRING =
2626 "FusionInventory unified agent for UNIX, Linux and MacOSX ($VERSION)";
2727 our $AGENT_STRING =
217217 if ($target->isa('FusionInventory::Agent::Target::Server')) {
218218 my $client = FusionInventory::Agent::HTTP::Client::OCS->new(
219219 logger => $self->{logger},
220 timeout => $self->{timeout},
220221 user => $self->{config}->{user},
221222 password => $self->{config}->{password},
222223 proxy => $self->{config}->{proxy},
0 lxc.utsname = name1
1 lxc.network.type = veth
2 lxc.network.flags = up
3 lxc.network.link = br0
4 lxc.network.ipv4 = 0.0.0.0
5 lxc.network.hwaddr = 01:23:45:67:89:0A
6
7 lxc.cgroup.memory.limit_in_bytes = 2048000
8 lxc.cgroup.cpuset.cpus = 0,3-5
9
10 lxc.tty = 4
11 lxc.pts = 1024
12 lxc.rootfs = /var/lib/lxc/name1/rootfs
13 lxc.mount = /var/lib/lxc/name1/fstab
14 lxc.arch =
15
16 lxc.cgroup.devices.deny = a
17 # /dev/null and zero
18 lxc.cgroup.devices.allow = c 1:3 rwm
19 lxc.cgroup.devices.allow = c 1:5 rwm
20 # consoles
21 lxc.cgroup.devices.allow = c 5:1 rwm
22 lxc.cgroup.devices.allow = c 5:0 rwm
23 #lxc.cgroup.devices.allow = c 4:0 rwm
24 #lxc.cgroup.devices.allow = c 4:1 rwm
25 # /dev/{,u}random
26 lxc.cgroup.devices.allow = c 1:9 rwm
27 lxc.cgroup.devices.allow = c 1:8 rwm
28 lxc.cgroup.devices.allow = c 136:* rwm
29 lxc.cgroup.devices.allow = c 5:2 rwm
30 # rtc
31 lxc.cgroup.devices.allow = c 254:0 rwm
32 #fuse
33 lxc.cgroup.devices.allow = c 10:229 rwm
0 name1
1 name2
2 name3
3 name1
4 name2
5 name3
99
1010 use FusionInventory::Agent::Tools;
1111
12 use Test::More tests => 42;
12 use Test::More tests => 27;
1313
1414 my ($out, $err, $rc);
1515
4444 my $base_options = "--stdout --debug --no-task ocsdeploy,wakeonlan,snmpquery,netdiscovery";
4545
4646 my $content;
47
4748 # first inventory
4849 ($out, $err, $rc) = run_agent(
4950 "$base_options --no-category printer"
5051 );
51 ok($rc == 0, 'exit status');
52
53 unlike(
54 $err,
55 qr/module \S+ disabled: failure to load/,
56 'no broken module'
57 );
58
59 like(
60 $out,
61 qr/^<\?xml version="1.0" encoding="UTF-8" \?>/,
62 'output has correct encoding'
63 );
64
65 $content = XML::TreePP->new()->parse($out);
66 ok($content, 'output is valid XML');
52
53 subtest "first inventory" => sub {
54 check_execution_ok($out, $err, $rc);
55 };
6756
6857 ok(
6958 exists $content->{REQUEST}->{CONTENT}->{SOFTWARES},
7968 ($out, $err, $rc) = run_agent(
8069 "$base_options --no-category printer,software"
8170 );
82 ok($rc == 0, 'exit status');
83
84 unlike(
85 $err,
86 qr/module \S+ disabled: failure to load/,
87 'no broken module'
88 );
89
90 like(
91 $out,
92 qr/^<\?xml version="1.0" encoding="UTF-8" \?>/,
93 'output has correct encoding'
94 );
95
96 $content = XML::TreePP->new()->parse($out);
97 ok($content, 'output is valid XML');
71
72 subtest "first inventory" => sub {
73 check_execution_ok($out, $err, $rc);
74 };
9875
9976 ok(
10077 !exists $content->{REQUEST}->{CONTENT}->{SOFTWARES},
12198 </REQUEST>
12299 EOF
123100 close($file);
101
124102 ($out, $err, $rc) = run_agent(
125103 "$base_options --no-category printer,software --additional-content $file"
126104 );
127 ok($rc == 0, 'exit status');
128
129 unlike(
130 $err,
131 qr/module \S+ disabled: failure to load/,
132 'no broken module'
133 );
134
135 like(
136 $out,
137 qr/^<\?xml version="1.0" encoding="UTF-8" \?>/,
138 'output has correct encoding'
139 );
140
141 $content = XML::TreePP->new()->parse($out);
142 ok($content, 'output is valid XML');
105 subtest "first inventory" => sub {
106 check_execution_ok($out, $err, $rc);
107 };
143108
144109 ok(
145110 exists $content->{REQUEST}->{CONTENT}->{SOFTWARES},
170135 ($out, $err, $rc) = run_agent(
171136 "$base_options --no-category printer,software"
172137 );
173 ok($rc == 0, 'exit status');
174
175 unlike(
176 $err,
177 qr/module \S+ disabled: failure to load/,
178 'no broken module'
179 );
180
181 like(
182 $out,
183 qr/^<\?xml version="1.0" encoding="UTF-8" \?>/,
184 'output has correct encoding'
185 );
186
187 $content = XML::TreePP->new()->parse($out);
188 ok($content, 'output is valid XML');
138
139 subtest "first inventory" => sub {
140 check_execution_ok($out, $err, $rc);
141 };
189142
190143 ok(
191144 !exists $content->{REQUEST}->{CONTENT}->{SOFTWARES},
208161 ($out, $err, $rc) = run_agent(
209162 "$base_options --no-category printer,software,environment"
210163 );
211 ok($rc == 0, 'exit status');
212
213 unlike(
214 $err,
215 qr/module \S+ disabled: failure to load/,
216 'no broken module'
217 );
218
219 like(
220 $out,
221 qr/^<\?xml version="1.0" encoding="UTF-8" \?>/,
222 'output has correct encoding'
223 );
224
225 $content = XML::TreePP->new()->parse($out);
226 ok($content, 'output is valid XML');
164
165 subtest "first inventory" => sub {
166 check_execution_ok($out, $err, $rc);
167 };
227168
228169 ok(
229170 !exists $content->{REQUEST}->{CONTENT}->{SOFTWARES},
244185 );
245186 return ($out, $err, $CHILD_ERROR >> 8);
246187 }
188
189 sub check_execution_ok {
190 my ($client, $url) = @_;
191
192 ok($rc == 0, 'exit status');
193
194 unlike(
195 $err,
196 qr/module \S+ disabled: failure to load/,
197 'no broken module (loading)'
198 );
199
200 unlike(
201 $err,
202 qr/unexpected error in \S+/,
203 'no broken module (execution)'
204 );
205
206 like(
207 $out,
208 qr/^<\?xml version="1.0" encoding="UTF-8" \?>/,
209 'output has correct encoding'
210 );
211
212 $content = XML::TreePP->new()->parse($out);
213 ok($content, 'output is valid XML');
214 }
1212 NAME => 'EV06047',
1313 SERIAL => undef,
1414 MANUFACTURER => 'LGC-LGC',
15 CHEMISTRY => 'Lithium Ion'
15 CHEMISTRY => 'Lithium Ion',
16 VOLTAGE => 10800,
17 CAPACITY => 4400
1618 },
1719 'linux-2.6' => {
1820 NAME => 'DELL C129563',
1921 MANUFACTURER => 'Samsung SDI',
2022 SERIAL => undef,
21 CHEMISTRY => undef
23 CHEMISTRY => undef,
24 VOLTAGE => 11100,
25 CAPACITY => 48000
2226 },
2327 'openbsd-3.7' => undef,
2428 'openbsd-3.8' => undef,
3135 SERIAL => '2000417915',
3236 DATE => '09/19/2002',
3337 MANUFACTURER => 'TOSHIBA',
34 CHEMISTRY => 'Lithium Ion'
38 CHEMISTRY => 'Lithium Ion',
39 VOLTAGE => 10800,
40 CAPACITY => 0
3541 },
3642 'windows-hyperV' => undef
3743 );
1212 CORE => '2',
1313 MANUFACTURER => 'Intel',
1414 NAME => 'Intel Core 2 Duo',
15 THREAD => 1,
15 THREAD => 2,
1616 FAMILYNUMBER => '6',
1717 MODEL => '23',
1818 STEPPING => '10',
0 #!/usr/bin/perl
1
2 use strict;
3 use warnings;
4
5 use Test::More;
6
7 use FusionInventory::Agent::Task::Inventory::Input::Virtualization::Lxc;
8
9 my $result_lxc_ls = {
10 name2 => 1,
11 name1 => 1,
12 name3 => 1
13 };
14 my $result_lxc_info = {
15 STATUS => 'running',
16 VMID => '13018'
17 };
18
19 my $result_config = {
20 MEMORY => '2048000',
21 MAC => '01:23:45:67:89:0A',
22 VCPU => 4
23 };
24
25
26 plan tests => 3;
27
28 my $vms = FusionInventory::Agent::Task::Inventory::Input::Virtualization::Lxc::_getVirtualMachines(file => 'resources/virtualization/lxc/lxc-ls_-1');
29 is_deeply($vms, $result_lxc_ls, "lxc-ls -1");
30
31 my $state = FusionInventory::Agent::Task::Inventory::Input::Virtualization::Lxc::_getVirtualMachineState(file => 'resources/virtualization/lxc/lxc-info_-n_name1');
32 is_deeply($state, $result_lxc_info, "lxc-info -n name1 -1");
33
34 my $config = FusionInventory::Agent::Task::Inventory::Input::Virtualization::Lxc::_getVirtualMachineConfig(file => 'resources/virtualization/lxc/config');
35 is_deeply($config, $result_config, "parsing lxc config sample");
1313 );
1414
1515 my @size_tests_ok = (
16 [ '1', 1 ],
17 [ '1 mb', 1 ],
18 [ '1 MB', 1 ],
19 [ '1 gb', 1000 ],
20 [ '1 GB', 1000 ],
21 [ '1 tb', 1000000 ],
22 [ '1 TB', 1000000 ],
16 [ '1' , 1 ],
17 [ '1 mb' , 1 ],
18 [ '1.1 mb', 1.1 ],
19 [ '1 MB' , 1 ],
20 [ '1 gb' , 1000 ],
21 [ '1 GB' , 1000 ],
22 [ '1 tb' , 1000000 ],
23 [ '1 TB' , 1000000 ],
2324 );
2425
2526 my @speed_tests_nok = (