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

Unable to reorder graph name suggested values #1245

Closed
pautiina opened this issue Jan 20, 2018 · 13 comments
Closed

Unable to reorder graph name suggested values #1245

pautiina opened this issue Jan 20, 2018 · 13 comments

Comments

@pautiina
Copy link
Contributor

Hello.
I try to reoder Suggested Values - Graph Names but some values dont want up and some time on browser concole have thith error.

content.js:54 Uncaught TypeError: Cannot read property 'indexOf' of undefined
    at HTMLDocument.<anonymous> (content.js:54)
(anonymous) @ content.js:54

bandicam-2018-01-20-11-01-54-702 1

@netniV
Copy link
Member

netniV commented Jan 20, 2018

Event on the latest development code I can't get this to break. The other thing this that this is failing in "content.js" which doesn't appear to be a direct cacti source file, so unless that is pulled in from somewhere else, may be a third party plugin or something?

I can't even find it being downloaded on my chrome developer tools which would lend credence to the above.

@pautiina
Copy link
Contributor Author

pautiina commented Jan 20, 2018

The problem was a long time ago, but I wrote about it only now.
Try peregrupirovat. The second element does not rise to the first place.

@netniV
Copy link
Member

netniV commented Jan 20, 2018

Maybe the problem doesn’t exist now?

@cigamit
Copy link
Member

cigamit commented Jan 20, 2018

I think that content.js is something to do with Chrome. Can you see if it re-orders using Firefox or some other browser? Second, for the Data Query in question, can you dump the contents of the snmp_query_graph_rrd_sv table ordered by sequence. content.js is not a Cacti thing. But I saw articles able it with respect to something in Chrome.

@cigamit
Copy link
Member

cigamit commented Jan 20, 2018

content js

@pautiina
Copy link
Contributor Author

pautiina commented Jan 20, 2018

In firefox, I also can not lift the second element up and on Firefox I dont have content.js error.

On EDGE:
bandicam-2018-01-20-18-48-36-773

@cigamit
Copy link
Member

cigamit commented Jan 20, 2018

Can you please send 'just' the output from the specific snmp_query_id? Your earlier post was way too much data. Also, don't forget to sort by sequence.

@pautiina
Copy link
Contributor Author

If I understood you correctly about snmp_query_id, here's the result:

mysql> select * from snmp_query_graph_rrd_sv where snmp_query_graph_id=1 ORDER BY `snmp_query_graph_rrd_sv`.`sequence` ASC;
+----+----------------------------------+---------------------+------------------+----------+------------+--------------------------------------------------------------------------+
| id | hash                             | snmp_query_graph_id | data_template_id | sequence | field_name | text                                                                     |
+----+----------------------------------+---------------------+------------------+----------+------------+--------------------------------------------------------------------------+
|  1 | 77065435f3bbb2ff99bc3b43b81de8fe |                   1 |                6 |        1 | name       | |host_description| - Non-Unicast Packets - |query_ifIP| - |query_ifName| |
|  2 | 240d8893092619c97a54265e8d0b86a1 |                   1 |                6 |        2 | name       | |host_description| - Non-Unicast Packets - |query_ifName|                |
|  3 | 4b200ecf445bdeb4c84975b74991df34 |                   1 |                6 |        3 | name       | |host_description| - Non-Unicast Packets - |query_ifIP|/|query_ifDescr|  |
|  4 | d6da3887646078e4d01fe60a123c2179 |                   1 |                6 |        4 | name       | |host_description| - Non-Unicast Packets - |query_ifDescr|               |
+----+----------------------------------+---------------------+------------------+----------+------------+--------------------------------------------------------------------------+
4 rows in set (0.00 sec)


image

@cigamit
Copy link
Member

cigamit commented Feb 4, 2018

Well that is odd. Your query shows 4 results, but the list show many more. Can you find out what is different here? Maybe instead of querying the snmp_query_id, do the snmp_query_graph_id. I'm interested in what the snmp_query_id is set to when you query only on the snmp_query_graph_id.

@pautiina
Copy link
Contributor Author

pautiina commented Feb 4, 2018

Maybe I did not fully understand you.
I changed my SQL query and got a little bit similar information with the one on the screenshot.

mysql> SELECT id,snmp_query_graph_id,data_template_id,sequence,field_name,text FROM `snmp_query_graph_rrd_sv` WHERE `snmp_query_graph_id` = 2 ORDER BY `snmp_query_graph_rrd
+----+---------------------+------------------+----------+-------------+-------------------------------------------------------------------+
| id | snmp_query_graph_id | data_template_id | sequence | field_name  | text                                                              |
+----+---------------------+------------------+----------+-------------+-------------------------------------------------------------------+
|  6 |                   2 |                3 |        1 | rrd_maximum | |query_ifSpeed|                                                   |
| 81 |                   2 |                3 |        1 | name        | |host_description| - Traffic - |query_ifName| -- |query_ifAlias|  |
| 10 |                   2 |                3 |        2 | name        | |host_description| - Traffic - |query_ifAlias|                    |
|  7 |                   2 |                3 |        3 | name        | |host_description| - Traffic - |query_ifName|                     |
| 77 |                   2 |                3 |        4 | name        | |host_description| - Traffic - |query_ifName| - |query_ifIP|      |
|  8 |                   2 |                3 |        5 | name        | |host_description| - Traffic - |query_ifIP|/|query_ifDescr|       |
|  5 |                   2 |                3 |        7 | name        | |host_description| - Traffic - |query_ifIP| - |query_ifName|      |
|  9 |                   2 |                3 |        8 | name        | |host_description| - Traffic - |query_ifDescr|                    |
| 78 |                   2 |                3 |        9 | name        | |host_description| - Traffic - |query_ifIP| - |query_ifName|      |
| 82 |                   2 |                3 |       10 | name        | |host_description| - Traffic - |query_ifDescr| -- |query_ifAlias| |
+----+---------------------+------------------+----------+-------------+-------------------------------------------------------------------+
10 rows in set (0.01 sec)

image
image

And second query for graph names:

mysql> SELECT text, field_name, id, sequence FROM snmp_query_graph_sv WHERE snmp_query_graph_id = 2 ORDER BY field_name, sequence;
+------------------------------------------------------------------------------+------------+----+----------+
| text                                                                         | field_name | id | sequence |
+------------------------------------------------------------------------------+------------+----+----------+
| |host_description| - Traffic - |query_ifName| -- |query_ifAlias|             | title      | 64 |        1 |
| |host_description| - Traffic - |query_ifAlias|                               | title      | 73 |        1 |
| |host_description| - Traffic - |query_ifName|                                | title      |  7 |        2 |
| |host_description| - Traffic - |query_ifName| - |query_ifIP|                 | title      | 66 |        3 |
| |host_description| - Traffic - |query_ifDescr|/|query_ifIndex|               | title      |  6 |        4 |
| |host_description| - Traffic - |query_ifDescr|                               | title      | 67 |        4 |
| |host_description| - Traffic - |query_ifIP| (|query_ifDescr|)                | title      |  8 |        6 |
| |host_description| - Traffic - |query_ifName| |query_ifDescr| - |query_ifIP| | title      | 68 |        7 |
+------------------------------------------------------------------------------+------------+----+----------+
8 rows in set (0.00 sec)

image

@cigamit
Copy link
Member

cigamit commented Feb 5, 2018

Yup, some old and nasty functions from some of the oldest Cacti. There are two functions that do the movement, but they never took account for errors. Time to fix them I guess.

cigamit added a commit that referenced this issue Feb 5, 2018
Cannot reorder Suggested Values - Graph Names on Data Queries
@cigamit
Copy link
Member

cigamit commented Feb 5, 2018

Resolved now. You can update data_queries.php and test. Close is resolved.

@pautiina
Copy link
Contributor Author

pautiina commented Feb 5, 2018

Many thanks. Fixed.

@pautiina pautiina closed this as completed Feb 5, 2018
@ronytomen ronytomen changed the title Cannot reorder Suggested Values - Graph Names on Data Queries Unable to reorder graph name suggested values Feb 5, 2018
@github-actions github-actions bot locked as resolved 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

3 participants