Added new API calls to support device groups #2611

merged 4 commits into from Dec 20, 2015


None yet

3 participants

laf commented Dec 12, 2015

Fix #2451

New API routes, shouldn't conflict with anything else based on the order they've been added.

The biggest change to pay attention to is in: includes/

I've updated an existing function to return more than just device_id. I've tested alerts and the WebUI sections that rely on this function so it shouldn't affect anything. Please however double check that section more than anything.

laf added some commits Dec 12, 2015
@laf laf Added API calls for device groups 62b4c21
@laf laf Added API call for listing devices by groups
@laf laf added the API label Dec 12, 2015
@laf laf Fixing scrut issue
laf commented Dec 12, 2015

Fixed scrut major issue.

@f0o f0o and 1 other commented on an outdated diff Dec 13, 2015
@@ -66,7 +66,7 @@ function GenGroupSQL($pattern, $search='') {
$search .= ' &&';
- $sql = 'SELECT DISTINCT('.str_replace('(', '', $tables[0]).'.device_id) FROM '.implode(',', $tables).' WHERE '.$search.' ('.str_replace(array('%', '@', '!~', '~'), array('', '.*', 'NOT REGEXP', 'REGEXP'), $pattern).')';
+ $sql = 'SELECT DISTINCT('.str_replace('(', '', $tables[0]).'.device_id),`devices`.* FROM '.implode(',', $tables).' WHERE '.$search.' ('.str_replace(array('%', '@', '!~', '~'), array('', '.*', 'NOT REGEXP', 'REGEXP'), $pattern).')';
f0o Dec 13, 2015 Member

This SQL is often called by dbFetchCell. I'm not sure how it will behave when more than a single cell is returned.
This comment is a reminder for myself to test it.

laf Dec 13, 2015 Member

Yeah you're right.

It's used twice with GetGroupsFromDevice(). I've created another function that mimics that one as I needed the full response back. If I update the use of GetGroupsFromDevice() to use the full output from dbFetchRows instead are you ok with that?

@laf laf Updated device-groups functions to support returning all data or just…
… group id
laf commented Dec 13, 2015

Updated device group functions so that old calls stay as is but the new call here returns the expected full output.

f0o commented Dec 14, 2015

Gonna test it tmr :)

laf commented Dec 18, 2015


f0o commented Dec 20, 2015

Looking good. letting CI rebuild just in case

@f0o f0o merged commit c276cc5 into librenms:master Dec 20, 2015

2 checks passed

Auto-Deploy Build finished. No test results found.
Scrutinizer 1 new issues
@laf laf deleted the laf:issue-2451 branch Dec 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment