Forum Discussion

Kelemvor's avatar
Icon for Expert rankExpert
10 months ago

Any way to only generate alerts during business hours?


We have a Datasource that runs a script to check the status of a Job.  That Job only runs during business hours (e.g. 8-5 M-F).  We need a way to not have it check after hours.

Option 1 was to set a recurring SDT.  This would stop the notifications, but the checks would still show as alerts in the UI so we don’t want that.

Option 2 was to set Time-based thresholds within the Datasource.  However, that doesn’t let you specify Days of the Week anywhere so that also won’t work.

Anyone have any other ideas on how we can configure this to only check and alert during business hours?


4 Replies

  • You could add logic to your script to output a 0 or 1 depending on whether or not the current poll was happening within business hours. Then make a complex datapoint that multiplies that datapoint against the current output you have. 

  • Follow up prompt:

    If the function determines that the current time is during business hours, print "business_hours: 1". If it's outside business hours, print "business_hours: 0"

    Then your datapoint would use the key “business_hours”. You’d create a complex datapoint to multiply business_hours against your resulting data. Outside business hours, you should get 0. Flip the 0 and 1 if you want it the other way around.