~ K    A     L    I ~
UNAME : Linux web65.extendcp.co.uk 4.18.0-553.56.1.el8_10.x86_64 #1 SMP Tue Jun 10 05:00:59 EDT 2025 x86_64
SERVER IP : 10.0.187.65 -________- CLIENT IP : 216.73.216.230
PATH :/usr/bin/
UP FILE :
MINI SHELL D ZAB '
Current File : //usr/bin/glpi-inventory
#!/usr/bin/perl

use strict;
use warnings;

use lib "/usr/share/glpi-agent/lib";
use setup;

use English qw(-no_match_vars);
use Getopt::Long;
use File::Temp;
use Pod::Usage;

use GLPI::Agent::Task::Inventory;
use GLPI::Agent::Target::Local;
use GLPI::Agent::Logger;
use GLPI::Agent::Config;
use GLPI::Agent::Event;
use GLPI::Agent::Version;

my $options = {
    debug  => 0,
    config => 'none'
};

GetOptions(
    $options,
    'assetname-support=i',
    'additional-content=s',
    'backend-collect-timeout=s',
    'credentials=s@',
    'html',
    'json',
    'no-category=s',
    'partial=s',
    'scan-homedirs',
    'scan-profiles',
    'tag|t=s',
    'verbose',
    'debug+',
    'help',
    'version',
) or pod2usage(-verbose => 0);

if ($options->{version}) {
    my $PROVIDER = $GLPI::Agent::Version::PROVIDER;
    map { print $_."\n" }
        "$PROVIDER Inventory task $GLPI::Agent::Task::Inventory::VERSION",
        "based on $PROVIDER Agent v$GLPI::Agent::Version::VERSION",
        @{$GLPI::Agent::Version::COMMENTS}
        ;
    exit 0;
}
pod2usage(-verbose => 0, -exitval => 0) if $options->{help};

my $event;
if ($options->{partial}) {
    $event = GLPI::Agent::Event->new(
        task        => "inventory",
        partial     => 1,
        category    => $options->{partial},
        name        => "partial inventory",
    );
}

my $config = GLPI::Agent::Config->new(
    options => $options,
);

my $inventory = GLPI::Agent::Task::Inventory->new(
    target => GLPI::Agent::Target::Local->new(
        path       => '-',
        html       => $options->{html},
        json       => $options->{json},
        basevardir => File::Temp->newdir(CLEANUP => 1),
    ),
    logger  => GLPI::Agent::Logger->new(config => $config),
    datadir => $setup{datadir},
    event   => $event,
    config  => $config
);

$inventory->{credentials} = $options->{credentials}
    if $options->{credentials};

$inventory->{nochecksum} = 1;

$inventory->run();

__END__

=head1 NAME

glpi-inventory - Standalone inventory

=head1 SYNOPSIS

glpi-inventory [options]

  Options:
    --scan-homedirs                scan use home directories (false)
    --scan-profiles                scan user profiles (false)
    --html                         save the inventory as HTML (false)
    --json                         save the inventory as JSON (false)
    --no-category=CATEGORY         do not list given category items
    --partial=CATEGORY             make a partial inventory of given category
                                     items, this option implies --json
    --credentials                  set credentials to support database inventory
    -t --tag=TAG                   mark the machine with given tag
    --backend-collect-timeout=TIME timeout for inventory modules
                                     execution (30)
    --additional-content=FILE      additional inventory content file
    --assetname-support=1|2        [unix/linux only] set the asset name depending on the given value:
                                    - 1 (the default), the short hostname is used as asset name
                                    - 2, the as-is hostname (can be fqdn) is used as asset name
                                   this feature is not supported on MacOS or Windows
    --verbose                      verbose output (control messages)
    --debug                        debug output (execution traces)
    -h --help                      print this message and exit
    --version                      print the task version and exit

=head1 DESCRIPTION

F<glpi-inventory> can be used to run an inventory task without a GLPI
server.
Coded by KALI :v Greetz to DR HARD ../ kali.zbi@hotmail.com