Cacti / plugin_thold

Thold Plugin for Cacti
GNU General Public License v2.0
68 stars 63 forks source link

Thresholds are not being created in 1.2.3 #287

Closed stormonts closed 5 years ago

stormonts commented 5 years ago

Upgraded to Cacti 1.2.3 and thresholds are no longer being automatically created. I am also seeing these errors in the logs:

2019/04/02 15:42:09 - CMDPHP PHP ERROR WARNING Backtrace: (/poller.php[676]:process_poller_output(), /lib/poller.php[532]:api_plugin_hook_function(), /lib/plugins.php[114]:api_plugin_run_plugin_hook_function(), /lib/plugins.php[221]:thold_poller_output(), /plugins/thold/includes/polling.php[368]:thold_calculate_percent(), /plugins/thold/thold_functions.php[1126]:CactiErrorHandler()) 2019/04/02 15:42:09 - ERROR PHP WARNING in Plugin 'thold': A non-numeric value encountered in file: /usr/local/cacti-1.2.3/plugins/thold/thold_functions.php on line: 1126 2019/04/02 15:42:09 - CMDPHP PHP ERROR WARNING Backtrace: (/poller.php[676]:process_poller_output(), /lib/poller.php[532]:api_plugin_hook_function(), /lib/plugins.php[114]:api_plugin_run_plugin_hook_function(), /lib/plugins.php[221]:thold_poller_output(), /plugins/thold/includes/polling.php[368]:thold_calculate_percent(), /plugins/thold/thold_functions.php[1126]:CactiErrorHandler()) 2019/04/02 15:42:09 - ERROR PHP WARNING in Plugin 'thold': A non-numeric value encountered in file: /usr/local/cacti-1.2.3/plugins/thold/thold_functions.php on line: 1126 2019/04/02 15:42:09 - CMDPHP PHP ERROR WARNING Backtrace: (/poller.php[676]:process_poller_output(), /lib/poller.php[532]:api_plugin_hook_function(), /lib/plugins.php[114]:api_plugin_run_plugin_hook_function(), /lib/plugins.php[221]:thold_poller_output(), /plugins/thold/includes/polling.php[368]:thold_calculate_percent(), /plugins/thold/thold_functions.php[1126]:CactiErrorHandler()) 2019/04/02 15:42:09 - ERROR PHP WARNING in Plugin 'thold': A non-numeric value encountered in file: /usr/local/cacti-1.2.3/plugins/thold/thold_functions.php on line: 1126

TheWitness commented 5 years ago

Update to the latest thold.

aleksandrpro commented 5 years ago

Same problem with manual thold creation. Cacti 1.2.3 and latest thold (cloned from git). Thold is created, but cacti.log has new errors:

2019/04/03 14:31:58 - CMDPHP SQL Backtrace: (/plugins/thold/thold.php[83]:thold_add(), /plugins/thold/thold.php[194]:thold_wizard(), /plugins/thold/thold_webapi.php[707]:draw_edit_form(), /lib/html_form.php[112]:draw_edit_control(), /lib/html_form.php[302]:form_callback(), /lib/html_form.php[808]:db_fetch_assoc(), /lib/database.php[448]:db_fetch_assoc_prepared(), /lib/database.php[462]:db_execute_prepared()) 2019/04/03 14:31:58 - CMDPHP ERROR: A DB Row Failed!, Error: Unknown column 'name' in 'field list' 2019/04/03 14:31:50 - CMDPHP SQL Backtrace: (/plugins/thold/thold.php[83]:thold_add(), /plugins/thold/thold.php[191]:thold_add_graphs_action_prepare(), /plugins/thold/thold_webapi.php[171]:thold_wizard(), /plugins/thold/thold_webapi.php[707]:draw_edit_form(), /lib/html_form.php[112]:draw_edit_control(), /lib/html_form.php[302]:form_callback(), /lib/html_form.php[808]:db_fetch_assoc(), /lib/database.php[448]:db_fetch_assoc_prepared(), /lib/database.php[462]:db_execute_prepared()) 2019/04/03 14:31:50 - CMDPHP ERROR: A DB Row Failed!, Error: Unknown column 'name' in 'field list'

DB data: mysql> select * from thold_data\G; *************************** 1. row *************************** id: 14 name: |data_source_description| name_cache: csit-s1 - Status - 1/3 local_data_id: 3061 data_template_rrd_id: 7781 local_graph_id: 3029 graph_template_id: 41 data_template_id: 52 data_template_hash: data_source_name: int_status thold_hi: 1 thold_low: thold_fail_trigger: 1 thold_fail_count: 0 time_hi: time_low: time_fail_trigger: 1 time_fail_length: 1 thold_warning_hi: thold_warning_low: thold_warning_fail_trigger: 1 thold_warning_fail_count: 0 time_warning_hi: time_warning_low: time_warning_fail_trigger: 1 time_warning_fail_length: 1 thold_alert: 0 prev_thold_alert: 0 thold_enabled: on thold_type: 0 bl_ref_time_range: 86400 bl_pct_down: bl_pct_up: bl_fail_trigger: 2 bl_fail_count: NULL bl_alert: 0 bl_thold_valid: 0 lastread: 1 lasttime: 2019-04-03 14:50:11 lastchanged: 0000-00-00 00:00:00 oldvalue: 1 repeat_alert: 288 notify_extra: notify_warning_extra: notify_warning: 0 notify_alert: 1 snmp_event_category: snmp_event_severity: 4 snmp_event_warning_severity: 3 thold_daemon_pid: host_id: 0 syslog_priority: 3 syslog_facility: 0 syslog_enabled: data_type: 0 cdef: 0 percent_ds: expression: thold_template_id: 0 template_enabled: tcheck: 1 exempt: acknowledgment: thold_hrule_alert: 0 thold_hrule_warning: 0 restored_alert: reset_ack: persist_ack: email_body: email_body_warn: trigger_cmd_high: trigger_cmd_low: trigger_cmd_norm: notes: 1 row in set (0.00 sec)

After a poller run thold disapper from list. 2019/04/03 14:35:23 - SYSTEM THOLD STATS: Time:0.0093 Tholds:0 TotalDevices:58 DownDevices:5 NewDownDevices:0

mysql> select count(*) from thold_data; +----------+ | count(*) | +----------+ | 0 | +----------+

TheWitness commented 5 years ago

This issue is resolved. Only happens in the classic theme.

aleksandrpro commented 5 years ago

There is no more DB errors but all tholds still disappear from thold_data table after poller run.

TheWitness commented 5 years ago

Interesting. Can you post the data in the thold_data table when it's there after the latest set of changes?

TheWitness commented 5 years ago

I've just made an update here. https://github.com/Cacti/plugin_thold/commit/d03b6fc6106adfde1fc47f900a68803cec0568df

aleksandrpro commented 5 years ago

Interesting. Can you post the data in the thold_data table when it's there after the latest set of changes?

mysql> select * from thold_data\G *************************** 1. row *************************** id: 5 name: |data_source_description| name_cache: csit-s1 - Status - 1/3 local_data_id: 3061 data_template_rrd_id: 7781 local_graph_id: 3029 graph_template_id: 41 data_template_id: 52 data_template_hash: data_source_name: int_status thold_hi: 1 thold_low: thold_fail_trigger: 1 thold_fail_count: 0 time_hi: time_low: time_fail_trigger: 1 time_fail_length: 1 thold_warning_hi: thold_warning_low: thold_warning_fail_trigger: 1 thold_warning_fail_count: 0 time_warning_hi: time_warning_low: time_warning_fail_trigger: 1 time_warning_fail_length: 1 thold_alert: 0 prev_thold_alert: 0 thold_enabled: on thold_type: 0 bl_ref_time_range: 86400 bl_pct_down: bl_pct_up: bl_fail_trigger: 2 bl_fail_count: NULL bl_alert: 0 bl_thold_valid: 0 lastread: NULL lasttime: 0000-00-00 00:00:00 lastchanged: 0000-00-00 00:00:00 oldvalue: NULL repeat_alert: 288 notify_extra: notify_warning_extra: notify_warning: 0 notify_alert: 1 snmp_event_category: snmp_event_severity: 4 snmp_event_warning_severity: 3 thold_daemon_pid: host_id: 0 syslog_priority: 3 syslog_facility: 0 syslog_enabled: data_type: 0 cdef: 0 percent_ds: expression: thold_template_id: 0 template_enabled: tcheck: 0 exempt: acknowledgment: thold_hrule_alert: 0 thold_hrule_warning: 0 restored_alert: reset_ack: persist_ack: email_body: email_body_warn: trigger_cmd_high: trigger_cmd_low: trigger_cmd_norm: notes: 1 row in set (0.00 sec)

aleksandrpro commented 5 years ago

I've just made an update here. d03b6fc

Cacti Log after opening thold page: 2019/04/10 17:25:34 - CMDPHP SQL Backtrace: (/plugins/thold/thold_graph.php[39]:delete_old_thresholds(), /plugins/thold/thold_functions.php[3610]:db_fetch_assoc(), /lib/database.php[448]:db_fetch_assoc_prepared(), /lib/database.php[462]:db_execute_prepared()) 2019/04/10 17:25:34 - CMDPHP ERROR: A DB Row Failed!, Error: Unknown column 'dtr.local_graph_id' in 'where clause'

TheWitness commented 5 years ago

Argh. I thought I had updated that. :)

TheWitness commented 5 years ago

Okay fixed that now.

aleksandrpro commented 5 years ago

Okay fixed that now.

No errors in log, still disappearing. DB data before poller run: mysql> select * from thold_data\G *************************** 1. row *************************** id: 7 name: |data_source_description| name_cache: s-s1 - Status - 8 local_data_id: 3040 data_template_rrd_id: 7732 local_graph_id: 3008 graph_template_id: 41 data_template_id: 52 data_template_hash: data_source_name: int_status thold_hi: 1 thold_low: thold_fail_trigger: 1 thold_fail_count: 0 time_hi: time_low: time_fail_trigger: 1 time_fail_length: 1 thold_warning_hi: thold_warning_low: thold_warning_fail_trigger: 1 thold_warning_fail_count: 0 time_warning_hi: time_warning_low: time_warning_fail_trigger: 1 time_warning_fail_length: 1 thold_alert: 0 prev_thold_alert: 0 thold_enabled: on thold_type: 0 bl_ref_time_range: 86400 bl_pct_down: bl_pct_up: bl_fail_trigger: 2 bl_fail_count: NULL bl_alert: 0 bl_thold_valid: 0 lastread: NULL lasttime: 0000-00-00 00:00:00 lastchanged: 0000-00-00 00:00:00 oldvalue: NULL repeat_alert: 288 notify_extra: notify_warning_extra: notify_warning: 0 notify_alert: 1 snmp_event_category: snmp_event_severity: 4 snmp_event_warning_severity: 3 thold_daemon_pid: host_id: 0 syslog_priority: 3 syslog_facility: 0 syslog_enabled: data_type: 0 cdef: 0 percent_ds: expression: thold_template_id: 0 template_enabled: tcheck: 0 exempt: acknowledgment: thold_hrule_alert: 0 thold_hrule_warning: 0 restored_alert: reset_ack: persist_ack: email_body: email_body_warn: trigger_cmd_high: trigger_cmd_low: trigger_cmd_norm: notes: 1 row in set (0.00 sec)

cigamit commented 5 years ago

So, looking at this. The only 'auto-delete' that happens is when the data_template_rrd_id in thold_data does not exist in the data_template_rrd table. I don't see that as happening unless you are removing the data source somehow.

aleksandrpro commented 5 years ago

Looks like this is an another problem...

mysql> select * from data_template_rrd where id=7732 limit 1\G *************************** 1. row *************************** id: 7732 hash: local_data_template_rrd_id: 7731 local_data_id: 3040 data_template_id: 52 t_rrd_maximum: rrd_maximum: U t_rrd_minimum: rrd_minimum: 0 t_rrd_heartbeat: rrd_heartbeat: 600 t_data_source_type_id: data_source_type_id: 1 t_data_source_name: data_source_name: int_status t_data_input_field_id: