Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mysql bug in cisco-sla module #10357

Merged
merged 3 commits into from
Jun 21, 2019
Merged

Fix mysql bug in cisco-sla module #10357

merged 3 commits into from
Jun 21, 2019

Conversation

tvcabomz
Copy link

Fix SQL error during discovery of cisco-sla.
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));

DO NOT DELETE THIS TEXT

Please note

Please read this information carefully. You can run ./scripts/pre-commit.php to check your code before submitting.

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926
After you are done testing, you can remove the changes with ./scripts/github-remove. If there are schema changes, you can ask on discord how to revert.

Fix SQL error during discovery of cisco-sla.
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)
librenms#1 /opt/librenms/includes/discovery/functions.inc.php(179): include(’/opt/librenms/i…’)
librenms#2 /opt/librenms/discovery.php(120): discover_device(Array, false)
librenms#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));
@CLAassistant
Copy link

CLAassistant commented Jun 20, 2019

CLA assistant check
All committers have signed the CLA.

@murrant murrant changed the title Update cisco-sla.inc.php Fix mysql bug in cisco-sla module Jun 21, 2019
Copy link
Member

@murrant murrant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix :D

@murrant murrant merged commit 1f19eb2 into librenms:master Jun 21, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Aug 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants