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 1.1.2]: Issue when trying to import a certain graph template. #1133
Comments
As you have suggested, the first problem is probably leading on to the other problems. Primarily, when trying to import into the data_template table, there is no name being used:
That |
Thanks for your feedback. The point is that I tried to import some others graph templates (not same authors template) and for some of them, it worked and for others it didn't work(same error returned). |
Well, the good news is, there is only one piece of code that actually INSERTs into the data template table, data_source_to_data_template() in lib/template.php. Now that code has a bug. Change the following lines from:
to
Can you spot the difference ? ;-) In the meantime, I'll create a pull request to fix this. |
Fixed the incorrect use of $totle in place of $title resulting in database insertion errors.
Thanks very much for your help. I have modified the wrong variable name from $totle to $title , but seems there are still some other problems. I have attached the error logs. 2017-12-12 08:01:57 - CMDPHP WARNING: Could not find Cacti default matching hash for unknown system hash "35637c344d84d8aa3a4dc50e4a120b3f" for 1. No repair performed. |
Hmm, unfortunately, when I look at the lines in question, I don't seem to have anything at those lines. It is possible that the code in the Develop is further forward than yours. Can you confirm the version you are running is 1.1.2? I'll have to see if I can roll back to that specific version. The alternative is to pull you forward to the 1.1.28 edition :-) |
I have rolled back my code to the 1.1.2 release that was checked into the master branch, but still have nothing at the lines in question:
At line 4295 of lib/functions.php I have a comment, which definitely shouldn't generate an error. And at line 75 of import.php, is a blank line. This makes me wonder if you have something different in your code. Could you try adding the template_import.php to the list of debug pages in settings? This will give a more verbose output that I can then use to work out what is happening. |
I confirm the Cacti software version is 1.1.2 and also Spine is 1.1.2; |
Could you copy and upload a copy of those three files (templates_import.php, lib/import.php and lib/functions.php). You may need to rename them to .txt if the system sees them as a script and blocks them. The logs you posted appear identical to earlier, so I'm still no clearer in what is happening :) |
Please find the templates attached: |
OK, firstly, apologies, I was looking at 1.1.12 not 1.1.2, doh! Secondly, the code around the import process has been changed in the latest versions such as going from using curly braces to using square braces, replacing the while list with foreach, etc. As such, my recommendation would be to update to the latest realise if you can as you may find these errors just go away. Before you do update though, ensure you read through the change logs to see what is different between your version and the latest one. You should also backup the website code and database before upgrading. Ideally, upgrade on a test system since that is quite a number of changes :) |
Thanks a lot for your time! |
The upgrade path depends on how you installed originally? For my case, I installed via the ubuntu packages but then found these were 0.8.8f and so I marked the cacti/spine packages as on hold so they never get updated just in case the distributor does include a new version. Then I download using If you are using Spine, then it would depend on where on the system it is installed. For me, I create a git clone of the source, installed any libraries needed and then compiled. Once compiled, I then copied over to the location that the OS package had installed with originally to keep things working as they were. What operating system are you running on? |
I'm using RHEL 7, quite similar to Centos 7. Is there any constraint related to php version should I use for Cacti1.1.28? |
also |
SPINE installed under below path |
OK so the version of PHP shouldn't be a problem since the code takes care of minor differences where necessary. However, if you want more secure password storage, using the latest source with PHP 5.7 means that it can use password_hash/password_verify which are PHP's secure password management functions. For spine, there are other dependencies if you are installing from source. If you have compiled Spine before then you should already have the dependencies required. I have a sub directory with both Cacti and Spine underneath it using the following commands:
This will default to the Develop branch of the code, but you can keep with the stable release by using
In the To compile spine from the source, run
To compile and install Spine using MySQL versions previous to 5.5 please do the following:
If configure gives you any errors, this is normally down to missing dependencies, such as automake, autoconf, libssl-dev, etc.
Just remember those backups before you start as any upgrade progress can potentially go wrong. |
Thanks very much for support! I succeeded to upgrade Cacti to the latest software version 1.1.28. |
Alas, that may be one area that we can't resolve right now. Officially Weathermap doesn't support 1.x according to the home page, though I do recognise that you've had it working. There's been a re-write planned for the last year or two but so far, it's never quite been finished. The last commit to Master was back in May for the github project which is before that linked article... though the database-rewrite sub-project appears to have been active on Nov 4. You could ask the question over there, if there is a 1.x compatible release date, though it is a hobby project so could be a while yet. I was going to use it but until it properly supports 1.x I'm going to have to wait. |
Oh, and if you updated to the latest source, make sure you reapply that import fix I did. :) |
Already did, thanks! :) |
Making resolved thanks for all the good discussion and bug fix. |
Hi guys,
Could you please have a look on below issue?
All graphs and data queries used in this scenario are shared on github - link below:
https://github.com/rennancockles/cacti_huawei_templates ///I've shared the input info for a better view.
After succeeded to import data query file(huawei.xml) and make it functional(indexing are working), I tried to import graph templates Cacti - Huawei SFP.xml and Cacti - Huawei Interface Power (Rx_Tx).xml but, it has returned the error below:
The errors could be related to some fields that in meantime has been changed in Cacti database from my current Cacti version 1.1.2 to latest Cacti Version 1.1.28 and maybe the graph_template are newer released and fits with the latest cacti version(this is just an assumption).
I checked and the error is related to Column name which is null, for some reason, but nut sure how this could be solved.
Will appreciate any help. Thank you!
SQL:"INSERT INTO data_template (
id
,hash
,name
) VALUES (0, 'ab34c5cc314822ca3b456e8236f52fc2', NULL) ON DUPLICATE KEY UPDATEhash
=VALUES(hash
),name
=VALUES(name
)'2017-12-08 14:48:34 - CMDPHP ERROR: A DB Exec Failed!, Error: Column 'name' cannot be null
All error logs:
2017-12-08 14:48:34 - CMDPHP PHP ERROR NOTICE Backtrace: (/templates_import.php: 34 form_save)(/templates_import.php: 87 import_xml_data)(/lib/import.php: 75 CactiErrorHandler)(/lib/functions.php: 4295 cacti_debug_backtrace)
2017-12-08 14:48:34 - DBCALL ERROR: A DB Exec Failed!, Error:1048, SQL:"INSERT INTO data_template (
id
,hash
,name
) VALUES (0, 'ab34c5cc314822ca3b456e8236f52fc2', NULL) ON DUPLICATE KEY UPDATEhash
=VALUES(hash
),name
=VALUES(name
)'2017-12-08 14:48:34 - CMDPHP ERROR: A DB Exec Failed!, Error: Column 'name' cannot be null
2017-12-08 14:48:34 - CMDPHP SQL Backtrace: (/templates_import.php: 34 form_save)(/templates_import.php: 87 import_xml_data)(/lib/import.php: 82 xml_to_data_template)(/lib/import.php: 576 sql_save)(/lib/database.php: 943 _db_replace)(/lib/database.php: 890 db_execute)(/lib/database.php: 113 db_execute_prepared)(/lib/database.php: 178 cacti_debug_backtrace)
2017-12-08 14:48:34 - DBCALL ERROR: SQL Save Failed for Table 'data_template'. SQL:'INSERT INTO data_template (
id
,hash
,name
) VALUES (0, 'ab34c5cc314822ca3b456e8236f52fc2', NULL) ON DUPLICATE KEY UPDATEhash
=VALUES(hash
),name
=VALUES(name
)'2017-12-08 14:48:34 - ERROR PHP NOTICE: Undefined index: in file: /var/www/html/cacti/lib/import.php on line: 72
2017-12-08 14:48:34 - CMDPHP PHP ERROR NOTICE Backtrace: (/templates_import.php: 34 form_save)(/templates_import.php: 87 import_xml_data)(/lib/import.php: 72 CactiErrorHandler)(/lib/functions.php: 4295 cacti_debug_backtrace)
2017-12-08 14:48:34 - ERROR PHP NOTICE: Undefined index: in file: /var/www/html/cacti/lib/import.php on line: 75
2017-12-08 14:48:34 - CMDPHP PHP ERROR NOTICE Backtrace: (/templates_import.php: 34 form_save)(/templates_import.php: 87 import_xml_data)(/lib/import.php: 75 CactiErrorHandler)(/lib/functions.php: 4295 cacti_debug_backtrace)
2017-12-08 14:48:34 - ERROR PHP NOTICE: Undefined index: hash_015540f96a3051dcbecbf8b402d05a848e in file: /var/www/html/cacti/lib/import.php on line: 75
2017-12-08 14:48:34 - CMDPHP PHP ERROR NOTICE Backtrace: (/templates_import.php: 34 form_save)(/templates_import.php: 87 import_xml_data)(/lib/import.php: 75 CactiErrorHandler)(/lib/functions.php: 4295 cacti_debug_backtrace)
2017-12-08 14:48:34 - DBCALL ERROR: A DB Exec Failed!, Error:1048, SQL:"INSERT INTO data_template (
id
,hash
,name
) VALUES (0, '5540f96a3051dcbecbf8b402d05a848e', NULL) ON DUPLICATE KEY UPDATEhash
=VALUES(hash
),name
=VALUES(name
)'2017-12-08 14:48:34 - CMDPHP ERROR: A DB Exec Failed!, Error: Column 'name' cannot be null
2017-12-08 14:48:34 - CMDPHP SQL Backtrace: (/templates_import.php: 34 form_save)(/templates_import.php: 87 import_xml_data)(/lib/import.php: 82 xml_to_data_template)(/lib/import.php: 576 sql_save)(/lib/database.php: 943 _db_replace)(/lib/database.php: 890 db_execute)(/lib/database.php: 113 db_execute_prepared)(/lib/database.php: 178 cacti_debug_backtrace)
2017-12-08 14:48:34 - DBCALL ERROR: SQL Save Failed for Table 'data_template'. SQL:'INSERT INTO data_template (
id
,hash
,name
) VALUES (0, '5540f96a3051dcbecbf8b402d05a848e', NULL) ON DUPLICATE KEY UPDATEhash
=VALUES(hash
),name
=VALUES(name
)'2017-12-08 14:48:34 - ERROR PHP NOTICE: Undefined index: in file: /var/www/html/cacti/lib/import.php on line: 72
2017-12-08 14:48:34 - CMDPHP PHP ERROR NOTICE Backtrace: (/templates_import.php: 34 form_save)(/templates_import.php: 87 import_xml_data)(/lib/import.php: 72 CactiErrorHandler)(/lib/functions.php: 4295 cacti_debug_backtrace)
2017-12-08 14:48:34 - ERROR PHP NOTICE: Undefined index: in file: /var/www/html/cacti/lib/import.php on line: 75
2017-12-08 14:48:34 - CMDPHP PHP ERROR NOTICE Backtrace: (/templates_import.php: 34 form_save)(/templates_import.php: 87 import_xml_data)(/lib/import.php: 75 CactiErrorHandler)(/lib/functions.php: 4295 cacti_debug_backtrace)
2017-12-08 14:48:34 - ERROR PHP NOTICE: Undefined index: hash_01823d80e868528523498eadda29620a19 in file: /var/www/html/cacti/lib/import.php on line: 75
2017-12-08 14:48:34 - CMDPHP PHP ERROR NOTICE Backtrace: (/templates_import.php: 34 form_save)(/templates_import.php: 87 import_xml_data)(/lib/import.php: 75 CactiErrorHandler)(/lib/functions.php: 4295 cacti_debug_backtrace)
2017-12-08 14:48:34 - DBCALL ERROR: A DB Exec Failed!, Error:1048, SQL:"INSERT INTO data_template (
id
,hash
,name
) VALUES (0, '823d80e868528523498eadda29620a19', NULL) ON DUPLICATE KEY UPDATEhash
=VALUES(hash
),name
=VALUES(name
)'2017-12-08 14:48:34 - CMDPHP ERROR: A DB Exec Failed!, Error: Column 'name' cannot be null
2017-12-08 14:48:34 - CMDPHP SQL Backtrace: (/templates_import.php: 34 form_save)(/templates_import.php: 87 import_xml_data)(/lib/import.php: 82 xml_to_data_template)(/lib/import.php: 576 sql_save)(/lib/database.php: 943 _db_replace)(/lib/database.php: 890 db_execute)(/lib/database.php: 113 db_execute_prepared)(/lib/database.php: 178 cacti_debug_backtrace)
2017-12-08 14:48:34 - DBCALL ERROR: SQL Save Failed for Table 'data_template'. SQL:'INSERT INTO data_template (
id
,hash
,name
) VALUES (0, '823d80e868528523498eadda29620a19', NULL) ON DUPLICATE KEY UPDATEhash
=VALUES(hash
),name
=VALUES(name
)'2017-12-08 14:48:34 - ERROR PHP NOTICE: Undefined index: in file: /var/www/html/cacti/lib/import.php on line: 72
2017-12-08 14:48:34 - CMDPHP PHP ERROR NOTICE Backtrace: (/templates_import.php: 34 form_save)(/templates_import.php: 87 import_xml_data)(/lib/import.php: 72 CactiErrorHandler)(/lib/functions.php: 4295 cacti_debug_backtrace)
2017-12-08 14:48:34 - ERROR PHP NOTICE: Undefined index: in file: /var/www/html/cacti/lib/import.php on line: 75
2017-12-08 14:48:34 - CMDPHP PHP ERROR NOTICE Backtrace: (/templates_import.php: 34 form_save)(/templates_import.php: 87 import_xml_data)(/lib/import.php: 75 CactiErrorHandler)(/lib/functions.php: 4295 cacti_debug_backtrace)
2017-12-08 14:48:34 - ERROR PHP NOTICE: Undefined index: hash_01db2505b22d1296e20dca74832d36b2da in file: /var/www/html/cacti/lib/import.php on line: 75
2017-12-08 14:48:34 - CMDPHP PHP ERROR NOTICE Backtrace: (/templates_import.php: 34 form_save)(/templates_import.php: 87 import_xml_data)(/lib/import.php: 75 CactiErrorHandler)(/lib/functions.php: 4295 cacti_debug_backtrace)
2017-12-08 14:48:34 - DBCALL ERROR: A DB Exec Failed!, Error:1048, SQL:"INSERT INTO data_template (
id
,hash
,name
) VALUES (0, 'db2505b22d1296e20dca74832d36b2da', NULL) ON DUPLICATE KEY UPDATEhash
=VALUES(hash
),name
=VALUES(name
)'2017-12-08 14:48:34 - CMDPHP ERROR: A DB Exec Failed!, Error: Column 'name' cannot be null
2017-12-08 14:48:34 - CMDPHP SQL Backtrace: (/templates_import.php: 34 form_save)(/templates_import.php: 87 import_xml_data)(/lib/import.php: 82 xml_to_data_template)(/lib/import.php: 576 sql_save)(/lib/database.php: 943 _db_replace)(/lib/database.php: 890 db_execute)(/lib/database.php: 113 db_execute_prepared)(/lib/database.php: 178 cacti_debug_backtrace)
2017-12-08 14:48:34 - DBCALL ERROR: SQL Save Failed for Table 'data_template'. SQL:'INSERT INTO data_template (
id
,hash
,name
) VALUES (0, 'db2505b22d1296e20dca74832d36b2da', NULL) ON DUPLICATE KEY UPDATEhash
=VALUES(hash
),name
=VALUES(name
)'2017-12-08 14:48:34 - ERROR PHP NOTICE: Undefined index: in file: /var/www/html/cacti/lib/import.php on line: 72
2017-12-08 14:48:34 - CMDPHP PHP ERROR NOTICE Backtrace: (/templates_import.php: 34 form_save)(/templates_import.php: 87 import_xml_data)(/lib/import.php: 72 CactiErrorHandler)(/lib/functions.php: 4295 cacti_debug_backtrace)
2017-12-08 14:48:34 - ERROR PHP NOTICE: Undefined index: in file: /var/www/html/cacti/lib/import.php on line: 75
2017-12-08 14:48:34 - CMDPHP PHP ERROR NOTICE Backtrace: (/templates_import.php: 34 form_save)(/templates_import.php: 87 import_xml_data)(/lib/import.php: 75 CactiErrorHandler)(/lib/functions.php: 4295 cacti_debug_backtrace)
2017-12-08 14:48:34 - ERROR PHP NOTICE: Undefined index: hash_003937a3ed866eb41ffb2c05ec922eeb39 in file: /var/www/html/cacti/lib/import.php on line: 75
2017-12-08 14:48:34 - CMDPHP PHP ERROR NOTICE Backtrace: (/templates_import.php: 34 form_save)(/templates_import.php: 87 import_xml_data)(/lib/import.php: 75 CactiErrorHandler)(/lib/functions.php: 4295 cacti_debug_backtrace)
2017-12-08 14:48:34 - DBCALL ERROR: A DB Exec Failed!, Error:1048, SQL:"INSERT INTO graph_templates (
id
,hash
,name
) VALUES (0, '3937a3ed866eb41ffb2c05ec922eeb39', NULL) ON DUPLICATE KEY UPDATEhash
=VALUES(hash
),name
=VALUES(name
)'2017-12-08 14:48:34 - CMDPHP ERROR: A DB Exec Failed!, Error: Column 'name' cannot be null
2017-12-08 14:48:34 - CMDPHP SQL Backtrace: (/templates_import.php: 34 form_save)(/templates_import.php: 87 import_xml_data)(/lib/import.php: 79 xml_to_graph_template)(/lib/import.php: 290 sql_save)(/lib/database.php: 943 _db_replace)(/lib/database.php: 890 db_execute)(/lib/database.php: 113 db_execute_prepared)(/lib/database.php: 178 cacti_debug_backtrace)
2017-12-08 14:48:34 - DBCALL ERROR: SQL Save Failed for Table 'graph_templates'. SQL:'INSERT INTO graph_templates (
id
,hash
,name
) VALUES (0, '3937a3ed866eb41ffb2c05ec922eeb39', NULL) ON DUPLICATE KEY UPDATEhash
=VALUES(hash
),name
=VALUES(name
)'2017-12-08 14:48:34 - ERROR PHP NOTICE: Undefined index: in file: /var/www/html/cacti/lib/import.php on line: 72
2017-12-08 14:48:34 - CMDPHP PHP ERROR NOTICE Backtrace: (/templates_import.php: 34 form_save)(/templates_import.php: 87 import_xml_data)(/lib/import.php: 72 CactiErrorHandler)(/lib/functions.php: 4295 cacti_debug_backtrace)
2017-12-08 14:48:34 - ERROR PHP NOTICE: Undefined index: in file: /var/www/html/cacti/lib/import.php on line: 75
2017-12-08 14:48:34 - CMDPHP PHP ERROR NOTICE Backtrace: (/templates_import.php: 34 form_save)(/templates_import.php: 87 import_xml_data)(/lib/import.php: 75 CactiErrorHandler)(/lib/functions.php: 4295 cacti_debug_backtrace)
2017-12-08 14:48:34 - ERROR PHP NOTICE: Undefined index: hash_20d62c52891f4f9688729a5bc9fad91b18 in file: /var/www/html/cacti/lib/import.php on line: 75
2017-12-08 14:48:34 - CMDPHP PHP ERROR NOTICE Backtrace: (/templates_import.php: 34 form_save)(/templates_import.php: 87 import_xml_data)(/lib/import.php: 75 CactiErrorHandler)(/lib/functions.php: 4295 cacti_debug_backtrace)
2017-12-08 14:48:34 - CMDPHP IMPORT NOTE: Repairing 1 Damaged data_input_fields
2017-12-08 14:48:34 - CMDPHP WARNING: Could not find Cacti default matching hash for unknown system hash "35637c344d84d8aa3a4dc50e4a120b3f" for 1. No repair performed.
The text was updated successfully, but these errors were encountered: