Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rules based on CIDR doesn't work #18614

Open
2 tasks done
nanoupi42 opened this issue Dec 27, 2024 · 12 comments
Open
2 tasks done

Rules based on CIDR doesn't work #18614

nanoupi42 opened this issue Dec 27, 2024 · 12 comments

Comments

@nanoupi42
Copy link

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Version

10.11.4

Bug description

Hi,
I have a weird problem on GLPI
I have a lot of CIDR rules and it's doesn't work as expected, it's working for little portion of computer only, but it's not working on the other :

Image

The IP Address of the computer is 172.23.44.118 but when I launch the inventory the entity is set by default each time !
I have tried to manually transfer the computer to the right entity, it's working, but when I relaunch the inventory it's revert to the default.

I have tried to edit the rules to adjust but It's not working.
The test is working fine when I enter the 172.23.44.118 IP :
Image

I have set the transfer model in the destination entity (complete)

I don't understand why it's not working on some computer.
I have the sensation that the issue is related to CIDR /22 or /20
I believe that I have no issue on /24 CIDR for example.
I have tried to change the CIDR on /24 to test 172.23.44.0/24 but it's not working each time... Sometimes it's work sometimes no...

Relevant log output

Page URL

No response

Steps To reproduce

  1. create CIDR rules to affect entity to computer (with /20 or /22 range)
  2. Launch an inventory
  3. The destination entity is not set after inventory

Your GLPI setup information

No response

Anything else?

No response

@nanoupi42
Copy link
Author

Hi,
I have tried to edit my rules but same problem ...
I really don't understand because sometimes the rules is applied perfectly, but most of time it's simply ignored and the entity is the default one...

Anyone have an idea ? :-(

@stonebuzz
Copy link
Contributor

Hi @nanoupi42,

Could you please provide the related inventory file for testing, along with an export of your rules?

Best regards,

@nanoupi42
Copy link
Author

Hi @stonebuzz
Thanks for your reply
It's possible to share the inventory and rules in private to avoid to publish publicly ?
Thanks :)

@trasher
Copy link
Contributor

trasher commented Jan 31, 2025

Community support is done here on github, there is no private way to share anything as far as I know.
You can just remove sensitive data before sharing your files.

@nanoupi42
Copy link
Author

Hi @stonebuzz and @trasher
Thanks for your reply, I understand :)
Please see the attached JSON and the screenshot of the rule :

  • The Rule is the first One
  • The rule contains a lot of CIDR, at the beggining I was thinking that maybe, there is too much CIDR, so I have tried to create a rules at the top with only my CIDR 172.24.0.0/23 but same behaviour
  • It's very weird because sometimes the entity is applied correctly :
    When it's OK :
    30314506 2025-02-05 14:37 inventory Entité. => Changement de XXX (0) à XXX > VEN (1)

Some minutes after I relaunch inventory it's revert to the default :
30320706 2025-02-05 14:41 inventory Entité Changement de XXX > VEN (1) à XX Default Entity (0)

  • The problem occurs on every assets with all CIDR (sometimes working, sometimes no...)

Thanks for you help

Debug.json
Image

@nanoupi42
Copy link
Author

nanoupi42 commented Feb 5, 2025

Hi,
I have noticed a really interesting thing!
The problem occurs only on Windows Assets or Mac OS !
it's works fine for Debian assets...

@stonebuzz
Copy link
Contributor

Can you upload here the corresponding inventory file when it works and when it doesn't (and delete the sensitive data)?

Without this we cannot reproduce on our side

@nanoupi42
Copy link
Author

nanoupi42 commented Feb 5, 2025

Hi @stonebuzz
I attach the JSON when it's working
I notice that on this JSON the IP address is appearing, on the first one we doesn't have the IP of the asset... :-O

And on this JSON I have the full info about the network :
"networks": [
{
"description": "vmxnet3 Ethernet Adapter",
"ipaddress": "172.24.0.2",
"ipgateway": "172.24.1.254",
"ipmask": "255.255.254.0",
"ipsubnet": "172.24.0.0",
[...]

Working.json

I don't know why sometimes it's doesn't pull this information ? I think my issue is related to this behaviour...

@stonebuzz
Copy link
Contributor

So issue is more related to agent which in some cases returns IPs and in others does not.

@g-bougard postpone faeture could be the cause ?

@g-bougard
Copy link
Member

I would better say we missed a point when we implemented full-inventory-postpone feature:

  • as some rules may require to know a data, in the case of a partial inventory, if the data is not in the inventory, we have to use the one in database. Data not in a partial inventory means it has not been changed since the last inventory.

@nanoupi42 You can disable the feature agent-side by setting full-inventory-postpone=0 in agent configuration. This should be a work-around until we enhance the rule support in case of partial inventory.

@nanoupi42
Copy link
Author

Thanks a lot @g-bougard and @stonebuzz I have edit the full-inventory-postpone in regedit on Windows as workaround
On Mac OS, can I just add full-inventory-postpone=0 on the /Applications/GLPI-Agent/etc/conf.d/glpi.cfg as workaround or it has to be somewhere else ?

@g-bougard
Copy link
Member

Thanks a lot @g-bougard and @stonebuzz I have edit the full-inventory-postpone in regedit on Windows as workaround On Mac OS, can I just add full-inventory-postpone=0 on the /Applications/GLPI-Agent/etc/conf.d/glpi.cfg as workaround or it has to be somewhere else ?

You can add it there or in another .cfg file into the same folder. Of course, don't forget to restart the service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants