Cacti / cacti

Cacti ™
http://www.cacti.net
GNU General Public License v2.0
1.63k stars 404 forks source link

[1.2.0] - Graph management not display graph names #1614

Closed pautiina closed 6 years ago

pautiina commented 6 years ago

image image

pautiina commented 6 years ago

The problem is that the value title_cache is incorrectly substituted:

2018/05/07 10:19:46 - DBCALL DEVEL: SQL Exec: "UPDATE graph_templates_graph SET title_cache = ? WHERE local_graph_id = ?"
2018/05/07 10:19:46 - DBCALL DEVEL: SQL Row: "SELECT gl.host_id, gl.snmp_query_id, gl.snmp_index, gtg.local_graph_id, gtg.t_title, gtg.title FROM graph_templates_graph AS gtg INNER JOIN graph_local AS gl ON gtg.local_graph_id = gl.id WHERE gl.id = ?"
2018/05/07 10:19:46 - DBCALL DEVEL: SQL Exec: "INSERT INTO graph_templates_graph (`id`, `local_graph_template_graph_id`, `graph_template_id`, `image_format_id`, `title`, `height`, `width`, `upper_limit`, `lower_limit`, `vertical_label`, `slope_mode`, `auto_scale`, `auto_scale_opts`, `auto_scale_log`, `scale_log_units`, `auto_scale_rigid`, `auto_padding`, `base_value`, `unit_value`, `unit_exponent_value`, `alt_y_grid`, `right_axis`, `right_axis_label`, `right_axis_format`, `no_gridfit`, `unit_length`, `tab_width`, `dynamic_labels`, `force_rules_legend`, `legend_position`, `legend_direction`, `right_axis_formatter`, `left_axis_formatter`, `local_graph_id`) VALUES (7510, 2, 2, 1, '|host_description| - Traffic - |query_ifName| -- |query_ifAlias| -1', 150, 550, '100', '0', 'bits per second', 'on', 'on', 2, '', '', 'on', 'on', 1000, '', '', '', '', '', 0, '', '', '', '', '', '0', '0', '0', '0', 7402) ON DUPLICATE KEY UPDATE `local_graph_template_graph_id`=VALUES(`local_graph_template_graph_id`), `graph_template_id`=VALUES(`graph_template_id`), `image_format_id`=VALUES(`image_format_id`), `title`=VALUES(`title`), `height`=VALUES(`height`), `width`=VALUES(`width`), `upper_limit`=VALUES(`upper_limit`), `lower_limit`=VALUES(`lower_limit`), `vertical_label`=VALUES(`vertical_label`), `slope_mode`=VALUES(`slope_mode`), `auto_scale`=VALUES(`auto_scale`), `auto_scale_opts`=VALUES(`auto_scale_opts`), `auto_scale_log`=VALUES(`auto_scale_log`), `scale_log_units`=VALUES(`scale_log_units`), `auto_scale_rigid`=VALUES(`auto_scale_rigid`), `auto_padding`=VALUES(`auto_padding`), `base_value`=VALUES(`base_value`), `unit_value`=VALUES(`unit_value`), `unit_exponent_value`=VALUES(`unit_exponent_value`), `alt_y_grid`=VALUES(`alt_y_grid`), `right_axis`=VALUES(`right_axis`), `right_axis_label`=VALUES(`right_axis_label`), `right_axis_format`=VALUES(`right_axis_format`), `no_gridfit`=VALUES(`no_gridfit`), `unit_length`=VALUES(`unit_length`), `tab_width`=VALUES(`tab_width`), `dynamic_labels`=VALUES(`dynamic_labels`), `force_rules_legend`=VALUES(`force_rules_legend`), `legend_position`=VALUES(`legend_position`), `legend_direction`=VALUES(`legend_direction`), `right_axis_formatter`=VALUES(`right_axis_formatter`), `left_axis_formatter`=VALUES(`left_axis_formatter`), `local_graph_id`=VALUES(`local_graph_id`)"

mysql> SELECT * FROM `graph_templates_graph` WHERE `id` = 7510;
+------+-------------------------------+----------------+-------------------+-------------------+-----------------+---------+---------------------------------------------------------------------+---------------------------------------------------------------------+----------+--------+---------+-------+---------------+-------------+---------------+-------------+------------------+-----------------+--------------+------------+--------------+------------+-------------------+-----------------+------------------+----------------+-------------------+-----------------+--------------------+------------------+----------------+--------------+--------------+------------+------------+----------+--------------+------------+-----------------------+---------------------+--------------+------------+--------------+------------+--------------------+------------------+---------------------+-------------------+------------------------+----------------------+-----------------------+---------------------+--------------+------------+---------------+-------------+-------------+-----------+------------------+----------------+----------------------+--------------------+-------------------+-----------------+--------------------+------------------+
| id   | local_graph_template_graph_id | local_graph_id | graph_template_id | t_image_format_id | image_format_id | t_title | title                                                               | title_cache                                                         | t_height | height | t_width | width | t_upper_limit | upper_limit | t_lower_limit | lower_limit | t_vertical_label | vertical_label  | t_slope_mode | slope_mode | t_auto_scale | auto_scale | t_auto_scale_opts | auto_scale_opts | t_auto_scale_log | auto_scale_log | t_scale_log_units | scale_log_units | t_auto_scale_rigid | auto_scale_rigid | t_auto_padding | auto_padding | t_base_value | base_value | t_grouping | grouping | t_unit_value | unit_value | t_unit_exponent_value | unit_exponent_value | t_alt_y_grid | alt_y_grid | t_right_axis | right_axis | t_right_axis_label | right_axis_label | t_right_axis_format | right_axis_format | t_right_axis_formatter | right_axis_formatter | t_left_axis_formatter | left_axis_formatter | t_no_gridfit | no_gridfit | t_unit_length | unit_length | t_tab_width | tab_width | t_dynamic_labels | dynamic_labels | t_force_rules_legend | force_rules_legend | t_legend_position | legend_position | t_legend_direction | legend_direction |
+------+-------------------------------+----------------+-------------------+-------------------+-----------------+---------+---------------------------------------------------------------------+---------------------------------------------------------------------+----------+--------+---------+-------+---------------+-------------+---------------+-------------+------------------+-----------------+--------------+------------+--------------+------------+-------------------+-----------------+------------------+----------------+-------------------+-----------------+--------------------+------------------+----------------+--------------+--------------+------------+------------+----------+--------------+------------+-----------------------+---------------------+--------------+------------+--------------+------------+--------------------+------------------+---------------------+-------------------+------------------------+----------------------+-----------------------+---------------------+--------------+------------+---------------+-------------+-------------+-----------+------------------+----------------+----------------------+--------------------+-------------------+-----------------+--------------------+------------------+
| 7510 |                             2 |           7402 |                 2 | 0                 |               1 | 0       | |host_description| - Traffic - |query_ifName| -- |query_ifAlias| -1 | |host_description| - Traffic - |query_ifName| -- |query_ifAlias| -1 | 0        |    150 | 0       |   550 | 0             | 100         | 0             | 0           | 0                | bits per second | 0            | on         | 0            | on         | 0                 |               2 | 0                |                | 0                 |                 | 0                  | on               | 0              | on           | 0            |       1000 | 0          |          | 0            |            | 0                     |                     |              |            |              |            |                    |                  |                     |                 0 |                        | 0                    |                       | 0                   |              |            |               |             |             |           |                  |                |                      |                    |                   | 0               |                    | 0                |
+------+-------------------------------+----------------+-------------------+-------------------+-----------------+---------+---------------------------------------------------------------------+---------------------------------------------------------------------+----------+--------+---------+-------+---------------+-------------+---------------+-------------+------------------+-----------------+--------------+------------+--------------+------------+-------------------+-----------------+------------------+----------------+-------------------+-----------------+--------------------+------------------+----------------+--------------+--------------+------------+------------+----------+--------------+------------+-----------------------+---------------------+--------------+------------+--------------+------------+--------------------+------------------+---------------------+-------------------+------------------------+----------------------+-----------------------+---------------------+--------------+------------+---------------+-------------+-------------+-----------+------------------+----------------+----------------------+--------------------+-------------------+-----------------+--------------------+------------------+
1 row in set (0.00 sec)
cigamit commented 6 years ago

Did you re-apply suggested names? Did you attempt a re-index before doing that?

pautiina commented 6 years ago

@cigamit It just happened after everything you said

It was all in that order: 1) Run attempt a re-index 2) re-apply suggested names 3) problem

Then I manually for test try change names from this: |host_description| - Traffic - |query_ifName| -- |query_ifAlias| to this: |host_description| - Traffic - |query_ifName| -- |query_ifAlias| -1

cigamit commented 6 years ago

Check your host_snmp_cache and verify the ifAlias is actually there for these interfaces. Seems like something may have changed for sure. Verbose query from the device page too.

pautiina commented 6 years ago

Data Sources is displayed normally: image

host_snmp_cache have valide data for this device:

mysql> SELECT * FROM `host_snmp_cache` WHERE `host_id` = 399 and snmp_index = 518 ;
+---------+---------------+--------------+-------------------+------------+------------------------------+---------+---------------------+
| host_id | snmp_query_id | field_name   | field_value       | snmp_index | oid                          | present | last_updated        |
+---------+---------------+--------------+-------------------+------------+------------------------------+---------+---------------------+
|     399 |             1 | ifAlias      |                   | 518        | .1.3.6.1.2.1.31.1.1.1.18.518 |       1 | 2018-05-08 15:20:26 |
|     399 |             1 | ifDescr      | ge-0/0/17         | 518        | .1.3.6.1.2.1.2.2.1.2.518     |       1 | 2018-05-08 15:20:26 |
|     399 |             1 | ifHighSpeed  | 0                 | 518        | .1.3.6.1.2.1.31.1.1.1.15.518 |       1 | 2018-05-08 15:20:26 |
|     399 |             1 | ifHwAddr     | 00:1F:12:3A:D1:14 | 518        | .1.3.6.1.2.1.2.2.1.6.518     |       1 | 2018-05-08 15:20:26 |
|     399 |             1 | ifIndex      | 518               | 518        | .1.3.6.1.2.1.2.2.1.1.518     |       1 | 2018-05-08 15:20:26 |
|     399 |             1 | ifName       | ge-0/0/17         | 518        | .1.3.6.1.2.1.31.1.1.1.1.518  |       1 | 2018-05-08 15:20:26 |
|     399 |             1 | ifOperStatus | Down              | 518        | .1.3.6.1.2.1.2.2.1.8.518     |       1 | 2018-05-08 15:20:26 |
|     399 |             1 | ifSpeed      | 0                 | 518        | .1.3.6.1.2.1.2.2.1.5.518     |       1 | 2018-05-08 15:20:26 |
|     399 |             1 | ifType       | ethernetCsmacd(6  | 518        | .1.3.6.1.2.1.2.2.1.3.518     |       1 | 2018-05-08 15:20:26 |
+---------+---------------+--------------+-------------------+------------+------------------------------+---------+---------------------+
9 rows in set (0.01 sec)

I tried this for another device, the situation is the same.

maybe you misunderstood me. SNMP polls everything correctly and draws correct values on the graph: | host_description | and | query_ifName | and | query_ifAlias |. The problem is that in the graph manager's tab all graphs titles are displayed identically. And so I need to go into the settings of each graph to see they belong to which interface. image image The problem is that title_cachedoes not correctly write the value to the database

netniV commented 6 years ago

If you notice the cache didn’t have a value for ifAlias so it is this part that has gone wrong.

pautiina commented 6 years ago

@netniV I tried to leave only | host_description | - the same effect image

pautiina commented 6 years ago

I do not understand anything, I have a second host with Cacti 1.2.0, I also update it from the develop branch and everything is fine

netniV commented 6 years ago

Soirry, I was using CodeHub on my iPad to view things as I’m sat on a plane waiting to takeoff. I switched to a browser so I could zoom in and I see the problem now. It’s not even running the variable replacement logic is it?

The reason I was questioning it, was the difference between the interface you were highlghting and the index you used to get the data out didn’t seem to match plus the ifAlias was blank. @cigamit will likely correct this as I’m working abroad for the next two days.

pautiina commented 6 years ago

This problem affects all the graphs templates, not just the interfaces

pautiina commented 6 years ago

I'm worried that there is no such problem on the second server

netniV commented 6 years ago

I appreciate now that it affects everything, but the examples you gave didn't line up (at least to me).

eschoeller commented 6 years ago

@pautiina take a look at #934 ... see if any of that looks similar to what you're seeing, specifically my comment from Feb 20th.

gotshaykes commented 6 years ago

I ran into this issue as well. Turns out t_title got set to 0 for all the graph IDs showing this way. get_graph_title in lib/functions.php requires t_title be empty before substituting variables for the title cache. So, clearing it will let you reapply suggested names...

UPDATE cacti.graph_templates_graph SET t_title = '' WHERE t_title = '0' AND graph_template_id = '140'

I'm not sure what I did to set t_title=0, but I'm sort of stumbling my way through the code to figure it out.

gotshaykes commented 6 years ago

I forgot to mention I'm running 1.1.38 right now, not 1.2.x. The problem first appeared on 1.1.37 and persisted through 1.1.38 until I cleared t_title.

pautiina commented 6 years ago

Today I removed some of the graphs from the device and recreated them on a new one. And now everything is displayed normally. But the old graphs with the use of names of the situation has not changed. I do not understand anything. image

netniV commented 6 years ago

I've done a difference between 1.1.37 and 1.1.38 and I can not see anything that would explicitly cause this issue. Can you select a good and bad graph to show the fields in MySQL including t_cache

cigamit commented 6 years ago

Okay, so, look up the host_id in graph_local, then check to see if that device still exists in the host table. Let me know that it's still there. Also, provide a screen shot of the suggested names in the Data Query for this specific Graph Template.

pautiina commented 6 years ago

image

image

image

mysql> SELECT * FROM `graph_local` WHERE `host_id` = 399;
+------+-------------------+---------+---------------+---------------------+------------+
| id   | graph_template_id | host_id | snmp_query_id | snmp_query_graph_id | snmp_index |
+------+-------------------+---------+---------------+---------------------+------------+
| 9634 |                 2 |     399 |             1 |                  14 | 513        |
| 9633 |                 2 |     399 |             1 |                  14 | 512        |
| 9629 |                 2 |     399 |             1 |                  14 | 508        |
| 7490 |                 2 |     399 |             1 |                  14 | 574        |
| 7396 |                 2 |     399 |             1 |                  14 | 521        |
| 7392 |                 2 |     399 |             1 |                  14 | 517        |
| 7393 |                 2 |     399 |             1 |                  14 | 518        |
| 7394 |                 2 |     399 |             1 |                  14 | 519        |
| 7379 |                 7 |     399 |             0 |                   0 |            |
| 7378 |                83 |     399 |             0 |                   0 |            |
| 7377 |                82 |     399 |             0 |                   0 |            |
| 7391 |                 2 |     399 |             1 |                  14 | 516        |
| 7390 |                 2 |     399 |             1 |                  14 | 515        |
| 7389 |                 2 |     399 |             1 |                  14 | 514        |
| 9630 |                 2 |     399 |             1 |                  14 | 509        |
| 9631 |                 2 |     399 |             1 |                  14 | 510        |
| 9632 |                 2 |     399 |             1 |                  14 | 511        |
| 7382 |                 2 |     399 |             1 |                  14 | 507        |
| 7381 |                 2 |     399 |             1 |                  14 | 506        |
| 7380 |                 2 |     399 |             1 |                  14 | 505        |
| 7488 |                 2 |     399 |             1 |                  14 | 570        |
| 7489 |                 2 |     399 |             1 |                  14 | 572        |
| 7397 |                 2 |     399 |             1 |                  14 | 522        |
| 7398 |                 2 |     399 |             1 |                  14 | 554        |
| 7399 |                 2 |     399 |             1 |                  14 | 524        |
| 7400 |                 2 |     399 |             1 |                  14 | 525        |
| 7401 |                 2 |     399 |             1 |                  14 | 545        |
| 7402 |                 2 |     399 |             1 |                  14 | 546        |
+------+-------------------+---------+---------------+---------------------+------------+
28 rows in set (0.00 sec)
mysql> SELECT * FROM `host` WHERE `id` = 399;
+-----+-----------+---------+------------------+-------------+-------------+----------+-------+-------------+----------------+--------------+---------------+---------------+--------------------+----------------------+--------------------+--------------+----------------+-----------+--------------+------------------------------+-----------------------------------------+------------------------+-----------------------------------------+---------------------+------------------+---------------------+-------------+-----------+--------------+--------------+----------+----------------+----------+------------------+------------------+----------------+------------------+--------+--------------------+---------------------+---------------------+-------------------------------------------------------+----------+------------+----------+----------+--------------+-------------+--------------+--------------+---------------------+
| id  | poller_id | site_id | host_template_id | description | hostname    | location | notes | external_id | snmp_community | snmp_version | snmp_username | snmp_password | snmp_auth_protocol | snmp_priv_passphrase | snmp_priv_protocol | snmp_context | snmp_engine_id | snmp_port | snmp_timeout | snmp_sysDescr                | snmp_sysObjectID                        | snmp_sysUpTimeInstance | snmp_sysContact                         | snmp_sysName        | snmp_sysLocation | availability_method | ping_method | ping_port | ping_timeout | ping_retries | max_oids | device_threads | disabled | thold_send_email | thold_host_email | thold_send_sms | thold_host_phone | status | status_event_count | status_fail_date    | status_rec_date     | status_last_error                                     | min_time | max_time   | cur_time | avg_time | polling_time | total_polls | failed_polls | availability | last_updated        |
+-----+-----------+---------+------------------+-------------+-------------+----------+-------+-------------+----------------+--------------+---------------+---------------+--------------------+----------------------+--------------------+--------------+----------------+-----------+--------------+------------------------------+-----------------------------------------+------------------------+-----------------------------------------+---------------------+------------------+---------------------+-------------+-----------+--------------+--------------+----------+----------------+----------+------------------+------------------+----------------+------------------+--------+--------------------+---------------------+---------------------+-------------------------------------------------------+----------+------------+----------+----------+--------------+-------------+--------------+--------------+---------------------+
| 399 |         1 |       0 |                1 | JUPITER     | 192.168.4.9 | NULL     |       | NULL        | stat     |            2 |               |               |                    |                      |                    |              |                |       161 |          800 | JUPITER (Juniper EX3200-24t) | SNMPv2-SMI::enterprises.2636.1.1.1.2.30 |               84564105 | NOC, +38 (057) 707, noct | jupiter | CNIT |                   1 |           1 |        23 |          400 |            1 |        5 |              1 |          |                1 |             NULL |              1 |                0 |      3 |                  0 | 2018-05-05 14:01:00 | 2018-05-05 14:34:00 | Device did not respond to SNMP, ICMP: Device is Alive |  0.48733 | 5006.11592 |  0.65303 |  2.10504 |        0.571 |     2056629 |          233 |     99.98870 | 2018-05-15 09:27:11 |
+-----+-----------+---------+------------------+-------------+-------------+----------+-------+-------------+----------------+--------------+---------------+---------------+--------------------+----------------------+--------------------+--------------+----------------+-----------+--------------+------------------------------+-----------------------------------------+------------------------+-----------------------------------------+---------------------+------------------+---------------------+-------------+-----------+--------------+--------------+----------+----------------+----------+------------------+------------------+----------------+------------------+--------+--------------------+---------------------+---------------------+-------------------------------------------------------+----------+------------+----------+----------+--------------+-------------+--------------+--------------+---------------------+
1 row in set (0.00 sec)
cigamit commented 6 years ago

Okay, actually @eschoeller is likely correct. If you review this graph:

image

You will see that the Graph Title is editable, which means that the checkbox to the left of the specific Graph Template was either perceived to be checkable due to a database issue as @eschoeller indicated, or it was checked inadvertently without knowledge of it's implications, this was then propagated to the graphs. Now, if you review the following graph, you will see that the Graph Title is not editable, which is correct.

graphedit

In my opinion, in any event, it is a bug, but now we know where to search to find it. Unfortunately, I'm going to be pretty busy over the next weeks. Maybe @netniV will have the time to track things down. First step is to audit your Graph Template and verify that the Graph Title does not have the checkbox checked (just resave it). Second would be to follow @eschoeller advice, and then Re-apply the suggested names once more.

Keep us posted and we will address this issue as soon as possible.

pautiina commented 6 years ago

I removed the check box in the Graph template image Reapply suggested names for all graph and nov have I reapply suggested names for all Graphs and now have 1086 of 2546 incorrectly signed schedules: image The remaining graphics used the proposed names normally.

netniV commented 6 years ago

I think you may also need to use the Sync Graph option. Select the graph template in question on Management -> Graph Templates, then at the bottom right there should be Sync and it will lead to a screen that explains this.

pautiina commented 6 years ago

@netniV unfortunately your advice did not help

netniV commented 6 years ago

If you have sync'd try now reapplying the suggesting names.

pautiina commented 6 years ago

Unfortunately, I tried all the options. And I did a reindex device, and synchronized the template, and applied the suggested graph names. All tried in different versions - for these objects names do not apply. Those. half of the devices are now normal, and the second half does not display the normal name of the graphs

pautiina commented 6 years ago

Hello. And so, the method of rollback versions I've found that it stopped working on the release/1.1.37. Now I'm looking for a commit on which I have stopped working.

pautiina commented 6 years ago

b1894a6638396b9bb2cb739d49ba70dd5a406fac - this is the last commit in which there is no problem e7c7dbe3a1af35414a9ca5afe0fdd491043c390e - problem start after this commit

mysql> SELECT gl.host_id, gl.snmp_query_id, gl.snmp_index, gtg.local_graph_id, gtg.t_title, gtg.title FROM graph_templates_graph AS gtg INNER JOIN graph_local AS gl ON gtg.local_graph_id = gl.id WHERE gl.id = 7391;
+---------+---------------+------------+----------------+---------+-----------------------------------------------+
| host_id | snmp_query_id | snmp_index | local_graph_id | t_title | title                                         |
+---------+---------------+------------+----------------+---------+-----------------------------------------------+
|     399 |             1 | 516        |           7391 | 0       | |host_description| - Traffic - |query_ifName| |
+---------+---------------+------------+----------------+---------+-----------------------------------------------+
1 row in set (0.00 sec)

mysql>

if (strstr($graph['title'], '|') && !empty($graph['host_id']) && $graph['t_title'] == '') {

with these changes partially works: if (strstr($graph['title'], '|') && !empty($graph['host_id']) && $graph['t_title'] == '0') {

normally works only with these: if (strstr($graph['title'], '|') && !empty($graph['host_id'])) {

netniV commented 6 years ago

I am not sure why it would be putting a zero in there, that seems wrong to me. However, if we change the check to be empty() that should work since both 0 and '' are classed as being empty if I remember rightly.

pautiina commented 6 years ago

It's all the same device. Now I left the line like this: if (strstr($graph['title'], '|') && !empty($graph['host_id']) && $graph['t_title'] == '0') {

mysql> SELECT gl.host_id, gl.snmp_query_id, gl.snmp_index, gtg.local_graph_id, gtg.t_title, gtg.title FROM graph_templates_graph AS gtg INNER JOIN graph_local AS gl ON gtg.local_graph_id = gl.id WHERE gl.id = 9630;
+---------+---------------+------------+----------------+---------+-----------------------------------------------+
| host_id | snmp_query_id | snmp_index | local_graph_id | t_title | title                                         |
+---------+---------------+------------+----------------+---------+-----------------------------------------------+
|     399 |             1 | 509        |           9630 |         | |host_description| - Traffic - |query_ifName| |
+---------+---------------+------------+----------------+---------+-----------------------------------------------+
1 row in set (0.00 sec)

mysql>
mysql> SELECT gl.host_id, gl.snmp_query_id, gl.snmp_index, gtg.local_graph_id, gtg.t_title, gtg.title FROM graph_templates_graph AS gtg INNER JOIN graph_local AS gl ON gtg.local_graph_id = gl.id WHERE gl.id = 7391;
+---------+---------------+------------+----------------+---------+-----------------------------------------------+
| host_id | snmp_query_id | snmp_index | local_graph_id | t_title | title                                         |
+---------+---------------+------------+----------------+---------+-----------------------------------------------+
|     399 |             1 | 516        |           7391 | 0       | |host_description| - Traffic - |query_ifName| |
+---------+---------------+------------+----------------+---------+-----------------------------------------------+
1 row in set (0.00 sec)

image I just looked through the commit and started experimenting to get at least some results.

mysql> SELECT t_title,COUNT(t_title) FROM `graph_templates_graph` GROUP BY t_title;
+---------+----------------+
| t_title | COUNT(t_title) |
+---------+----------------+
|         |           2667 |
| 0       |           1650 |
| on      |             36 |
+---------+----------------+
3 rows in set (0.04 sec)

mysql>
pautiina commented 6 years ago

Maybe it will be right, based on my results: if (strstr($graph['title'], '|') && !empty($graph['host_id']) && $graph['t_title'] != 'on') {

pautiina commented 6 years ago

This happened due to incorrect upgrade from Version 0.8.8b. I run: php cli/upgrade_database.php --forcever=0.8.8 and now have:

mysql> SELECT t_title,COUNT(t_title) FROM `graph_templates_graph` GROUP BY t_title;
+---------+----------------+
| t_title | COUNT(t_title) |
+---------+----------------+
|         |           4317 |
| on      |             36 |
+---------+----------------+
2 rows in set (0.02 sec)

It is necessary to make some decision: either close Issue or change the code?

netniV commented 6 years ago

I think we need to be handling the situation. However, for 1.2 we could add an extra upgrade step that performs the same update to the t_title value so that it is corrected.

If it goes wrong after that, there is clearly a code issue somewhere.

xefil commented 6 years ago

Hello, sorry, I'm having same issue after upgrading from 1.1.6 to 1.1.38. What should I do to have my graph titles back? On the generated image they are ok, but not on the management -> graphs list (graph name). Thanks, Simon

netniV commented 6 years ago

Try this patch to see if it works for you:

diff --git a/lib/functions.php b/lib/functions.php
index 91736b05..fe2788a8 100644
--- a/lib/functions.php
+++ b/lib/functions.php
@@ -1378,7 +1378,7 @@ function get_graph_title($local_graph_id) {
        array($local_graph_id));

    if (sizeof($graph)) {
-       if (strstr($graph['title'], '|') && !empty($graph['host_id']) && $graph['t_title'] == '') {
+       if (strstr($graph['title'], '|') && !empty($graph['host_id']) && empty($graph['t_title'])) {
            $graph['title'] = substitute_data_input_data($graph['title'], $graph, 0);
            return expand_title($graph['host_id'], $graph['snmp_query_id'], $graph['snmp_index'], $graph['title']);
        } else {
xefil commented 6 years ago

Thanks, it works :-)

netniV commented 6 years ago

@pautiina - Does this also work for you Alex?

pautiina commented 6 years ago

Now I can not check it anymore. I fixed it all, through a forced update from version 0.8.8. I'm think that it can work

netniV commented 6 years ago

I think this is the correct call so I’ll create a PR for it

pautiina commented 6 years ago

@netniV ok.

image

And I think it will be nice to add additional updates (repeat updates from 1.0.0):

db_install_execute("UPDATE graph_templates_graph SET t_title='' WHERE t_title IS NULL");
db_install_execute("UPDATE graph_templates_graph SET t_title='' WHERE t_title='0'");
netniV commented 6 years ago

I'll see about adding that in too.

cigamit commented 6 years ago

Part one of two committed.

cigamit commented 6 years ago

Resolved now.

netniV commented 6 years ago

I'll scrap that PR then ;-)

cigamit commented 6 years ago

Yea, I've been away. Back for a weekend anyway.