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

Cacti allows the removal of Data Query Graph Template associations when they are in use #521

Closed
DavidLiedke opened this issue Apr 5, 2017 · 20 comments

Comments

@DavidLiedke
Copy link
Contributor

DavidLiedke commented Apr 5, 2017

I use Cacti 1.1.2

Console --> Management --> Graphs --> List of Graphs.

unbenannt

I get wrong Templates for the graphs.

If i select one of these graphes. I get no value for the graph template:

unbenannt2

@cigamit
Copy link
Member

cigamit commented Apr 6, 2017

Does it appear that way when you unlock the graph? If it's still reporting a non-templated value, please check the clog for errrors if you dont find any, then do the following:

  1. Note the local graph id.
  2. SELECT * FROM graph_local WHERE id = "yourgraphid"
  3. SELECT * FROM graph_templates WHERE id = "thegraph_template_id_from_above"
  4. SELECT * FROM snmp_query_graph WHERE snmp_query_graph_id = "snmp_query_graph_id_from_above"

Let us know what is returned in each case, or the SQL Error otherwise.

@cigamit
Copy link
Member

cigamit commented Apr 6, 2017

David, any progress?

@DavidLiedke
Copy link
Contributor Author

Sorry for the late answer.

I didn´t find anything in the log.

  1. 14

firefox_2017-04-07_08-45-52
3.
firefox_2017-04-07_08-47-00
4.
firefox_2017-04-07_08-53-10

@cigamit
Copy link
Member

cigamit commented Apr 8, 2017

Sorry, the last one was more like:

SELECT * FROM snmp_query_graph WHERE id = 38;

@DavidLiedke
Copy link
Contributor Author

It get a empty result.

There is no entry in this table for id 38.

@cigamit
Copy link
Member

cigamit commented Apr 8, 2017

This explain's it. When you edit a Data Query you have the ability to Map the Query Elements to a Graph Template. In your case, that Graph Template was removed from the mapping and just checking, we are still allowing this, which I'm going to say is the real bug.

Basically, when a Data Query Graph Template is in use (Has Graphs), it should not be allowed to be removed, only edited.

So, in your case, you will need to add back the mapping, note the "Mapping ID", and then, in the table: "graph_local", do the following changes.

UPDATE graph_local SET snmp_query_graph_id="newid" WHERE snmp_query_graph_id=38;

The old Cacti 0.x.x had a number of these bad behaviors and we have tried to cork most of them up. It seems we forgot one hole.

Does this add up for you?

@cigamit cigamit changed the title Cacti 1.1.2 - Display wrong Graph Template Cacti allows the removal of Data Query Graph Template associations when they are in use Apr 8, 2017
@DavidLiedke
Copy link
Contributor Author

I had the Graph Template "IOS Interface Traffic" with use the Data Queries "SNMP - Interface Statistics". I had a lot of graphes which use this Graph template. Without any problems.

All graphes in the "graph_local" table with the "graph_template_id=38" are using the "snmp_query_id=1" ("SNMP - Interface Statistics"). I think this is good.

We didn´t change anything in the past at cacti. The only change was to update it.

If i open the graph in the "Management-Graphs" section i get the following messages in the cacti log:

2017-04-08 17:53:01 - DBCALL ERROR: SQL Assoc Failed!, Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')) OR graph_template_id IN () ORDER BY name' at line 1
2017-04-08 17:53:01 - DBCALL ERROR: SQL Assoc Failed!, Error:1064, SQL:"SELECT CONCAT_WS('', graph_template_id, '_', id, '') AS id, name FROM snmp_query_graph WHERE (snmp_query_id = 1 AND id IN ()) OR graph_template_id IN () ORDER BY name"

cigamit added a commit that referenced this issue Apr 9, 2017
Cacti allows removal of Data Query Graph Template associations when they
are in use
@cigamit
Copy link
Member

cigamit commented Apr 9, 2017

Hmm. Maybe we missed something. I have marked this issue resolved, but your case needs more attention relative to the SQL error. We will need you to be a developer here. It almost appears that there are more issues associated with your setup. If you could edit graphs.php, and look at the code block between lines 407 and 433. What it tries to do if find common Graph Templates to the one's in question. In your case, due to either empti $sqgi, $query_fields, $common_graph_ids, you are getting the error. Can you please determine which it is.

@DavidLiedke
Copy link
Contributor Author

Sorry i am no developer.

I looked into a old database backup of our installation with version 0.8.8h. There was no matching between the Data Query and the Graph Template. If you want i can give you an dump of our database with cacti version 1.1.2 and the backup with version 0.8.8h.

graphs.php lines between 406 and 434:

graphs_406_434.pdf

@DavidLiedke
Copy link
Contributor Author

I add the match between the Graph template and the SNMP Data Query. After that i have no "DBCALL Error" anymore.

After updating the graphs to the new snmp_query_graph_id
Your SQL statement
i see in the "Management - Graphs" Section the correct Graph template.
chrome_2017-04-10_20-26-57

But if i open one graph the wrong graph template is listed.
chrome_2017-04-10_20-27-28

@cigamit
Copy link
Member

cigamit commented Apr 11, 2017

Yea, you screwed up. It might be good to get the dump to a location where it can be had. This is not a support forum, but I am interested from a tool perspective as to what has caused this to begin with. You can sent a PM to me on the Cacti forums with instructions on how to obtain it.

@DavidLiedke
Copy link
Contributor Author

I get the message: "You are not authorised to read private messages."

@cigamit
Copy link
Member

cigamit commented Apr 11, 2017

What is your forum account name?

@DavidLiedke
Copy link
Contributor Author

Sorry. Its the same like Github --> DavidLiedke

@cigamit
Copy link
Member

cigamit commented Apr 13, 2017

You should be able to now. Thanks.

@DavidLiedke
Copy link
Contributor Author

Sorry i always get the same error message.

@cigamit
Copy link
Member

cigamit commented Apr 19, 2017

I was unable to make the permissions change stick either. Why don't you drop it somewhere where it can be picked up/downloaded.

@cigamit
Copy link
Member

cigamit commented Apr 21, 2017

Got them. Will take a look in the next few days.

@cigamit
Copy link
Member

cigamit commented May 4, 2017

David, There was a 'tuning' step done by reboot a week or so ago that likely fixed this issue. Should be released in 1.1.5. Let me know if you are still having the issue.

@cigamit
Copy link
Member

cigamit commented May 14, 2017

pretty sure the issue in the title is resolved

@cigamit cigamit closed this as completed May 14, 2017
@github-actions github-actions bot locked and limited conversation to collaborators Jun 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants