Hi @Naveen,
it will be based on the type of anomaly detection and you can check the available schemas including anomaly and related scope to apply it such as host, host group, environment, … etc.
now after getting the required schema Id, it’s time to post it as an object
and there is an easy approach you can use, you can go to the anomaly detection settings, whether on a certain service, host group, or globally and copy the API and adjust it
in the below example, I’m using Anomaly detection for databases on a certain DB, and by changing the scope from service to environment it will be adjusted globally, (Note: I’ve removed the id of the service, you can add your service id, change the scope based on your requirements and remove the space between “requests PerMinute”)
builtin:anomaly-detection.databases
The scope will be one of the following:
SERVICE_METHOD - Request
SERVICE - Service
HOST_GROUP - Host Group
environment
Token scope: settings.write
[<br>{"schemaId":"builtin:anomaly-detection.databases",<br>"scope":"SERVICE-",<br>"value":<br>{<br>"responseTime":<br>{<br>"enabled":true,<br>"detectionMode":"auto",<br>"autoDetection":<br>{<br>"responseTimeAll":<br>{<br>"degradationMilliseconds":500,<br>"degradationPercent":1000<br>},<br>"responseTimeSlowest":<br>{<br>"slowestDegradationMilliseconds":200,<br>"slowestDegradationPercent":1000<br>},<br>"overAlertingProtection":<br>{<br>"requests PerMinute":100,<br>"minutesAbnormalState":2<br>}<br>}<br>},<br>"failureRate":<br>{<br>"enabled":true,<br>"detectionMode":"auto",<br>"autoDetection":<br>{<br>"absoluteIncrease":0,<br>"relativeIncrease":50,<br>"overAlertingProtection":<br>{<br>"requests PerMinute":10,<br>"minutesAbnormalState":1<br>}<br>}<br>},<br>"loadDrops":<br>{<br>"enabled":false<br>},<br>"loadSpikes":<br>{<br>"enabled":false<br>},<br>"databaseConnections":<br>{<br>"enabled":true,<br>"maxFailedConnects":100,<br>"timePeriod":10<br>}<br>}<br>}<br>]
also, you can use API v1 as well but I think the recommendation is to use API v2 such as Settings API