diff --git a/lib/GLPI/Agent/Inventory.pm b/lib/GLPI/Agent/Inventory.pm index 29017d7b5..ac33b4c4b 100644 --- a/lib/GLPI/Agent/Inventory.pm +++ b/lib/GLPI/Agent/Inventory.pm @@ -778,12 +778,17 @@ sub save { my $xml = GLPI::Agent::XML->new(); + my %request_params = (REQUEST => { + CONTENT => $self->getContent(), + DEVICEID => $self->getDeviceId(), + QUERY => "INVENTORY", + }); + my $config = $self->{config} || GLPI::Agent::Config->new(); + $request_params{REQUEST}{TAG} = $config->{tag} + if defined($config->{tag}) && length($config->{tag}); + print $handle $xml->write({ - REQUEST => { - CONTENT => $self->getContent(), - DEVICEID => $self->getDeviceId(), - QUERY => "INVENTORY", - } + %request_params }); } elsif ($format eq 'html') { diff --git a/lib/GLPI/Agent/Task/NetDiscovery.pm b/lib/GLPI/Agent/Task/NetDiscovery.pm index 135b96be4..29e5c9295 100644 --- a/lib/GLPI/Agent/Task/NetDiscovery.pm +++ b/lib/GLPI/Agent/Task/NetDiscovery.pm @@ -619,11 +619,17 @@ sub _sendMessage { # Load GLPI::Agent::XML::Query as late as possible return unless GLPI::Agent::XML::Query->require(); - my $message = GLPI::Agent::XML::Query->new( + my %message_params = ( deviceid => $self->{deviceid} || 'foo', query => 'NETDISCOVERY', content => $content ); + $message_params{tag} = $self->{config}->{'tag'} + if defined($self->{config}->{tag}) && length($self->{config}->{tag}); + + my $message = GLPI::Agent::XML::Query->new( + %message_params + ); if ($self->{target}->isType('local')) { my ($handle, $file, $ip); diff --git a/lib/GLPI/Agent/Task/NetInventory.pm b/lib/GLPI/Agent/Task/NetInventory.pm index 9c9199180..b3e04ae90 100644 --- a/lib/GLPI/Agent/Task/NetInventory.pm +++ b/lib/GLPI/Agent/Task/NetInventory.pm @@ -348,11 +348,17 @@ sub _sendMessage { # Load GLPI::Agent::XML::Query as late as possible return unless GLPI::Agent::XML::Query->require(); - my $message = GLPI::Agent::XML::Query->new( + my %message_params = ( deviceid => $self->{deviceid} || 'foo', query => 'SNMPQUERY', content => $content ); + $message_params{tag} = $self->{config}->{'tag'} + if defined($self->{config}->{tag}) && length($self->{config}->{tag}); + + my $message = GLPI::Agent::XML::Query->new( + %message_params + ); if ($self->{target}->isType('local')) { my ($handle, $file);