What is the best way to capture the memory consumption for a specific service and raise an alert (with custom event if possible) with a specific threshold.
Raise an alert if service XXXX consume > 45% of memory.
very interesting, im shocked that this isn't an option in custom event for alerting. You can do it from the service page but i would have thought it would be an option in the custom section since technologies(Processes) and Hosts are there to be added in.
Are you asking about memory for a service (service in the Dynatrace meaning)? That's not directly possible on the service level, but only on the process level for process group instances which provide the service.
You can setup custom events for alerting based on metric query expression (code):
builtin:tech.generic.mem.usage :filter( in("dt.entity.process_group_instance", entitySelector("type(PROCESS_GROUP_INSTANCE), fromRelationship.isInstanceOf( type(PROCESS_GROUP),toRelationship.runsOn(entityId(SERVICE-5EBAB25B2F3F0D01)))") )) :splitBy("dt.entity.process_group_instance") :auto
Is this what you want to achieve? Or do you want that for OS services?
Yes possible in process level and tried before.
The doubte is when we have a process running multiple services, how can we detect which service is the most consumer.
Let think about it and try to find a way 🙂
It's simple - there is no way how to do that. That's because the memory is shared between services in a process instance. It's one piece of code.
For CPU this is possible since you can measure the CPU cycles spent during request processing and Dynatrace is providing you with such metrics.