Closed gundalba closed 6 years ago
I was about to say this is a duplicate then I remembered that I'd seen this on the forums not here 👍
So I've checked 1.1.35 and that should have had exactly the same issue as any of the later versions with api_device_save(). It expects device threads, which mactrack isn't providing. I will have to double check the mactrack code tomorrow and see if it can provide that, otherwise it'll have to default it to 1.
OK, so I've checked 1.2 already has this fixed. To fix it in 1.1.37, you will need to add an = 1 to the api_device_save() function's device_threads parameter:
diff --git a/lib/api_device.php b/lib/api_device.php
index dc275b2..818e70b 100644
--- a/lib/api_device.php
+++ b/lib/api_device.php
@@ -166,7 +166,7 @@ function api_device_gt_remove($device_id, $graph_template_id) {
function api_device_save($id, $host_template_id, $description, $hostname, $snmp_community, $snmp_version,
$snmp_username, $snmp_password, $snmp_port, $snmp_timeout, $disabled,
$availability_method, $ping_method, $ping_port, $ping_timeout, $ping_retries,
- $notes, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_engine_id, $max_oids, $device_threads, $poller_id = 1, $site_id = 1, $external_id = '') {
+ $notes, $snmp_auth_protocol, $snmp_priv_passphrase, $snmp_priv_protocol, $snmp_context, $snmp_engine_id, $max_oids, $device_threads = 1, $poller_id = 1, $site_id = 1, $external_id = '') {
global $config;
include_once($config['base_path'] . '/lib/utility.php');
Thank you, that fix rid of the error. Though there still seem to be other issue(s) as I try to save a MacTrack device, I am seeing following in the log; May be I should open another report on this???
2018/05/03 09:00:30 - SYSTEM DSSTATS STATS: Type:HOURLY, Time:0.0479 2018/05/03 09:01:16 - ERROR PHP ERROR: Call to undefined function api_data_source_cache_crc_update() in file: /usr/share/cacti/lib/utility.php on line: 658 2018/05/03 09:01:16 - CMDPHP PHP ERROR Backtrace: (CactiShutdownHandler)(/lib/functions.php: 4628 cacti_debug_backtrace) 2018/05/03 09:02:35 - ERROR PHP ERROR: Call to undefined function api_data_source_cache_crc_update() in file: /usr/share/cacti/lib/utility.php on line: 658 2018/05/03 09:02:35 - CMDPHP PHP ERROR Backtrace: (CactiShutdownHandler)(/lib/functions.php: 4628 cacti_debug_backtrace)
That should be reported on the main Cacti repository.
Ok will do. Thank you again for all your help!
Cheers,
OS: CentOS 7 Cacti : 1.1.37 MACTrack: 4.2
Just got MACTrack (re)installed after Cacti upgrade (1.1.35 -> 1.1.37) and getting following errors. Could anyone help me get this running? Many thanks in advance..
2018/04/17 16:30:44 - ERROR PHP WARNING: Missing argument 24 for api_device_save(), called in /usr/share/cacti/plugins/mactrack/mactrack_actions.php on line 158 and defined in file: /usr/share/cacti/lib/api_device.php on line: 169 2018/04/17 16:30:44 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/mactrack/mactrack_devices.php: 44 form_mactrack_save)(/plugins/mactrack/mactrack_devices.php: 95 api_mactrack_device_save)(/plugins/mactrack/mactrack_actions.php: 69 sync_mactrack_to_cacti)(/plugins/mactrack/mactrack_actions.php: 158 api_device_save)(/lib/api_device.php: 169 CactiErrorHandler)(/lib/functions.php: 4585 cacti_debug_backtrace) 2018/04/17 16:30:44 - ERROR PHP NOTICE: Undefined variable: device_threads in file: /usr/share/cacti/lib/api_device.php on line: 233 2018/04/17 16:30:44 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/mactrack/mactrack_devices.php: 44 form_mactrack_save)(/plugins/mactrack/mactrack_devices.php: 95 api_mactrack_device_save)(/plugins/mactrack/mactrack_actions.php: 69 sync_mactrack_to_cacti)(/plugins/mactrack/mactrack_actions.php: 158 api_device_save)(/lib/api_device.php: 233 CactiErrorHandler)(/lib/functions.php: 4590 cacti_debug_backtrace) 2018/04/17 16:30:45 - ERROR PHP ERROR: Call to undefined function api_data_source_cache_crc_update() in file: /usr/share/cacti/lib/utility.php on line: 658 2018/04/17 16:30:45 - CMDPHP PHP ERROR Backtrace: (CactiShutdownHandler)(/lib/functions.php: 4628 cacti_debug_backtrace)