Can we able to get alerts via e-mails in case any Exception is thrown by Target servers.

If an exception is coming from Target Server and displayed on 'node.js' logs. Is there any way to get alerts on e-mail or any Management API is there to retrieve these details

0 2 157
2 REPLIES 2

Not applicable
$ curl  https://api.enterprise.apigee.com/v1/o/{org_name}/environments/test/stats/apps?"select=sum(message_count)&timeRange=01/24/2013%2000:00~09/25/2013%2000:00&timeUnit=day&filter=(target_response_code eq 404)" \
-u email:password

Above analytics api call will provide you the sum of messages that have failed with target response code as 404 for the particular time range.

You can use this sum of messages to compare over a (configurable) threshold and send e-mail / sms or any other type of alert.

@Vivek Kumar

Any data logged into Analytics ca be retrieved using the API CALL shared by @Ravi Shah.

The important thing to note is that the TIME is in UTC. And you can add few more details in the url like :-

https://api.enterprise.apigee.com/v1/o/{org_name}/environments/test/stats/apiproxy,response_status_c...?

sum(target_error)&timeRange=01/24/2013%2000:00~09/25/2013%2000:00&timeUnit=minute&filter=(apiproxy in 'TestApiProxy') and (response_status_code%20ge%20'499')

(Used Time filter in minute i.e. it will give count say 5 errors in 4th minute, 5th Minute, etc)

This will give extra information about the proxy path suffix for which you are getting the error.

Also, as the gateway flow ID is unique for every request, in response you will complete data.

If you just need count based on resource, then you can remove gateway flow ID, if you just need count based on api proxy then you can remove both proxy path suffix and gateway flow ID.

PFB the sample response :-

{ "environments" : [ { "dimensions" : [ { "metrics" : [ { { "name" : "sum(target_error)", "values" : [ { "timestamp" : 1441384140000, "value" : "1.0" }, { "timestamp" : 1441383900000, "value" : "1.0" } ] } ], "name" :"TestAPIPROXY,/token,404,ABCDE_BT5gVHZM_RouterProxy-26-11049_1" },