Cacti / plugin_monitor

Monitor Plugin for Cacti
GNU General Public License v2.0
36 stars 39 forks source link

MySQL stric mode #141

Closed rem-lex closed 1 year ago

rem-lex commented 3 years ago

use last GIT version updated 2021-02-27

1) column 'monitor' in table 'host' created as NOT NULL but in add host SQL code it's seems like: 2021-02-27 23:49:55 - DBCALL ERROR: A DB Exec Failed!, Error: 1048, SQL: 'INSERT INTO host (id, host_template_id, poller_id, site_id, external_id, description, hostname, notes, location, snmp_version, snmp_community, snmp_username, snmp_password, snmp_auth_protocol, snmp_priv_passphrase, snmp_priv_protocol, snmp_context, snmp_engine_id, snmp_port, snmp_timeout, disabled, availability_method, ping_method, ping_port, ping_timeout, ping_retries, max_oids, device_threads, !>>>monitor<<<!, monitor_text, monitor_criticality, monitor_warn, monitor_alert) VALUES (0, 0, 1, 0, '', 'AAAtest', '192.168.1.20', '', '', 2, 'public', '', '', '', '', '', '', '', 161, 500, '', 3, 1, 23, 400, 4, 10, 1, !>>>NULL<<<!, '', 0, 0, 0) ON DUPLICATE KEY UPDATE host_template_id=VALUES(host_template_id), poller_id=VALUES(poller_id), site_id=VALUES(site_id), external_id=VALUES(external_id), description=VALUES(description), hostname=VALUES(hostname), notes=VALUES(notes), location=VALUES(location), snmp_version=VALUES(snmp_version), snmp_community=VALUES(snmp_community), snmp_username=VALUES(snmp_username), snmp_password=VALUES(snmp_password), snmp_auth_protocol=VALUES(snmp_auth_protocol), snmp_priv_passphrase=VALUES(snmp_priv_passphrase), snmp_priv_protocol=VALUES(snmp_priv_protocol), snmp_context=VALUES(snmp_context), snmp_engine_id=VALUES(snmp_engine_id), snmp_port=VALUES(snmp_port), snmp_timeout=VALUES(snmp_timeout), disabled=VALUES(disabled), availability_method=VALUES(availability_method), ping_method=VALUES(ping_method), ping_port=VALUES(ping_port), ping_timeout=VALUES(ping_timeout), ping_retries=VALUES(ping_retries), max_oids=VALUES(max_oids), device_threads=VALUES(device_threads), monitor=VALUES(monitor), monitor_text=VALUES(monitor_text), monitor_criticality=VALUES(monitor_criticality), monitor_warn=VALUES(monitor_warn), monitor_alert=VALUES(monitor_alert)' 2021-02-27 23:49:55 - CMDPHP ERROR: A DB Exec Failed!, Error: Column 'monitor' cannot be null see !>>>monitor<<<! and !>>>NULL<<<!, but it can't be NULL api_plugin_db_add_column('monitor', 'host', array('name' => 'monitor', 'type' => 'char(3)', 'NULL' => false, 'default' => 'on', 'after' => 'disabled'));

2) in setup.php at line 226, 232, 245, 252 and etc. like: UPDATE host SET monitor = "on" WHERE deleted = "" AND id = ?', why use "WHERE deleted" if use PRIMARY KEY "id"?

netniV commented 3 years ago

Because it prevents the system from activating monitoring on a device that has been marked for deletion.

netniV commented 3 years ago

With regards to the insert problem, that suggests you already have a monitor column with a null value.

TheWitness commented 1 year ago

This will be resolved in 2.6. It's currently fixed in develop.