Using the API for integration into LibreNMS
Hi Folks, We've been working on adding some simple support into LibreNMS so users can list the exchanges that they are connected to and then in turn the peers on those exchanges and if they have sessions configured already. To do this we're making use of the two following API calls: https://peeringdb.com/api/net?depth=2&asn=[asn] https://peeringdb.com/api/ixlan/[ix_id]?depth=2 (We require ASN for each peer to match with the data we have). Firstly I hope that these are the best two end points to use. Secondly I hope this is an appropriate use of the API. It's a user configurable option and is off by default, when turned on it will only call for data once a day and cache this info. The call for data would already be randomly delayed by other functions called before it but we've added a random delay of between 60 and 300 seconds to stagger things further. The code is within this pull request (https://github.com/librenms/librenms/pull/6178) which we've put a call out for testing. If you have any feedback or comments then please let us know. Kind Regards, Neil LibreNMS
Neil, On 12.03.2017 19:26, Neil Lathwood wrote:
We've been working on adding some simple support into LibreNMS so users can list the exchanges that they are connected to and then in turn the peers on those exchanges and if they have sessions configured already.
To do this we're making use of the two following API calls:
https://peeringdb.com/api/net?depth=2&asn=[asn] https://peeringdb.com/api/ixlan/[ix_id]?depth=2 (We require ASN for each peer to match with the data we have).
Firstly I hope that these are the best two end points to use. Secondly I hope this is an appropriate use of the API.
Imho netixlan is more appropriate as this endpoint holds all the relevant information needed for session setup. Arnold
Didn't realise my original response went to Arnold (Apologies for the offlist emails). On 12 March 2017 at 21:35, Arnold Nipper <arnold@nipper.de> wrote:
Imho netixlan is more appropriate as this endpoint holds all the relevant information needed for session setup.
Thanks for the response, that endpoint does look a lot more useful with the exception of the peer name. The output gives the name of the IX itself: [78] => stdClass Object ( [id] => 32817 [net_id] => 976 [ix_id] => 583 [name] => IXManchester [ixlan_id] => 583 [notes] => [speed] => 10000 [asn] => 20860 [ipaddr4] => 195.66.244.2 [ipaddr6] => 2001:7f8:4:2::517c:1 [is_rs_peer] => 1 [created] => 2017-01-26T18:25:22Z [updated] => 2017-01-26T18:25:22Z [status] => ok ) If it had the peers name then this would be the perfect call to use. Thanks, Neil
On 13.03.2017 17:52, Neil Lathwood wrote:
Didn't realise my original response went to Arnold (Apologies for the offlist emails).
On 12 March 2017 at 21:35, Arnold Nipper <arnold@nipper.de <mailto:arnold@nipper.de>> wrote:
Imho netixlan is more appropriate as this endpoint holds all the relevant information needed for session setup.
Thanks for the response, that endpoint does look a lot more useful with the exception of the peer name. The output gives the name of the IX itself:
[78] => stdClass Object ( [id] => 32817 [net_id] => 976 [ix_id] => 583 [name] => IXManchester [ixlan_id] => 583 [notes] => [speed] => 10000 [asn] => 20860 [ipaddr4] => 195.66.244.2 [ipaddr6] => 2001:7f8:4:2::517c:1 [is_rs_peer] => 1 [created] => 2017-01-26T18:25:22Z [updated] => 2017-01-26T18:25:22Z [status] => ok )
If it had the peers name then this would be the perfect call to use.
That would really be nice but would break the logic Arnold -- Arnold Nipper Chief Technology Evangelist and Co-Founder DE-CIX Management GmbH | Lindleystrasse 12 | 60314 Frankfurt am Main | Germany | www.de-cix.net | Phone +49 69 1730902 22 | Mobile +49 172 2650958 | Fax +49 69 4056 2716 | arnold.nipper@de-cix.net | Geschaeftsfuehrer Harald A. Summa | Registergericht AG Koeln HRB 51135
On 13 March 2017 at 18:30, Arnold Nipper <arnold.nipper@de-cix.net> wrote:
That would really be nice but would break the logic
Ok well as it happens, I've refactored to use the netixlan endpoint instead and we just do a lookup (not using PDB) for the AS Name :) We've got some users testing it at present. Thanks, Neil
Neil, Ok well as it happens, I've refactored to use the netixlan endpoint instead
and we just do a lookup (not using PDB) for the AS Name :)
PDB is built to be used. Go call the /asn/nnnn endpoint to get the name. BTW: Keep in mind that the name of a network may not be the same on PDB as it is via whois on an RIR (or RADB). The name of a network used for peering is sometimes "unique". Martin On Mon, Mar 13, 2017 at 5:23 PM, Neil Lathwood <n@laf.io> wrote:
On 13 March 2017 at 18:30, Arnold Nipper <arnold.nipper@de-cix.net> wrote:
That would really be nice but would break the logic
Ok well as it happens, I've refactored to use the netixlan endpoint instead and we just do a lookup (not using PDB) for the AS Name :)
We've got some users testing it at present.
Thanks,
Neil
_______________________________________________ Pdb-tech mailing list Pdb-tech@lists.peeringdb.com http://lists.peeringdb.com/cgi-bin/mailman/listinfo/pdb-tech
Martin / Neil, On 14.03.2017 18:04, Martin J. Levy wrote:
Neil,
Ok well as it happens, I've refactored to use the netixlan endpoint instead and we just do a lookup (not using PDB) for the AS Name :)
PDB is built to be used. Go call the /asn/nnnn endpoint to get the name. BTW: Keep in mind that the name of a network may not be the same on PDB as it is via whois on an RIR (or RADB). The name of a network used for peering is sometimes "unique".
the endpoint /asn does not longer is an endpoint, pls use /net?asn=nnnn instead. To single out the name postprocess with jq might come in handy. E.g. curl -s -k -X GET https://peeringdb.com/api/net\?asn=13335 | jq '.data[].name' "Cloudflare" Arnold
Martin
On Mon, Mar 13, 2017 at 5:23 PM, Neil Lathwood <n@laf.io <mailto:n@laf.io>> wrote:
On 13 March 2017 at 18:30, Arnold Nipper <arnold.nipper@de-cix.net <mailto:arnold.nipper@de-cix.net>> wrote:
That would really be nice but would break the logic
Ok well as it happens, I've refactored to use the netixlan endpoint instead and we just do a lookup (not using PDB) for the AS Name :)
We've got some users testing it at present.
Thanks,
Neil
_______________________________________________ Pdb-tech mailing list Pdb-tech@lists.peeringdb.com <mailto:Pdb-tech@lists.peeringdb.com> http://lists.peeringdb.com/cgi-bin/mailman/listinfo/pdb-tech <http://lists.peeringdb.com/cgi-bin/mailman/listinfo/pdb-tech>
_______________________________________________ Pdb-tech mailing list Pdb-tech@lists.peeringdb.com http://lists.peeringdb.com/cgi-bin/mailman/listinfo/pdb-tech
-- Arnold Nipper / nIPper consulting, Sandhausen, Germany email: arnold@nipper.de phone: +49 6224 5593407 2 mobile: +49 172 2650958 fax: +49 6224 5593407 9
PDB is built to be used. Go call the /asn/nnnn endpoint to get the name. BTW: Keep in mind that the name of a network may not be the same on PDB as it is via whois on an RIR (or RADB). The name of a network used for peering is sometimes "unique".
Thanks for the reply Martin, this would involve a call for every peer on an Exchange - that will equate to a large number of api hits per install so could mount up. Neil
On 14.03.2017 23:43, Neil Lathwood wrote:
PDB is built to be used. Go call the /asn/nnnn endpoint to get the name. BTW: Keep in mind that the name of a network may not be the same on PDB as it is via whois on an RIR (or RADB). The name of a network used for peering is sometimes "unique".
Thanks for the reply Martin, this would involve a call for every peer on an Exchange - that will equate to a large number of api hits per install so could mount up.
If you are worried about the number of api calls try this. Build a list of peers asn1, asn2, ... asnn and then call /net?asn__in=asn1,asn2,...asnn That way it's only one call. Or simply do /net and look for the (asn,name) pair in the answer. Arnold
Neil,
... that will equate to a large number of api hits per install so could mount up.
Arnold's response about the multi ASN query is worth doing. I would also point out that there's always other options. 1) Do a "sync" and have a local copy of the database to query (we do this at Cloudflare for our peering tools and I know that others do the same). 2) Keep a cached copy of the data for any object so that if you see the same ASN more than once you will have what you already need. Note that keeping data cached for X days is pretty safe; where X is your choosing. 3) Throw caution to the wind and simply say "If we are a legit user of the data; then PDB should be built with the capability to handle the populace of users in the world". I actually like #3 as this sounds like a pretty legit user of the data; plus I know a pretty cool CDN that could help PDB handle the added load! :) Martin On Tue, Mar 14, 2017 at 5:01 PM, Arnold Nipper <arnold@nipper.de> wrote:
On 14.03.2017 23:43, Neil Lathwood wrote:
PDB is built to be used. Go call the /asn/nnnn endpoint to get the name. BTW: Keep in mind that the name of a network may not be the same on PDB as it is via whois on an RIR (or RADB). The name of a network used for peering is sometimes "unique".
Thanks for the reply Martin, this would involve a call for every peer on an Exchange - that will equate to a large number of api hits per install so could mount up.
If you are worried about the number of api calls try this. Build a list of peers asn1, asn2, ... asnn and then call
/net?asn__in=asn1,asn2,...asnn
That way it's only one call. Or simply do
/net
and look for the (asn,name) pair in the answer.
Arnold
_______________________________________________ Pdb-tech mailing list Pdb-tech@lists.peeringdb.com http://lists.peeringdb.com/cgi-bin/mailman/listinfo/pdb-tech
First of all: happy 1st anniversary PeeringDB 2.0. How could we have lived so long w/o you. You simply rock! On 15.03.2017 05:40, Martin J. Levy wrote:
3) Throw caution to the wind and simply say "If we are a legit user of the data; then PDB should be built with the capability to handle the populace of users in the world".
I actually like #3 as this sounds like a pretty legit user of the data;
This also is what PeeringDB currently recommends. And afaik there still is enough headroom to handle all queries. Arnold
Arnold's response about the multi ASN query is worth doing.
I would also point out that there's always other options.
1) Do a "sync" and have a local copy of the database to query (we do this at Cloudflare for our peering tools and I know that others do the same).
2) Keep a cached copy of the data for any object so that if you see the same ASN more than once you will have what you already need. Note that keeping data cached for X days is pretty safe; where X is your choosing.
3) Throw caution to the wind and simply say "If we are a legit user of the data; then PDB should be built with the capability to handle the populace of users in the world".
I actually like #3 as this sounds like a pretty legit user of the data; plus I know a pretty cool CDN that could help PDB handle the added load! :)
For now, I've left it how it is and chosen not to hit the PDB API for the AS Name. We have a release due out Sunday, if this caused issues then those would persist until the next release so I'll see how it goes as is and get some feedback and then look at switching to use PDB for the last lookup in between releases to further test. The code is now present in our master branch which updates daily for users not on stable releases so you may start seeing people using it (it's still disabled by default) from now on wards. Let me know if you see any issues on the PDB side. I did at the last minute change to only populate the data once every 71 hours (just under 3 days so it would be repopulated on the daily scheduled tasks that run). Thanks for the service folks. Neil
participants (4)
-
Arnold Nipper -
Arnold Nipper -
Martin J. Levy -
Neil Lathwood