Cacti / cacti

Cacti ™
http://www.cacti.net
GNU General Public License v2.0
1.63k stars 404 forks source link

External ID in Cacti #197

Closed interduo closed 7 years ago

interduo commented 7 years ago

Devices --> host.php

For integration purposes with other IT Systems please add a field to all devices whitch can carry common/collective External ID. It could be filed with autoincrement by default but it should be modificated.

In our company we use:

In past we used ID from host table from database but this was a bad way.

cigamit commented 7 years ago

The more I think about it, it seems like this would be better added as a simple plugin?

interduo commented 7 years ago

Why? This is only simple field without nothing special, only number and/or link.

cigamit commented 7 years ago

Either way, at the moment we are trying to focus on the release. We appreciate all your testing efforts. We will revisit this topic after the release. Again, thank you for all your assistance.

interduo commented 7 years ago

Ok - Our company also appreciate Your work. We use cacti since 2007r.

cigamit commented 7 years ago

Resolved, thanks for suggesting.

interduo commented 7 years ago

2017-03-13 11:03:51 - DBCALL ERROR: SQL Save Failed for Table 'host'. SQL:'INSERT INTO host (id, host_template_id, poller_id, site_id, external_id, description, hostname, notes, 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, thold_send_email, thold_host_email) VALUES (591, 17, 1, 1, '', 'P2P-18C-Jet', '172.20.201.11', '', 1, 'public', '', '', '', '', '', '', '', 161, 4000, '', 1, 2, 23, 2000, 2, 15, 1, 'on', '', 2, 0, 0, 1, 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), 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), thold_send_email=VALUES(thold_send_email), thold_host_email=VALUES(thold_host_email)' 2017-03-13 11:03:51 - CMDPHP SQL Backtrace: (/host.php: 53 form_save)(/host.php: 171 api_device_save)(/lib/api_device.php: 193 sql_save)(/lib/database.php: 943 _db_replace)(/lib/database.php: 890 db_execute)(/lib/database.php: 113 db_execute_prepared)(/lib/database.php: 178 cacti_debug_backtrace) 2017-03-13 11:03:51 - CMDPHP ERROR: A DB Exec Failed!, Error: Unknown column 'external_id' in 'field list' 2017-03-13 11:03:51 - DBCALL ERROR: A DB Exec Failed!, Error:1054, SQL:"INSERT INTO host (id, host_template_id, poller_id, site_id, external_id, description, hostname, notes, 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, thold_send_email, thold_host_email) VALUES (591, 17, 1, 1, '', 'XXXXXXXXXXXx', 'XXXXXXXXXXXXXXx', '', 1, 'public', '', '', '', '', '', '', '', 161, 4000, '', 1, 2, 23, 2000, 2, 15, 1, 'on', '', 2, 0, 0, 1, 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), 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), thold_send_email=VALUES(thold_send_email), thold_host_email=VALUES(thold_host_email)' 2017-03-13 11:03:51 - CMDPHP PHP ERROR NOTICE Backtrace: (/host.php: 53 form_save)(/host.php: 171 api_device_save)(/lib/api_device.php: 193 sql_save)(/lib/database.php: 920 CactiErrorHandler)(/lib/functions.php: 4265 cacti_debug_backtrace) 2017-03-13 11:03:51 - ERROR PHP NOTICE: Undefined index: external_id in file: /var/www/html/cacti/lib/database.php on line: 920 2017-03-13 11:03:51 - CMDPHP PHP ERROR NOTICE Backtrace: (/host.php: 53 form_save)(/host.php: 171 api_device_save)(/lib/api_device.php: 193 sql_save)(/lib/database.php: 919 CactiErrorHandler)(/lib/functions.php: 4265 cacti_debug_backtrace) 2017-03-13 11:03:51 - ERROR PHP NOTICE: Undefined index: external_id in file: /var/www/html/cacti/lib/database.php on line: 919 2017-03-13 11:03:51 - CMDPHP PHP ERROR NOTICE Backtrace: (/host.php: 53 form_save)(/host.php: 171 api_device_save)(/lib/api_device.php: 193 sql_save)(/lib/database.php: 918 CactiErrorHandler)(/lib/functions.php: 4265 cacti_debug_backtrace) 2017-03-13 11:03:51 - ERROR PHP NOTICE: Undefined index: external_id in file: /var/www/html/cacti/lib/database.php on line: 918 2017-03-13 11:03:51 - CMDPHP PHP ERROR NOTICE Backtrace: (/host.php: 53 form_save)(/host.php: 171 api_device_save)(/lib/api_device.php: 193 sql_save)(/lib/database.php: 917 CactiErrorHandler)(/lib/functions.php: 4265 cacti_debug_backtrace) 2017-03-13 11:03:51 - ERROR PHP NOTICE: Undefined index: external_id in file: /var/www/html/cacti/lib/database.php on line: 917

cigamit commented 7 years ago

If you were running the development version, you have to rerun the database upgrade.

interduo commented 7 years ago

How to do this in most easy way?

Downgrade version of DB in mysql or run something from cli?

cigamit commented 7 years ago

ALTER TABLE host ADD column external_id VARCHAR(40) DEFAULT NULL AFTER notes, ADD INDEX external_id(external_id);