Instana U

 View Only

Instana APIs

By Bonia Benny posted 14 hours ago

  

What are Instana APIs? 

Application programming interface, or API, is a software bridge that enables communication between two applications. The Instana API provides developers and end users with the ability to retrieve and configure important data points and functionalities.  

By leveraging the Instana API, users have the opportunity to access specific information and utilize it for various purposes. Users can retrieve relevant data from Instana and integrate it with other technologies or tools to create personalized and tailored metrics on their own dashboard. To know more on how to create custom dashboards, click here. 

Grouping of Instana APIs 

Instana APIs are categorized according to their purposes or methods of use. The current classifications are: 

  • Monitoring: 

The monitoring APIs offered by Instana cover a range of areas, including, infrastructure, application, website, and mobile app monitoring.  These APIs offer users comprehensive capabilities to analyze metrics, retrieve data, configure settings, and access monitoring-related information for efficient monitoring and management of their systems and applications.  

  • Events: 

APIs under this group enable event management and settings, allowing users to retrieve, create, and update events, alerting channels, payload configurations, and event specifications. These APIs enable effective monitoring and alerting. 

  • Host Agent: 

APIs for managing and interacting with host agents enable seamless management, retrieval of configuration and logs, and updating configurations.  

  • Settings: 

APIs under this group offer functions for managing and configuring monitoring system settings, including custom dashboard creation, updating, and deletion. These APIs also facilitate the management of user settings, RBAC groups, API token, access logs, audit logs, maintenance schedules, synthetic calls, and session settings.

  • Pipeline Feedback: 

Pipeline feedback APIs enable efficient management of pipeline releases, allowing for retrieval, creation, updating, and deletion to ensure effective tracking and feedback. 

  • Service Level Indicators: 

APIs for managing and monitoring Service Level Indicators (SLIs) enable users to retrieve, configure, delete, access details, and retrieve reports for analysis and monitoring, facilitating effective service level performance monitoring. 

  • Open Beta Features: 

The APIs under development enable users to test new features before official release, with Open Beta APIs undergoing updates based on user feedback. 

  • Instana Health & Usage: 

These APIs provide endpoints for retrieving information that is related to the health and version of Instana , as well as accessing usage statistics for the API and hosts. Users can retrieve usage data for specific days, months, and years. 

For more information regarding these APIs, click here. 

Usage: 

To access the Instana APIs, user must provide two essential parameters: 

  1. base: Tenant unit's base URL, which is also the URL used to access the Instana user interface.  

(For example, for Instana deployments in OpenShift, if the Instana core is deployed onto the namespace             Instana-core, use the following command to get the base URL -  
oc get route -n instana-core) 

  1. apiToken: Requests made over the Instana API require valid API tokens. An initial API token can be created using the Instana UI. Any additional tokens can be generated for different permissions per consumer. 
    These tokens could be of two types: 

a) unit-specific API tokens - The user must have the API token configuration permission (granted through an Instana group) in order to create or view these API tokens. Anyone with the proper permission can view and modify them. 

Configuration: Settings -> Access control -> API tokens -> Add API Token 

 

Give a name for your token and click the save button 

 

 

b) Personal API tokens - Belong to a user and carry over the creator's permission. They are useful when individual responsibility and traceability are crucial, or when users prefer not to disclose their personal API tokens to others. Also, these tokens are deleted when the user is removed from the tenant. 

Configuration: Settings -> User settings -> Personal API tokens -> New Personal API Token 

 

Provide a name for your personal token, and click the Save.

Request Syntax: 

The Instana APIs come with GET, POST, PUT, DELETE & PATCH methods. Curl commands that are invoked using the command line can be used to access these APIs.  

 

General syntax: curl [options] [URL...] 

(Options - GET, POST, PUT, DELETE or PATCH) 

(URL - base url + endpoint url) 

 

Authorization Header: 

Additionally, Instana APIs demand API tokens be be given as the authorisation header. 

--header 'authorization: apiToken xxxxxxxxxxxxxxxx' 

 

The various APIs and their associated methods can thus be used as follows: 
 

GET :  

curl --request GET \ 

--url URL \ 

--header 'authorization: apiToken xxxxxxxxxxxxxxxx' 

e.g. Endpoint url: /api/instana/health  

        Command: curl --request GET \ 

                             --url <URL> \ 

                             --header 'authorization: apiToken xxxxxxxxxxxxxxxx' 

        The returned JSON object provides a `health` property that contains a simple traffic light. 

 

POST, PUT, PATCH : 

curl --request method_name\ 

--url URL \ 

--header 'authorization: apiToken xxxxxxxxxxxxxxxx' \ 

--header 'content-type: application/json' \ 

--data '{"key1": "value1", "key2": "value2"}' 

e.g. Endpoint url: api/application-monitoring/analyze/call-groups 

        Command: curl --request POST --url <URL> \ 

                             --header 'authorization: apiToken xxxxxxxxxxxxxxxx' 

                             --header 'content-type: application/json' \  

                             --data '{ 

                             "group":{ 

                                    "groupbyTag":"endpoint.name" 

                              }, 

                             "tagFilters":[ 

                                    { 

                                             "name":"call.error.count", 

                                             "value":"0", 

                                             "operator":"GREATER_THAN" 

                                    } 

                              ], 

                              "metrics":[ 

                                   { 

                                           "metric":"errors", 

                                           "aggregation":"MEAN" 

                                   } 

                              ] 

                              }' 

     This command allows every call grouped by the endpoint name that has an error to count greater than zero. 

 

DELETE : 

curl --request DELETE \ 

--url URL \ 

--header 'authorization: apiToken xxxxxxxxxxxxxxxx' 

e.g. Endpoint url : api/events/settings/alertingChannels/{channel_id} 

        Command: curl --request DELETE -k --url <URL> \  

                             --header 'authorization: apiToken xxxxxxxxxxxxxxxx' 

        This command deletes the alerting channel of the given ID. 

 

 

I hope this article serves as an introduction to using Instana APIs. By looking at these APIs, you can get a general idea on how to incorporate them into your own workflows for development and monitoring. 

 

 

Permalink