Monday, November 18, 2019

OIC: Monitoring REST APIs examples using curl

Continuing the series of my previous posts on examples of OIC rest apis in this blog I will provide some additional examples of using curl to retrieve monitoring data.  

Getting logs

curl -X GET -H 'Authorization: Bearer access_token' -o <ics_log>.zip https://instance-name.us.oraclecloud.com/ic/api/integration/v1/monitoring/logs/{id}

 curl -u username@email.com:password -X GET  -H "Content-Type:application/json" -o flow_logs.zip https://instance-name.integration.ocp.oraclecloud.com/ic/api/integration/v1/monitoring/logs/icsflowlog

Valid values for log id: icsflowlog, icsdiagnosticlog, icsauditlog

You can provide additional parameter for filtering the result - for example following will return data for last one day. 

 curl -u username@email.com:password  -X GET  -H "Content-Type:application/json" -o flow_logs.log https://instance-name.integration.ocp.oraclecloud.com/ic/api/integration/v1/monitoring/logs/icsflowlog "q={timewindow: '1d'}"

For the next set of apis you can filter the result by time period, time window and also by the integration by adding following additional parameters

You can use time window as well - must be entered in - 'yyyy-MM-dd HH:mm:ss' UTC format

"q={startdate : '2016-09-23 07:07:07', enddate : '2016-09-23 08:17:07’}"

And filter the results for a given flow…

"q={timewindow: '3d', code: HELLO_WORLD, version: '01.02.0000'}” 



Monitoring Integrations

To get stats such as and number of messages received, processed, successful, errors etc. For example, following provides the data for last one day. 

curl -u username@email.com:password -X GET  -H "Content-Type:application/json" https://instance-name.integration.ocp.oraclecloud.com/ic/api/integration/v1/monitoring/integrations --data-urlencode "q={timewindow: '1d'}" 


Getting Errors

curl -u username@email.com:password -X GET  -H "Content-Type:application/json" https://instance-name.integration.ocp.oraclecloud.com/ic/api/integration/v1/monitoring/errors  --data-urlencode "q={timewindow: '1d'}"



curl -u username@email.com:password -X GET  -H "Content-Type:application/json" https://instance-name.integration.ocp.oraclecloud.com/ic/api/integration/v1/monitoring/logs/errors  --data-urlencode "q={timewindow: '3d', code: 'HELLO_WORLD', version: '01.02.0000'}"


Retrieve Instances

curl -u username@email.com:password -X GET  -H "Content-Type:application/json" https://instance-name.integration.ocp.oraclecloud.com/ic/api/integration/v1/monitoring/instances  --data-urlencode "q={timewindow: '3d', code: 'HELLO_WORLD', version: '01.02.0000'}"

1 comment:

Saransh Khandelwal said...

WHat is code here Integration_name ?

Understanding JavaScript Prototypal Inheritance for Java developers

Inheritance is a fundamental concept in programming languages. However, it is implemented differently in Object-Oriented Languages such as J...