API

This section will introduce the APIs provided by Nightingale. You can use these APIs for secondary development and integration with internal systems. All operations on the page have corresponding APIs.

Preface

1、The return of all interfaces is in the following format, the error message will be written into the err field, and the status code is all 200, unless the server fails.

{
    "dat": {},
    "err": "error msg"
}

2、The relevant interfaces of /api /portal will be authenticated, using the basic auth method.

# For example, using curl can be tested like this:
curl -u root:1234 localhost/api/portal/self/profile

In the above example, it is assumed that the root account (password 1234) is used for testing. In the actual production environment, we can create several virtual accounts with permissions set to root, and use these virtual accounts as the authentication account of the caller.

3、There will be an nginx in front of each module of Nightingale, so the address of all interfaces is the nginx address by default. If you want to directly call the back-end module, it is also possible to pay attention to load balancing and failure retry.

4、For monapi related interfaces, you can refer to the file: src /modules /monapi /http /routes /routes.go,This file defines the path of all interfaces and the corresponding implementation method. If you feel that the interface is not enough or want to add some interfaces, you can submit a PR:-) The interface for querying index data is provided by the index module, the api path starts with /api /index, the interface for querying historical monitoring data is provided by the transfer module, and the api path starts with /api /transfer.

Below we will introduce some important interfaces. For other interfaces, please refer to the source code directly. After all, the code is not deceptive.


Monitoring data

This section explains the API related to monitoring data.

Alarm related

This section explains the API related to the alarm strategy

Collection configuration

This section explains the APIs related to acquisition and configuration.

User Management

This section explains user management related APIs

Object node

This section explains the APIs related to object tree management

Last modified April 18, 2020: add en content/en/docs/api (#14) (2758540)