Programming with the BGPmon.net Web Services API
Lately I have received quite some questions with regard to connecting BGPmon.net with existing monitoring software. As well as requests for making more data available for developers.
I’m happy to announce that these things should now be possible trough the BGPmon.net Web Services API. This API allows you to access your BGPmon.net alert as well as other features from your own program running anywhere on the Internet.
I will use the rest of this Blog to briefly explain how the API works and what it can be used for. More detailed information regarding the API and how to use this, can be found on the Web Services API page.
The BGPmon.net API provide a number of Web services for developers. It allows you to query our database and let’s you integrate this in your own software.
As we are using SOAP as the web services protocol. All the web services are described in a WSDL file, which can be found here.
Currently the following functions are available:
More information about these function can be found here
Integrating BGPmon.net with your software
SOAP is a programming language independent protocol and is supported by all popular languages. It allows you to access the BGPmon API over HTTP.
Some of the functions are specific for your BGPmon.net account and thus allow you to authenticate, others are currently publicly accessible.
Let’s get started with two examples
On the BGPmon.net API page you will find two examples of SOAP clients that use the the BGPmon.net SOAP API, a perl and a php example.
The examples are for BGPmon.net users to use, as well as to learn from in case you want to write your own application using our API.
Perl Nagios plugin example
The nagios plugin is written in perl and allows you to monitor your prefixes in Nagios by utilizing the BGPmon.net API.
The script expects a number of arguments, these allow you to filter on the type of alerts that will be returned.
The source code for this plugin example can be found here.
PHP RSS feed example
This is an example of utilizing the BGPmon.net SOAP API in PHP. The PHP RSS example retrieves all the alarms and represents the results in a RSS feed.
You will need to edit the PHP script and change the email and password variable to your own BGPmon email and password.
You can then call the php script using your browser or any other RSS reader. Optionally you can change the days, maxalert and active aruguments,
An example using the demo account can be found here:
The source code can be found here
Developing your own programs
Should you decide that you want to write your own program and you have any questions please leave a comment on this blog.
Also if you have created your own program and are willing to share this, please sent it to me so I can add it the the examples page.
Keep in mind that the Web Services API is a new feature, if you find any bugs please let me know and I will try to solve them asap.