Closed AlbertYangXY closed 4 years ago
Well, that is very odd. It's trying to save a text value of 'net-snmp' instead of 1, 2, or 3. Not sure how that is happening. Will have to check it out. Can you please update to the 1.2.x branch and test again?
I used your example, and could not duplicate. Can you please check the value of 'snmp_version' in your Cacti settings table?
SELECT value FROM settings WHERE name='snmp_version';
Should be either 0, 1, 2, or 3. This might be your problem. Seems odd. Maybe one of your plugins is leveraging the 'snmp_version' setting and overloading it with what it's used for in Cacti 1.2.x. Oh, geeze that is what it is. In Cacti 0.8.x, we used snmp_version for 'ucd-snmp' or 'net-snmp'. Wow, a long time ago. I'll make an update to add_devices.php, but just goto Configuration > Settings > Device Defaults and 'save'. Then, for you the problem will be corrected.
Should be resolved in 1.2.8. At least you will get an error.
I do it by executing php add_device.php --description=w02v.game.1311.com --ip=10.117.109.84 --template=9 --avail='ping' --proxy
It returns Success - new device-id: (0)
The cacti.log is as follows: 2019/11/28 22:19:29 - CMDPHP ERROR: A DB Exec Failed!, Error: Unknown column 'net' in 'field list' 2019/11/28 22:19:29 - CMDPHP SQL Backtrace: (/cli/add_device.php[444]:api_device_save(), /lib/api_device.php[719]:sql_save(), /lib/database.php[1394]:_db_replace(), /lib/database.php[1324]:db_execute(), /lib/database.php[191]:db_execute_prepared()) 2019/11/28 22:19:29 - 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
,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
,alertsms
,sms_phone
) VALUES (0, 9, 1, 1, '', 'w02v.game.1311.com', '10.117.109.84', '', '', net-snmp, 'cacti', '', '', '', '', '', '', '', 161, 1000, '', 3, 3, 8360, 1000, 3, 100, 1, '', '', 0, 0, 0, '', '') ON DUPLICATE KEY UPDATEhost_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
),alertsms
=VALUES(alertsms
),sms_phone
=VALUES(sms_phone
)'My newly deployed machine did not report an error. The machine that reported the error was upgraded from cacti0.8.8a to cacti1.2.7. The database was upgraded from mysql5.1 to mysql5.7, but I copied the mysql table structure of the new machine to the old machine. Still reporting errors
Need your help very much