cacti icon indicating copy to clipboard operation
cacti copied to clipboard

Filtering for hostname in the graph rules matching objects search field shows less objects than expected

Open bernisys opened this issue 4 years ago • 2 comments

Describe the bug

To test a graph rule, we want to reduce the output of the matching objects returned by the graph rule to one device with a specific IP address. Depending on the string we put into the object search filter, the number of returned objects does not always match the filter criterium. Specially IP address filtering returns less lines than expected. There are more objects that would match the search filter.

Not sure if the issue is reproducible on your side, maybe this description helps:

Filtering for anything that does not match the device's hostname returns the proper number of rows, of course including also the matches from other devices. As soon as the string matches part of the hostname, the result is a bit unpredictable, but usually returns less matches than the filter would need to catch.

The example device we use has 19 interfaces, 12 with a string "VLAN" inside the description, 7 ending with "c0".

The boring part:

  • Without an object search filter, the device shows 19 matching interfaces for that device, which is correct.
  • Entering "VLAN" in the search field to match the interface description shows 12 entries for that device, which is correct.
  • Entering "c0" to match part of the interface name shows 7 objects, which is correct.
  • But all those searches list other devices' interfaces as well.

The interesting part:

  • Entering the last 2 octets of the device's IP address, the filter only shows one line with the 1st interface that matches the object criteria.
  • Entering the last octet only, shows 2 matches - the 1st one and the second one.
    • For the 1st one, the filter matches the hostname and the ipAddress field coming from SNMP.
    • The second result matches only the hostname field and is actually the 4th interface that appears in the list without the search filter ...
  • Searching for the 2nd octet, the search returns 4 lines for that host (plus several from the other hosts matching the 2nd octet).

But in all cases it should return all 19 interfaces as all of them would match the hostname.

I cannot really see a pattern, which interfaces are returned by the search.

Steps to reproduce the behavior:

  • Go to the graph creation criteria
  • create a filter for a device type and add some criteria to select specific interfaces
  • activate the "show matching objects"
  • count the objects returned for one specific device you pick
  • in the search field enter the device name (or IP addres, which ever you use for your devices)
  • check the returned objects count - it's less than the number noted down without the filter

Expected behavior

All interfaces should be shown when filtering only for the hostname

Back end

  • OS: RHEL 7.8
  • PHP: 4.5.16
  • Apache 2.4.6
  • MariaDB 5.5.65

Desktop (please complete the following information)

  • Browsers tested: Firefox, Edge, Chrome

bernisys avatar May 20 '21 16:05 bernisys

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jul 20 '21 00:07 github-actions[bot]

Marking this as an enhancement so it does not get closed by the GitFlow again.

TheWitness avatar Sep 25 '21 20:09 TheWitness