Cacti / plugin_flowview

FlowView Plugin for Cacti
GNU General Public License v2.0
18 stars 10 forks source link

Update of august 9 5:15AM, many db_exec failed, after a view of a filter based on tcp source_port 8080 #196

Closed arno-st closed 3 months ago

arno-st commented 3 months ago

I was doing a search with a filter of type: SELECT * FROM plugin_flowview_queries WHERE (plugin_flowview_queries.id = 16) ; +----+---------------+-----------+-------------+---------+----------+------------------+------------------+-----------+----------+-----------+----------+------------+-----------------+----------+--------+----------+---------------+--------+------------+---------+-----------+-----------+-------------+--------------+---------+------------+--------------+-------------+-------------+---------------+-------------+ | id | name | device_id | template_id | ex_addr | timespan | startdate | enddate | tosfields | tcpflags | protocols | sourceip | sourceport | sourceinterface | sourceas | destip | destport | destinterface | destas | statistics | printed | includeif | sortfield | cutofflines | cutoffoctets | resolve | graph_type | graph_height | panel_table | panel_bytes | panel_packets | panel_flows | +----+---------------+-----------+-------------+---------+----------+------------------+------------------+-----------+----------+-----------+----------+------------+-----------------+----------+--------+----------+---------------+--------+------------+---------+-----------+-----------+-------------+--------------+---------+------------+--------------+-------------+-------------+---------------+-------------+ | 16 | Test http-alt | 0 | -1 | -1 | 0 | 2024-08-08 11:59 | 2024-08-08 12:29 | | | 6 | | 8080 | | | | | | | 0 | 0 | 1 | src_addr | 20 | 0 | Y | bar | 300 | | | | | +----+---------------+-----------+-------------+---------+----------+------------------+------------------+-----------+----------+-----------+----------+------------+-----------------+----------+--------+----------+---------------+--------+------------+---------+-----------+-----------+-------------+--------------+---------+------------+--------------+-------------+-------------+---------------+-------------+

And here is the log output: 09/08/2024 13:49:13 - DBCALL DEVEL: SQL Save on table 'parallel_database_query': 'a:11:{s:2:"id";i:0;s:6:"md5sum";s:32:"027bd811b502563c6138a81c545f4698";s:13:"md5sum_tables";s:32:"edd3e84043fecd9fa9fc59bc9199d428";s:7:"user_id";i:26;s:12:"total_shards";i:2;s:9:"map_query";s:490:"{"sql_query":"SELECT src_addr, src_port, protocol, dst_addr, dst_port, SUM(flows) AS flows, SUM(bytes) AS bytes, SUM(packets) AS packets, src_domain, dst_domain","sql_where":"WHERE ((src_addr& INET6_ATON(?) = INET6_ATON(?) ORsrc_addr& INET_ATON(?) = INET_ATON(?)))","sql_having":"","sql_order":"ORDER BY bytes DESC","sql_limit":"LIMIT 100","sql_groupby":"GROUP BY src_addr, src_port, protocol, dst_addr, dst_port","sql_params":["255.255.255.0","10.4.9.0","255.255.255.0","10.4.9.0"]}";s:9:"map_range";s:60:"(start_timeBETWEEN ? AND ? ORend_timeBETWEEN ? AND ?)";s:16:"map_range_params";s:89:"["2024-08-08 13:07:00","2024-08-09 13:07:00","2024-08-08 13:07:00","2024-08-09 13:07:00"]";s:12:"reduce_query";s:412:"{"sql_query":"SELECT INET6_NTOA(src_addr) AS src_addr, src_port, protocol, INET6_NTOA(dst_addr) AS dst_addr, dst_port, SUM(flows) AS flows, SUM(bytes) AS bytes, SUM(packets) AS packets, src_domain, dst_domain","sql_where":"","sql_having":"","sql_groupby":"GROUP BY INET6_NTOA(src_addr), src_port, protocol, INET6_NTOA(dst_addr), dst_port","sql_order":"ORDER BY bytes DESC","sql_limit":"LIMIT 20","sql_params":[]}";s:7:"created";s:19:"2024-08-09 13:49:13";s:12:"time_to_live";i:1723225753;}' 09/08/2024 13:49:10 - CMDPHP SQL Backtrace: (/plugins/flowview/flowview.php[91]:load_data_for_filter(), /plugins/flowview/functions.php[2086]:run_flow_query(), /plugins/flowview/functions.php[3326]:parallel_database_query_run(), /plugins/flowview/functions.php[4059]:flowview_db_execute(), /plugins/flowview/database.php[70]:db_execute(), /lib/database.php[385]:db_execute_prepared()) 09/08/2024 13:49:10 - CMDPHP ERROR: A DB Exec Failed!, Error: Unknown table 'flow_test.parallel_database_query_temp_1723204150' 09/08/2024 13:49:10 - DBCALL ERROR: A DB Exec Failed!, Error: 1051, SQL: 'DROP TEMPORARY TABLE parallel_database_query_temp_1723204150' 09/08/2024 13:49:10 - CMDPHP SQL Backtrace: (/plugins/flowview/flowview.php[91]:load_data_for_filter(), /plugins/flowview/functions.php[2086]:run_flow_query(), /plugins/flowview/functions.php[3326]:parallel_database_query_run(), /plugins/flowview/functions.php[4055]:flowview_db_fetch_assoc_prepared(), /plugins/flowview/database.php[182]:db_fetch_assoc_prepared(), /lib/database.php[727]:db_execute_prepared()) 09/08/2024 13:49:10 - CMDPHP ERROR: A DB Row Failed!, Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM parallel_database_query_temp_1723204150 LIMIT 20' at line 1 09/08/2024 13:49:10 - DBCALL ERROR: A DB Row Failed!, Error: 1064, SQL: ' FROM parallel_database_query_temp_1723204150 LIMIT 20' 09/08/2024 13:49:10 - CMDPHP SQL Backtrace: (/plugins/flowview/flowview.php[91]:load_data_for_filter(), /plugins/flowview/functions.php[2086]:run_flow_query(), /plugins/flowview/functions.php[3326]:parallel_database_query_run(), /plugins/flowview/functions.php[4004]:flowview_db_execute(), /plugins/flowview/database.php[70]:db_execute(), /lib/database.php[385]:db_execute_prepared()) 09/08/2024 13:49:10 - CMDPHP ERROR: A DB Exec Failed!, Error: Incorrect column name '' 09/08/2024 13:49:10 - DBCALL ERROR: A DB Exec Failed!, Error: 1166, SQL: 'CREATE TEMPORARY TABLE IF NOT EXISTS parallel_database_query_temp_1723204150 (`` bigint unsigned NOT NULL default "0") ENGINE=Aria ROW_FORMAT=PAGE COMMENT="Holds Parallel Query Results"' 09/08/2024 13:49:10 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/flowview/flowview.php[91]:load_data_for_filter(), /plugins/flowview/functions.php[2086]:run_flow_query(), /plugins/flowview/functions.php[3284]:CactiErrorHandler()) 09/08/2024 13:49:10 - ERROR PHP WARNING in Plugin 'flowview': Undefined variable $request_type in file: /usr/share/cacti/plugins/flowview/functions.php on line: 3284 09/08/2024 13:49:10 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/flowview/flowview.php[91]:load_data_for_filter(), /plugins/flowview/functions.php[2086]:run_flow_query(), /plugins/flowview/functions.php[3279]:CactiErrorHandler()) 09/08/2024 13:49:10 - ERROR PHP WARNING in Plugin 'flowview': Undefined variable $sql_order in file: /usr/share/cacti/plugins/flowview/functions.php on line: 3279 09/08/2024 13:49:10 - CMDPHP PHP ERROR Backtrace: (/plugins/flowview/flowview.php[91]:load_data_for_filter(), /plugins/flowview/functions.php[2086]:run_flow_query(), /plugins/flowview/functions.php[3185]:str_replace(), CactiErrorHandler()) 09/08/2024 13:49:10 - ERROR PHP DEPRECATED in Plugin 'flowview': str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in file: /usr/share/cacti/plugins/flowview/functions.php on line: 3185 09/08/2024 13:49:10 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/flowview/flowview.php[91]:load_data_for_filter(), /plugins/flowview/functions.php[2086]:run_flow_query(), /plugins/flowview/functions.php[3185]:CactiErrorHandler()) 09/08/2024 13:49:10 - ERROR PHP WARNING in Plugin 'flowview': Undefined variable $sql_inner_groupby2 in file: /usr/share/cacti/plugins/flowview/functions.php on line: 3185 09/08/2024 13:49:10 - CMDPHP PHP ERROR Backtrace: (/plugins/flowview/flowview.php[91]:load_data_for_filter(), /plugins/flowview/functions.php[2086]:run_flow_query(), /plugins/flowview/functions.php[3184]:str_replace(), CactiErrorHandler()) 09/08/2024 13:49:10 - ERROR PHP DEPRECATED in Plugin 'flowview': str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in file: /usr/share/cacti/plugins/flowview/functions.php on line: 3184 09/08/2024 13:49:10 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/flowview/flowview.php[91]:load_data_for_filter(), /plugins/flowview/functions.php[2086]:run_flow_query(), /plugins/flowview/functions.php[3184]:CactiErrorHandler()) 09/08/2024 13:49:10 - ERROR PHP WARNING in Plugin 'flowview': Undefined variable $sql_inner_groupby1 in file: /usr/share/cacti/plugins/flowview/functions.php on line: 3184 09/08/2024 13:49:10 - CMDPHP PHP ERROR Backtrace: (/plugins/flowview/flowview.php[91]:load_data_for_filter(), /plugins/flowview/functions.php[2086]:run_flow_query(), /plugins/flowview/functions.php[3183]:str_replace(), CactiErrorHandler()) 09/08/2024 13:49:10 - ERROR PHP DEPRECATED in Plugin 'flowview': str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in file: /usr/share/cacti/plugins/flowview/functions.php on line: 3183 09/08/2024 13:49:10 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/flowview/flowview.php[91]:load_data_for_filter(), /plugins/flowview/functions.php[2086]:run_flow_query(), /plugins/flowview/functions.php[3183]:CactiErrorHandler()) 09/08/2024 13:49:10 - ERROR PHP WARNING in Plugin 'flowview': Undefined variable $sql_groupby in file: /usr/share/cacti/plugins/flowview/functions.php on line: 3183 09/08/2024 13:49:10 - CMDPHP PHP ERROR Backtrace: (/plugins/flowview/flowview.php[91]:load_data_for_filter(), /plugins/flowview/functions.php[2086]:run_flow_query(), /plugins/flowview/functions.php[3181]:str_replace(), CactiErrorHandler()) 09/08/2024 13:49:10 - ERROR PHP DEPRECATED in Plugin 'flowview': str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in file: /usr/share/cacti/plugins/flowview/functions.php on line: 3181 09/08/2024 13:49:10 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/flowview/flowview.php[91]:load_data_for_filter(), /plugins/flowview/functions.php[2086]:run_flow_query(), /plugins/flowview/functions.php[3181]:CactiErrorHandler()) 09/08/2024 13:49:10 - ERROR PHP WARNING in Plugin 'flowview': Undefined variable $sql_inner2 in file: /usr/share/cacti/plugins/flowview/functions.php on line: 3181 09/08/2024 13:49:10 - CMDPHP PHP ERROR Backtrace: (/plugins/flowview/flowview.php[91]:load_data_for_filter(), /plugins/flowview/functions.php[2086]:run_flow_query(), /plugins/flowview/functions.php[3180]:str_replace(), CactiErrorHandler()) 09/08/2024 13:49:10 - ERROR PHP DEPRECATED in Plugin 'flowview': str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in file: /usr/share/cacti/plugins/flowview/functions.php on line: 3180 09/08/2024 13:49:10 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/flowview/flowview.php[91]:load_data_for_filter(), /plugins/flowview/functions.php[2086]:run_flow_query(), /plugins/flowview/functions.php[3180]:CactiErrorHandler()) 09/08/2024 13:49:10 - ERROR PHP WARNING in Plugin 'flowview': Undefined variable $sql_inner1 in file: /usr/share/cacti/plugins/flowview/functions.php on line: 3180 09/08/2024 13:49:10 - CMDPHP PHP ERROR Backtrace: (/plugins/flowview/flowview.php[91]:load_data_for_filter(), /plugins/flowview/functions.php[2086]:run_flow_query(), /plugins/flowview/functions.php[3179]:str_replace(), CactiErrorHandler()) 09/08/2024 13:49:10 - ERROR PHP DEPRECATED in Plugin 'flowview': str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in file: /usr/share/cacti/plugins/flowview/functions.php on line: 3179 09/08/2024 13:49:10 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/flowview/flowview.php[91]:load_data_for_filter(), /plugins/flowview/functions.php[2086]:run_flow_query(), /plugins/flowview/functions.php[3179]:CactiErrorHandler()) 09/08/2024 13:49:10 - ERROR PHP WARNING in Plugin 'flowview': Undefined variable $sql_query in file: /usr/share/cacti/plugins/flowview/functions.php on line: 3179

arno-st commented 3 months ago

Error is on my side, if the filter dosen't have report define, so that explain the error. It the case either way if you chose statistical or printed report

TheWitness commented 3 months ago

Yea, I've got it handled a bit better now.

TheWitness commented 3 months ago

If it's fixed, simply close this one.

arno-st commented 3 months ago

Well somehow you delete my pull request #197 And that give me some error again, and still the #196 is not resolved I got this error when I view all filter 12/08/2024 12:08:50 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/flowview/flowview_filters.php[68]:show_filters(), /plugins/flowview/flowview_filters.php[379]:CactiErrorHandler()) 12/08/2024 12:08:50 - ERROR PHP WARNING in Plugin 'flowview': Trying to access array offset on value of type null in file: /usr/share/cacti/plugins/flowview/flowview_filters.php on line: 379 12/08/2024 12:08:50 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/flowview/flowview_filters.php[68]:show_filters(), /plugins/flowview/flowview_filters.php[379]:CactiErrorHandler()) 12/08/2024 12:08:50 - ERROR PHP WARNING in Plugin 'flowview': Undefined array key 0 in file: /usr/share/cacti/plugins/flowview/flowview_filters.php on line: 379

And when i edit a filter without report I got this one:

12/08/2024 12:10:38 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/flowview/flowview_filters.php[59]:edit_filter(), /plugins/flowview/functions.php[225]:CactiErrorHandler())
12/08/2024 12:10:38 - ERROR PHP WARNING in Plugin 'flowview': Undefined array key 0 in file: /usr/share/cacti/plugins/flowview/functions.php on line: 225

I saw your code, but it

TheWitness commented 3 months ago

Which report?

arno-st commented 3 months ago

Well any report, either statistical or printed

I just arise when if you don't choose a report. 2024-08-12 15_34_41-Clipboard

I know it's not suppose to happen, but well, it's sometime ;)

TheWitness commented 3 months ago

Okay.

TheWitness commented 3 months ago

Okay, made a light edit.

TheWitness commented 3 months ago

This is good now.