# Custom Alerting - BatchJob Method Innvocation Count

**URL:** <https://community.dynatrace.com/t/custom-alerting-batchjob-method-innvocation-count/30842>\
**Category:** Alerting\
**Tags:** problems-classic\
**Created:** [March 18, 2021, 5:16pm UTC](https://community.dynatrace.com/t/custom-alerting-batchjob-method-innvocation-count/30842 "2021-03-18T17:16:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shahrukh\_niazi](https://avatars.discourse-cdn.com/v4/letter/s/ecd19e/32.png) [@shahrukh\_niazi](https://community.dynatrace.com/u/shahrukh_niazi)\
**Post date:** [March 18, 2021, 5:16pm UTC](https://community.dynatrace.com/t/custom-alerting-batchjob-method-innvocation-count/30842/1 "2021-03-18T17:16:42Z")

</div>

I have defined my Batchjobs as a key service

I have 3 Batchjobs,

(1) runs/hour

(2) runs/24hour and

the 3rd one runs/week

All i want is to be alerted if the Batchjobs method invocation is \<1,&nbsp; does not get executed in an hour or in 24 Hours & in the 3rd case once a week

If BatchJob() count is below \<1 in an hour, raise an alert …This would tell me the BatchJob has not executed in its pre defined execution times

Is this even possible in custom alerting? how ?

I treid using RequestCount

but looks like its averging the count which is not i want

as the average value is below 1 …looks like its throughput/min

All i am looking for is when method innvocation count is \<1 for more than 24 hours, fire an email alert

 ![dy1.jpg](https://global.discourse-cdn.com/dynatrace/original/2X/4/424e0fb79846c5e1e6aa78f3d0012783f32d44c2.jpeg)  
 ![dy.jpg](https://global.discourse-cdn.com/dynatrace/original/2X/9/918107b0543c016c0d9e6b7ece5bec7f2a164ac0.jpeg)  
 ![dy2png.jpg](https://global.discourse-cdn.com/dynatrace/original/3X/e/8/e8ba7a33ce28e34d106d6670a898696683197d7c.jpeg)

---

<div class="post-metadata">

**Author:** ![Babar\_Qayyum](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/babar_qayyum/32/13620_2.png) [@Babar\_Qayyum](https://community.dynatrace.com/u/Babar_Qayyum)\
**Post date:** [March 20, 2021, 7:32am UTC](https://community.dynatrace.com/t/custom-alerting-batchjob-method-innvocation-count/30842/2 "2021-03-20T07:32:13Z")

</div>

Hello&nbsp;[@shahrukh\_niazi](https://community.dynatrace.com/user/28206)

You can create a&nbsp;Multidimensional analysis for the key request with the following:

 ![BabarQayyum_0-1616225093931.png](https://global.discourse-cdn.com/dynatrace/original/2X/7/7005a46c909a52e7cd7d25aa4981f094d549def5.png)

Then create a calculated metric.

 ![BabarQayyum_1-1616225143747.png](https://global.discourse-cdn.com/dynatrace/original/3X/3/0/3021d9188eb6cf4684ea4939db42ff8bc348ebd9.png)

Then&nbsp;Create a custom event for alerting.

 ![BabarQayyum_2-1616225385649.png](https://global.discourse-cdn.com/dynatrace/original/2X/7/7145b12cd677a8bfc932c6e0b91265c25efb0ddb.png)

Then you can use this&nbsp;custom event for alerting profile.

Regards,

Babar

---

<div class="post-metadata">

**Author:** ![shahrukh\_niazi](https://avatars.discourse-cdn.com/v4/letter/s/ecd19e/32.png) [@shahrukh\_niazi](https://community.dynatrace.com/u/shahrukh_niazi)\
**Post date:** [March 20, 2021, 9:11pm UTC](https://community.dynatrace.com/t/custom-alerting-batchjob-method-innvocation-count/30842/3 "2021-03-20T21:11:34Z")

</div>

Thanks Baber. That was it.

I have few BatchJobs that runs daily from 8am to 6pm.&nbsp; They remain off on weekends and after 6pm business days. I doubt Dynatrace can map alerting based on the above conditions. Alert only during business hours if count \<1&nbsp; , or in some cases they run on Weekends only , one time on Saturday & once on weekend.

I doubt this alerting requirement can be mapped to Dynatrace alerting profile

---

<div class="post-metadata">

**Author:** ![Babar\_Qayyum](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/babar_qayyum/32/13620_2.png) [@Babar\_Qayyum](https://community.dynatrace.com/u/Babar_Qayyum)\
**Post date:** [March 21, 2021, 5:36am UTC](https://community.dynatrace.com/t/custom-alerting-batchjob-method-innvocation-count/30842/4 "2021-03-21T05:36:53Z")

</div>

Hello&nbsp;[@shahrukh\_niazi](https://community.dynatrace.com/user/28206)

You can use the maintenance windows for this purpose.

> **[Maintenance windows](https://docs.dynatrace.com/docs/analyze-explore-automate/alerting-and-notifications-classic/maintenance-windows)**
>
> Understand when to use a maintenance window. Read about the supported maintenance window types.

Regards,

Babar
