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

When managing graphs, Graphs can be listed multiple times incorrectly #4996

Closed
Coporton opened this issue Nov 9, 2022 · 25 comments
Closed
Labels
bug Undesired behaviour confirmed Bug is confirm by dev team templates Issues related to templating

Comments

@Coporton
Copy link

Coporton commented Nov 9, 2022

Describe the bug

I don't know why but I checked several times. The result is still the same. Graph Name in Graph Management shows the same name multiple times.

To Reproduce

Steps to reproduce the behavior:

  1. Go to 'Console'
  2. Click on 'Management'
  3. Click on 'Graphs'
  4. See the Graph Name

Expected behavior

It's showing the same name multiple times with the same URL.

Screenshots

Cacti Error

If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information)

  • OS: [e.g. iOS]

  • Browser [e.g. chrome, safari]
    chrome

  • Version [e.g. 22]
    1.2.23

@Coporton Coporton added bug Undesired behaviour unverified Some days we don't have a clue labels Nov 9, 2022
@TheWitness
Copy link
Member

Appreciate you reporting this one.

@TheWitness
Copy link
Member

TheWitness commented Nov 9, 2022

Please run this query and let me know if you get duplicates:

SELECT gtg.id, gl.id AS local_graph_id,
        gtg.height, gtg.width, gtg.title_cache, gt.name, gl.host_id,
        IF(gl.graph_template_id = 0, 0, IF(gl.snmp_query_id = 0, 2, 1)) AS graph_source
        FROM graph_local AS gl
        INNER JOIN graph_templates_graph AS gtg
        ON gl.id=gtg.local_graph_id
        LEFT JOIN graph_templates AS gt
        ON gl.graph_template_id=gt.id
        LEFT JOIN aggregate_graphs AS ag
        ON ag.local_graph_id=gl.id
        LEFT JOIN host AS h
        ON h.id=gl.host_id
        LEFT JOIN sites AS s
        ON h.site_id=s.id
       ORDER BY gl.id
       LIMIT 20 ;

@TheWitness
Copy link
Member

Lastly, on line 2222 of graphs.php, take the query for the variable $graph_list and put it inside of a cacti_log() function call. After that, render the page once, and then goto the cacti.log and post what the query you find there. Just to be clear:

$graph_list = db_fetch_assoc("blah");

cacti_log("blah");

@Coporton
Copy link
Author

Coporton commented Nov 9, 2022

Thanks, @TheWitness. I ran the query and got zero duplicates but I don't understand your second instruction. Actually, I'm not that smart... :(

Copy link
Member

Well for me this is philanthropic work. so if you want free support you're going to have to meet me halfway. I'll patiently await you to provide the response I requested.

@Coporton
Copy link
Author

Coporton commented Nov 9, 2022

I understand the situation, my friend. Anyways, After doing some research, I may able to understand what you wanted to say. The query works. Now I can see the single result on GUI, however only 20 rows according to the statement.

In the cacti log, I found no error. Please have a look.
1

@bmfmancini
Copy link
Member

Do you have any plugins installed ?

@bmfmancini
Copy link
Member

Also run /cacti/cli/audit_database --report

@Coporton
Copy link
Author

Coporton commented Nov 9, 2022

Hi, @bmfmancini, no I don't have any installed plugins. Actually, I am just trying to follow the instruction that @TheWitness told me to do.

@bmfmancini
Copy link
Member

Hmm I am not able to replicate on 1.2.23

image

@bmfmancini
Copy link
Member

@Coporton run audit_database --report and check for any errors/warnings

@TheWitness
Copy link
Member

Copy Paste the text of that log message. Here. Then I'll have a follow-up query for you to run.

@Coporton
Copy link
Author

Coporton commented Nov 9, 2022

@TheWitness, here is the log message report

2022-11-09 21:00:27 - CMDPHP SELECT gtg.id, gl.id AS local_graph_id, gtg.height, gtg.width, gtg.title_cache, gt.name, gl.host_id, IF(gl.graph_template_id = 0, 0, IF(gl.snmp_query_id = 0, 2, 1)) AS graph_source FROM graph_local AS gl INNER JOIN graph_templates_graph AS gtg ON gl.id=gtg.local_graph_id LEFT JOIN graph_templates AS gt ON gl.graph_template_id=gt.id LEFT JOIN aggregate_graphs AS ag ON ag.local_graph_id=gl.id LEFT JOIN host AS h ON h.id=gl.host_id LEFT JOIN sites AS s ON h.site_id=s.id ORDER BY gl.id LIMIT 20;

@TheWitness
Copy link
Member

No, I mean the one in cacti, not the one I asked you to run.

@Coporton
Copy link
Author

Coporton commented Nov 9, 2022

@TheWitness Forgive me, if I input wrong. I have added, As you told me,

.......
After 2222 line...

` $graph_list = db_fetch_assoc("SELECT gtg.id, gl.id AS local_graph_id,
gtg.height, gtg.width, gtg.title_cache, gt.name, gl.host_id,
IF(gl.graph_template_id = 0, 0, IF(gl.snmp_query_id = 0, 2, 1)) AS graph_source
FROM graph_local AS gl
INNER JOIN graph_templates_graph AS gtg
ON gl.id=gtg.local_graph_id
LEFT JOIN graph_templates AS gt
ON gl.graph_template_id=gt.id
LEFT JOIN aggregate_graphs AS ag
ON ag.local_graph_id=gl.id
LEFT JOIN host AS h
ON h.id=gl.host_id
LEFT JOIN sites AS s
ON h.site_id=s.id
ORDER BY gl.id
LIMIT 20 ;");

cacti_log(" $graph_list = db_fetch_assoc("SELECT gtg.id, gl.id AS local_graph_id,
gtg.height, gtg.width, gtg.title_cache, gt.name, gl.host_id,
IF(gl.graph_template_id = 0, 0, IF(gl.snmp_query_id = 0, 2, 1)) AS graph_source
FROM graph_local AS gl
INNER JOIN graph_templates_graph AS gtg
ON gl.id=gtg.local_graph_id
LEFT JOIN graph_templates AS gt
ON gl.graph_template_id=gt.id
LEFT JOIN aggregate_graphs AS ag
ON ag.local_graph_id=gl.id
LEFT JOIN host AS h
ON h.id=gl.host_id
LEFT JOIN sites AS s
ON h.site_id=s.id
ORDER BY gl.id
LIMIT 20 ;");");`

..........
And I got the same output in the cacti log.

@TheWitness
Copy link
Member

Still wrong. You might want to restore that file. Let's take another approach

  1. do you have any plugins installed. If so, what are they?
  2. is this a new install or an upgrade? If an upgrade, what was the original version at it's inception?

@Coporton
Copy link
Author

Coporton commented Nov 9, 2022

I have already restore the original file. it's showing same name in multiple times like before.

  1. No, I didn't install any extra plugins.
  2. This is new install. Version 1.2.23

I followed the GitHub install instructions

@TheWitness
Copy link
Member

What interface graphs did you create for each of these interfaces?

@Coporton
Copy link
Author

I'm using Interface - Traffic (bits/sec) template for all the graph name created.

@Coporton
Copy link
Author

Hi @TheWitness, I just replaced the $graph_list statement with your given statement from line no. 2200 in cacti/graphs.php, which works as I wanted. Now data retrieve single entries as it should.

$graph_list = db_fetch_assoc("SELECT gtg.id, gl.id AS local_graph_id,
	gtg.height, gtg.width, gtg.title_cache, gt.name, gl.host_id,
	IF(gl.graph_template_id = 0, 0, IF(gl.snmp_query_id = 0, 2, 1)) AS graph_source,
	IF(gl.snmp_query_id > 0, sqg.name, gt.name) AS source_name
	FROM graph_local AS gl
	INNER JOIN graph_templates_graph AS gtg
	ON gl.id=gtg.local_graph_id
	LEFT JOIN graph_templates AS gt
	ON gl.graph_template_id=gt.id
	LEFT JOIN aggregate_graphs AS ag
	ON ag.local_graph_id=gl.id
	LEFT JOIN host AS h
	ON h.id=gl.host_id
	LEFT JOIN sites AS s
	ON h.site_id=s.id
	LEFT JOIN snmp_query_graph AS sqg
	ON gl.snmp_query_id = sqg.snmp_query_id
	AND gl.graph_template_id = sqg.graph_template_id
	$orphan_join
	$sql_where
	$sql_order
	$sql_limit");

Thank you so much, everyone. Thanks for your valuable support & I appreciate it.

@TheWitness
Copy link
Member

Just reproduced it 👍

@TheWitness
Copy link
Member

Okay, this looks like a regression with regards to a few Graph Templates that were recently packaged. I have to research the source package. I'll get you a Delete Statement shortly.

@TheWitness
Copy link
Member

Is this an upgrade? Did you by chance import the CISCO ASA Template?

TheWitness added a commit that referenced this issue Nov 12, 2022
Graph Name in Graph Management shows the same name multiple times
@TheWitness
Copy link
Member

This is partially resolved. We have to determine what do to in these cases though.

@TheWitness TheWitness added confirmed Bug is confirm by dev team templates Issues related to templating and removed unverified Some days we don't have a clue labels Nov 12, 2022
TheWitness added a commit that referenced this issue Nov 12, 2022
This method is more accurate than the prior method
@TheWitness
Copy link
Member

This is resolved now.

@netniV netniV changed the title Graph Name in Graph Management shows the same name multiple times. When managing graphs, Graphs can be listed multiple times incorrectly Dec 31, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour confirmed Bug is confirm by dev team templates Issues related to templating
Projects
None yet
Development

No branches or pull requests

3 participants