diff options
author | Kristian Lyngstol <kly@kly.no> | 2016-03-04 19:29:23 +0000 |
---|---|---|
committer | Kristian Lyngstol <kly@kly.no> | 2016-03-04 19:29:23 +0000 |
commit | 7c32c54593ca841c7b557a95cca247da6609c601 (patch) | |
tree | 9deb98c460c7d326491a5334e29806ad7699cb36 /web/nms.gathering.org/api/private/switches-management | |
parent | 6c8b525c2beb2b23daa892b698f0a5e103bddcc7 (diff) |
nms: Further simplify and fix the API
Now this works:
tools/add_switches.txt.pl < switches.txt | POST http://demo:demo@localhost/private/switch-add
Diffstat (limited to 'web/nms.gathering.org/api/private/switches-management')
-rwxr-xr-x | web/nms.gathering.org/api/private/switches-management | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/web/nms.gathering.org/api/private/switches-management b/web/nms.gathering.org/api/private/switches-management index f007ad6..474f674 100755 --- a/web/nms.gathering.org/api/private/switches-management +++ b/web/nms.gathering.org/api/private/switches-management @@ -12,16 +12,12 @@ use Data::Dumper; $nms::web::cc{'max-age'} = "60"; -my $q2 = $nms::web::dbh->prepare('select switch,sysname,placement,ip,switchtype,poll_frequency,community,last_updated from switches natural join placements'); +my $q2 = $nms::web::dbh->prepare('select sysname,ip,switchtype,poll_frequency,community,last_updated from switches '); $q2->execute(); while (my $ref = $q2->fetchrow_hashref()) { my $sysname = $ref->{'sysname'}; - $nms::web::json{'switches'}{$ref->{'sysname'}}{'switchtype'} = $ref->{'switchtype'}; - $nms::web::json{'switches'}{$ref->{'sysname'}}{'management'}{'ip'} = $ref->{'ip'}; - $nms::web::json{'switches'}{$ref->{'sysname'}}{'management'}{'poll_frequency'} = $ref->{'poll_frequency'}; - $nms::web::json{'switches'}{$ref->{'sysname'}}{'management'}{'community'} = $ref->{'community'}; - $nms::web::json{'switches'}{$ref->{'sysname'}}{'management'}{'last_updated'} = $ref->{'last_updated'}; + $nms::web::json{'switches'}{$ref->{'sysname'}} = $ref; } my $q4 = $nms::web::dbh->prepare('select linknet, (select sysname from switches where switch = switch1) as sysname1, addr1, (select sysname from switches where switch = switch2) as sysname2,addr2 from linknets'); |