SQL ERROR on Discovery Cisco SLA -

I get in LibreNMS.log a SQL error during discovery.
This error points to /opt/librenms/includes/discovery/cisco-sla.inc.php(80).

LOG ERROR:
[2019-06-18 07:07:01] production.ERROR: SQLSTATE[HY093]: Invalid parameter number: mixed named and positional parameters (SQL: UPDATE slas set device_id=39,sla_nr=1,owner=,tag=xxx.xxx.xxx.xxx,rtt_type=echo,status=1,opstatus=0,deleted=0 WHERE sla_id = 5) (SQL: UPDATE slas set device_id=39,sla_nr=1,owner=,tag=xxx.xxx.xxx.xxx,rtt_type=echo,status=1,opstatus=0,deleted=0 WHERE sla_id = 5)#0 /opt/librenms/includes/discover
y/cisco-sla.inc.php(80): dbUpdate(Array, ‘slas’, ’sla_id = :sla…’, Array)
#1 /opt/librenms/includes/discovery/functions.inc.php(179): include(’/opt/librenms/i…’)
#2 /opt/librenms/discovery.php(120): discover_device(Array, false)
#3 {main}

I suggest to change this lines of code in cisco-sla.inc.php to avoid this error:

line 80: dbUpdate($data, ‘slas’, ’sla_id = :sla_id’, array(‘sla_id’ => $sla_id));
change to: dbUpdate($data, ‘slas’, ’sla_id = ?’, array($sla_id));

line 87: dbUpdate(array(‘deleted’ => 1), ‘slas’, ’sla_id = :sla_id’, array(‘sla_id’ => $existing_sla));
change to: dbUpdate(array(‘deleted’ => 1), ‘slas’, ’sla_id = ?’, array($existing_sla));

1 Like

Please send a pull request to get your fixes merged. https://docs.librenms.org/Developing/