Cacti / cacti

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

Can't apply a change in data source name, after changing the template format (or in the query) #4503

Closed arno-st closed 2 years ago

arno-st commented 2 years ago

Hello, I have to change the format of my data source name for the link status. For tahat I go under: Data Collection -> SNMP - Interface Statistics -> Interface -Status then under Suggested Values - Data Sources I put name |host_description| |query_ifName| - Status - |query_ifAlias|

The query work, I have the status of my interface, that's not a problem!

Then I go under Management -> Data Source and select only the template Interface status Then elect my interface, and apply the command: Reapply Suggested name I have the confirmation screen but nothing happen. So I try to go on the code to check if something is wrong.

under api_datasource_php, I look on api_reapply_suggested_data_source_data and did all the query manually. so here is the query, and following each query the result.

The last one give an empty for the did.value: (I hope you understand what my output is) `SELECT id FROM data_template_data WHERE local_data_id = 2719 id 2801

SELECT id, host_id, data_template_id, snmp_query_id, snmp_index FROM data_local WHERE snmp_query_id > 0 AND id = 2719 id host_id data_template_id snmp_query_id snmp_index 2719 357 64 4 2

SELECT did.value FROM data_input_data AS did INNER JOIN data_input_fields AS dif ON did.data_input_field_id = dif.id INNER JOIN data_template_data AS dtd ON dtd.id = did.data_template_data_id WHERE dif.type_code = 'output_type' AND dtd.local_data_id = 2719 did.value

DTD (local_data_id = 2719)= id local_data_template_data_id local_data_id data_template_id data_input_id t_name name name_cache data_source_path t_active active t_rrd_step rrd_step t_data_source_profile_id data_source_profile_id 2801 69 2719 64 2 NULL |host_description| - Interface status lsinet195 - Interface status /lsinet195_int_status_2719.rrd on 60 3 DID (data_template_data_id=2801)= data_input_field_id data_template_data_id t_value value 7 2801 NULL 10.253.247.19 8 2801 NULL 9 2801 NULL 10 2801 NULL 11 2801 NULL 3 12 2801 13 2801 14 2801 39 2801 NULL 161 44 2801 NULL SHA 45 2801 NULL 46 2801 NULL AES128 DIF (type_code='ouput_type' AND id=14 )= id hash data_input_id name data_name input_output update_rra sequence type_code regexp_match allow_nulls 14 e6deda7be0f391399c5130e7c4a48b28 2 Output Type ID output_type in 0 output_type 33 74af2e42dc12956c4817c2ef5d9983f9 11 Output Type ID output_type in 0 output_type 37 31112c85ae4ff821d3b288336288818c 12 Output Type ID output_type in 0 output_type ` I'm running Cacti 1.2.19, on CentOS.
TheWitness commented 2 years ago

That I take it you commented out a few things. I guess we should add some tracing options. Did you reorder the suggested values? Do all the interfaces have aliases?

arno-st commented 2 years ago

Hy, I didn't comment anything, I just do the snmp query manually, and give the ouput, and for each query I give the value used to make that query. I didn't reorder any suggested value, actually I have only one value available. And no not all interface have alias, some do some don't.

But I have to say same suggested value exist for the graph name, and it work well.

Actually, prior to the change I have the data source template I have the option :Internal Data Source Name selected, so user should be able to change the DS name, and I disable that to be sure the DS take the name provided inside the Data Collector suggested value.

TheWitness commented 2 years ago

Well, I have not looked at that code in like forever. Maybe later this week or between Christmas and New Years.

TheWitness commented 2 years ago

Just checking back on this. I did a code review, and the logic is pretty solid. You may have been bitten by a template bug or two that bled through the 1.2.16 through 1.2.19 releases. You may have to recreate the graph and then swap out the old rrdfile for the new one. The upcoming 1.2.20 release is pretty solid at the moment.

TheWitness commented 2 years ago

Any updates? We should release 1.2.21 in the next couple of days.

arno-st commented 2 years ago

Well I made a few test yesterday, running 1.2.20, seems to work.

TheWitness commented 2 years ago

Marking this resolved.