07.12.2017

FastNetMon Advanced API

We ship API capability in FastNetMon Advanced mainline distribution since since FastNetMon 2.0.58 and you have to execute few additional steps to enable API.

API is disabled by default because it has blank password by default. You need to generate new password to enable it.

Generate secure password and specify it as API password:

Apply changes:

Also, for Ubuntu 16.04 or 18.04 you need following command to start API on machine boot:

If you experience any issues, we suggest checking logs:

Execute example query to get license:

FastNetMon API based on well known fcli tool.

For debugging purposes, you could switch fcli to JSON mode this way:

It will provide same messages as API provides.

Instead of “set” command, you will need to use PUT HTTP method, for example (be careful, we use URL Encode for network name because it consists slash symbol):

Instead of “delete” command you will need to use DELETE HTTP method, for example:

To show something, you could use GET HTTP method:

To show whole category use:

As you can see, in almost all cases you could replace space symbol by slash and use fcli’s format of command to talk with API.

If method failed for some reasons we return following document:

If we command returns single value we return it in “value” field.

Example for boolean value:

Example for string value:

If command returns multiple elements, we return it in “values” field:

If command returns hash map / table / dictionary FastNetMon encodes them as JSON dictionary:

If command returns document (hash map, dictionary) we return it in “object” field:

But we have some pretty complicated examples, for example for blackhole announces:

Or flow spec announces:

To put blackhole host, use this:

After making any changes, you have to trigger commit command to apply changes for FastNetMon’s engine:

Complete example to ban and then unban host

Ban it:

Check list of banned hosts:

Output:

And finally unban it by UUID:

We have number of example tools implemented for our API to provide examples:

  • API client which creates and removes networks from FastNetMon
  • API client which can block and unblock IP address