30 Oct 2023 06:56 AM - last edited on 22 Nov 2023 11:32 AM by Michal_Gebacki
Want to create an alerting profile (send an email) for an API if the failure rate of that API goes above 10%, how can we do that?
Thanks
Solved! Go to Solution.
30 Oct 2023 08:15 AM
Can you explain for which API you want to create alerting profile? Is this element monitored by OneAgent? Is it an API of some other solution?
Radek
30 Oct 2023 08:29 AM
It is monitored by OneAgent
07 Nov 2023 01:48 PM
Hi @Munzir
Please find the api for creation the custome metrix for perticular api
-----++++++--------+++++--------
curl -X 'POST' \
'https://{my-domain}/e/{my-environment}//api/v2/settings/objects?validateOnly=true' \
-H 'accept: application/json; charset=utf-8' \
-H 'Authorization: Api-Token {my-token}' \
-H 'Content-Type: application/json; charset=utf-8' \
-d '[
{
"schemaId": "builtin:anomaly-detection.metric-events",
"scope": "environment",
"schemaVersion": "1.0.15",
"value": {
"enabled": true,
"summary": "Summary of custom metric",
"queryDefinition": {
"type": "METRIC_KEY",
"metricKey": "builtin:service.keyRequest.errors.server.rate",
"aggregation": "AVG",
"entityFilter": {
"dimensionKey": "dt.entity.service_method",
"conditions": [
{
"type": "NAME",
"operator": "EQUALS",
"value": "API name with key request"
}
]
},
"dimensionFilter": []
},
"modelProperties": {
"type": "STATIC_THRESHOLD",
"threshold": 10,
"alertOnNoData": false,
"alertCondition": "ABOVE",
"violatingSamples": 3,
"samples": 5,
"dealertingSamples": 5
},
"eventTemplate": {
"title": "Title which requried -5xx-ErrorCount)",
"description": "The {metricname} value of {severity} was {alert_condition} your custom threshold of {threshold}.",
"eventType": "CUSTOM_ALERT",
"davisMerge": true,
"metadata": []
},
"eventEntityDimensionKey": "dt.entity.service_method"
}
}
]
-----++++++--------+++++--------
07 Nov 2023 01:35 PM
To set up an alert on an API service which triggers at >10% failure rate you can follow these steps.
1. Identify the API service
2. Open a custom multidimensional analysis
3. select "failure rate" form the metric selector (top left of the multidimensional analysis)
4. Click on create metric - you have now created a metric which looks at the failure rate of your API service.
5. Navigate to settings > anomaly detection > metric events
6. Create your custom metric event based on the metric you just created, specifying your thresholds in the monitoring strategy section.