BGPmon.net WebServices API
The BGPmon.net WebServices API allows you to connect the BGPmon.net monitorings
service to your own network management services.
The BGPmon WebServices APi uses the SOAP protocol, this allows you to
call BGPmon.net API function from anywhere on the Internet. SOAP messages are
XML encoded messages that are transported over HTTP. Many programming
languages provide SOAP or XML/RPC libraries, you should be able to use your
favourite programming language to interface with the BGPmon.net WebServices API.
Curious and want to play around with the BGPmon.net WebServices API? Try the Generic Soap
client at
www.soapclient.com
and find out which functions are currently available. FunctionsBelow you will find a quick overview of the available function. All functions are also described in great detail the WSDL file.getIPInfo()
This function will return a set of information about a prefix or IP address. It
has only one argument: an IPv4 or IPv6 address or prefix.
It will return the best match prefix (longest prefix match) found in the
routing tables. It will also return the prefix descrription, country code, origin AS and Origin AS
description. GetAlerts() this will return all alerst. It has 3 arguments that allow you to filter on type of alerts. The first argument is active, this indicates whether you want all alerts or just the currently active ones. The second argument is days. This indicates how many days back in time you want to go. The last argument is maxcode. This allows you to specify which alarms code you'd like to retrieve. All alarms types are represented by a code, see faq. This argument is an inclusive filter, meaning that if you specify 22 you will receive alerts with code 1 to 22. The returned result is ordered by date and alert_code. GetAlertDetails() This will return a list of peers and their BGP messages that detected this alert. GetASname() Will return the name of the ASN. This function has 1 argument AS which is the ASnumber. GetASPrefixes() returns a list of all prefixes announced by this AS. This function has 1 argument AS which is the ASnumber. getCountry() Takes a prefix as input and returns the country code. This works for both IPv4 and IPv6. So here you go a free IPv6 Geo Location library. WSDLThe BGPmon.net API is described in a WSDL file, this file can be found here. A more human readable version can be found here.AuthenticationTo access some of the SOAP functions related to your BGPmon.net account you'll have to authenticate. Functions that require authenticataion are: GetAlertDetails() and GetAlerts(); You'll have to add your BGPmon.net email address and password as input parameters, also see the WSDL.ExamplesIt's always easier to develop code based on some examples. Below you'll find two examples that make use of the BGPmon.net WebServices API using SOAP. One example is written in Perl and one in PHP. If you create your own script and you think it might be useful for others then please sent me an email so I can post your script here as well.Whois interfaceThere is a whois interace written in perl that uses the getIPInfo() to serve whois queries. The whois interace accepts any IPv4 or IPv6 address/prefix. The whois deamon will return the best match prefix for this address, as well as country code and the origin AS that announces this prefix.
The whois service can be used in verbose mode (default) or with the - m flag.
The latter is useful for when the output needs to be parsed by a script.
Below you will see an example of how to use this interface $ whois -h whois.bgpmon.net 8.8.8.8 % This is the BGPmon.net whois Service % You can use this whois gateway to retrieve information % about an IP adress or prefix % We support both IPv4 and IPv6 address. % % For more information visit: % http://bgpmon.net/bgpmonapi.php Prefix: 8.8.8.0/24 Prefix description: Google Country code: US Origin AS: 15169 Origin AS Name: GOOGLE - Google Inc. $ whois -h whois.bgpmon.net " -m 2001::" BGP Prefix|CC|Origin AS| Origin AS Name| Prefix Description 2001::/32|unknown|25525|REASONNET-AS Reasonnet IP Networks B.V. number|Proxy-registered route object 2001::/32|unknown|12637|SEEWEB Seeweb Srl|Proxy-registered route object 2001::/32|unknown|12859|NL-BIT BIT BV|Proxy-registered route object 2001::/32|unknown|1257|TELE2|Proxy-registered route object 2001::/32|unknown|6939|HURRICANE - Hurricane Electric, Inc.|Proxy-registered route object 2001::/32|unknown|21155|ASN-PROSERVE ProServe B.V. Networks|Proxy-registered route object 2001::/32|unknown|29259|DE-IABG-TELEPORT IABG Teleport, DE|Proxy-registered route object 2001::/32|unknown|29432|TREX-AS TREX Tampere Region Exchange Oy|Proxy-registered route object 2001::/32|unknown|1741|FUNETAS FUNET autonomous system|Proxy-registered route object Perl Nagios pluginThis Perl example connects to the BGPmon API and retrieves the requested alerts. Based on the number and type of alerts it will generate a nagios alarm. The nagios script takes a number of arguments, which allow you to filter in type of alarms. Two arguments are mandatory, your email address and password.
The script requires two external libraries, SOAP::Lite. BGPmon.net Soap API:: nagios plugin usage: ./bgpmon-nagios.pl -l PHP BGPmon RSS client example.This is an simple example demonstrating how easy it is to use the BGPmon.net API in php.
This client uses the BGPmon.net API to represent the results in RSS format. You can use this to display the results in your favorite RSS reader or in a external application that takes RSS input. The PHP RSS example has 3 optional arguments: This is the example at work for the bgpmon demo account: http://bgpmon.net/rssclient.php?days=600&active=0&maxcode=100 The source code for this script can be found below:
<?php | ||||||
Copyright ©2008 Questions or remarks: BGPmon |