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

Missing API include leads to runtime errors in Automation #3981

Closed
tersmitten opened this issue Dec 4, 2020 · 2 comments
Closed

Missing API include leads to runtime errors in Automation #3981

tersmitten opened this issue Dec 4, 2020 · 2 comments
Labels
bug Undesired behaviour resolved A fixed issue
Milestone

Comments

@tersmitten
Copy link
Contributor

Describe the bug

add_graph_template.php throws a PHP Fatal error about an undefined function api_data_source_cache_crc_update.

To Reproduce

# echo 'SELECT `id` FROM `host` WHERE `id` IN (37);' | \
> mysql --skip-column-names cacti | \
> while read -r hostIds; do
>  hostId="${hostIds}";
>  
>  # 9.  Percona Apache Server HT
>  for hostTemplateId in 9; do
>    echo 'SELECT `graph_template_id` FROM `host_template_graph` WHERE `host_template_id` = '"${hostTemplateId}"';' | \
>    mysql --skip-column-names cacti | \
>    while read -r graphTemplateIds; do
>      graphTemplateId="${graphTemplateIds}";
> 
>      php add_graph_template.php --host-id="${hostId}" --graph-template-id="${graphTemplateId}";
>    done
>  done
> done
PHP Fatal error:  Uncaught Error: Call to undefined function api_data_source_cache_crc_update() in /var/lib/ansible/cacti-server/checkouts/cacti/lib/utility.php:753
Stack trace:
#0 /var/lib/ansible/cacti-server/checkouts/cacti/lib/api_automation.php(2261): push_out_host('37', '1755')
#1 /var/lib/ansible/cacti-server/checkouts/cacti/lib/api_automation.php(2121): automation_execute_graph_template('37', '35')
#2 /var/lib/ansible/cacti-server/checkouts/cacti/cli/add_graph_template.php(149): automation_hook_graph_template('37', '35')
#3 {main}
  thrown in /var/lib/ansible/cacti-server/checkouts/cacti/lib/utility.php on line 753
PHP Fatal error:  Uncaught Error: Call to undefined function api_data_source_cache_crc_update() in /var/lib/ansible/cacti-server/checkouts/cacti/lib/utility.php:753
Stack trace:
#0 /var/lib/ansible/cacti-server/checkouts/cacti/lib/api_automation.php(2261): push_out_host('37', '1756')
#1 /var/lib/ansible/cacti-server/checkouts/cacti/lib/api_automation.php(2121): automation_execute_graph_template('37', '36')
#2 /var/lib/ansible/cacti-server/checkouts/cacti/cli/add_graph_template.php(149): automation_hook_graph_template('37', '36')
#3 {main}
  thrown in /var/lib/ansible/cacti-server/checkouts/cacti/lib/utility.php on line 753
PHP Fatal error:  Uncaught Error: Call to undefined function api_data_source_cache_crc_update() in /var/lib/ansible/cacti-server/checkouts/cacti/lib/utility.php:753
Stack trace:
#0 /var/lib/ansible/cacti-server/checkouts/cacti/lib/api_automation.php(2261): push_out_host('37', '1757')
#1 /var/lib/ansible/cacti-server/checkouts/cacti/lib/api_automation.php(2121): automation_execute_graph_template('37', '37')
#2 /var/lib/ansible/cacti-server/checkouts/cacti/cli/add_graph_template.php(149): automation_hook_graph_template('37', '37')
#3 {main}
  thrown in /var/lib/ansible/cacti-server/checkouts/cacti/lib/utility.php on line 753
PHP Fatal error:  Uncaught Error: Call to undefined function api_data_source_cache_crc_update() in /var/lib/ansible/cacti-server/checkouts/cacti/lib/utility.php:753
Stack trace:
#0 /var/lib/ansible/cacti-server/checkouts/cacti/lib/api_automation.php(2261): push_out_host('37', '1758')
#1 /var/lib/ansible/cacti-server/checkouts/cacti/lib/api_automation.php(2121): automation_execute_graph_template('37', '38')
#2 /var/lib/ansible/cacti-server/checkouts/cacti/cli/add_graph_template.php(149): automation_hook_graph_template('37', '38')
#3 {main}
  thrown in /var/lib/ansible/cacti-server/checkouts/cacti/lib/utility.php on line 753
PHP Fatal error:  Uncaught Error: Call to undefined function api_data_source_cache_crc_update() in /var/lib/ansible/cacti-server/checkouts/cacti/lib/utility.php:753
Stack trace:
#0 /var/lib/ansible/cacti-server/checkouts/cacti/lib/api_automation.php(2261): push_out_host('37', '1759')
#1 /var/lib/ansible/cacti-server/checkouts/cacti/lib/api_automation.php(2121): automation_execute_graph_template('37', '39')
#2 /var/lib/ansible/cacti-server/checkouts/cacti/cli/add_graph_template.php(149): automation_hook_graph_template('37', '39')
#3 {main}
  thrown in /var/lib/ansible/cacti-server/checkouts/cacti/lib/utility.php on line 753

Expected behavior

PHP Fatal error thrown

Additional context

OS: Ubuntu 16.04
PHP version: PHP 7.2
MySQL version: Percona Server 5.7
Cacti version: 1.2.16

@tersmitten tersmitten added bug Undesired behaviour unverified Some days we don't have a clue labels Dec 4, 2020
@TheWitness
Copy link
Member

Ugh.

@tersmitten
Copy link
Contributor Author

tersmitten commented Dec 4, 2020

Maybe a missing import of:

<?php
include_once($config['library_path'] . '/api_data_source.php');

@TheWitness TheWitness added resolved A fixed issue and removed unverified Some days we don't have a clue labels Dec 4, 2020
@TheWitness TheWitness added this to the v1.2.17 milestone Dec 4, 2020
@netniV netniV changed the title PHP Fatal error: Uncaught Error: Call to undefined function api_data_source_cache_crc_update() Fix undefined function api_data_source_cache_crc_update() when adding a graph template Jan 4, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Apr 5, 2021
@netniV netniV changed the title Fix undefined function api_data_source_cache_crc_update() when adding a graph template Misisng API include leads to runtime errors in Automation Apr 11, 2021
@netniV netniV changed the title Misisng API include leads to runtime errors in Automation Missing API include leads to runtime errors in Automation Apr 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

2 participants