cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Mark Synthetic check as OK when website in maintenance mode

jake_hardy
Participant

Hi, we've had a request to implement monitoring against a web platform, one of the considerations they've asked for however is that if the website is in maintenance mode then the system should continue to report as available (not callout).

We've seen with a standard journey we;
1. Access the URL
2. Enter username
3. Enter password & login
4. enter postcode

We've seen when the maintenance mode is active, the journey fails at step 4.

As a means to skip the rest of the journey if some text is present (indicating maintenance mode) i've tried to implement the following;
https://www.dynatrace.com/support/doc/synthetic/recorder/custom-scripting/scripting-conditional-page...

I'm seeing failures when running this against the active site (in xxxx.live.dynatrace.com). Could anyone advise if it's possible to implement a function that would do this?


4 REPLIES 4

HannahM
Dynatrace Pro
Dynatrace Pro

Hi Jake,

adding conditional code is the correct way to do this. The link you have provided is for our Classic Product rather than SaaS. For SaaS, you need to use a JavaScript event and can set the script to finish or skip the rest of the events. You can find more information on this here.

Best wishes, Hannah


Hi @Hannah M.

Thanks for sharing this. I'm not too familiar with javascript. I've written this with the assistance of StackOverflow

"if (

(

document.documentElement.textContent || document.documentElement.innerText

).indexOf('The website is currently undergoing maintenance, please try again later.') > -1

) {

// Do something...

api.skipNextSyntheticEvents(21);

}"


This event is set at position 4 & there are 25 total events, does this look correct?


Yes, that looks good.


Don_Meuth
Guide

Since Synthetic Monitor knows that the site is under maintenance mode, at least for Alerting, is there something that in the script could be used in a similar manner.... basically


if (Site is under scheduled maintenance) . # Some flag/field in Dynatrace that could be used here

then

exit

endif