SwitchProvider is a Custom Notification that allows you to automatically switch over to another hosting provider when your website is down.
The HTTPFailoverSite Custom Sensor can detect if a failover site is up, but leaves the decision to you to manually change your DNS records.
SwitchProvider takes it one step further. In combination with a standard HTTP sensor, it automatically switches over to the first provider that is up.
Step 1/3
•
This is your starting point
•
You have setup a standard HTTP sensor on your PRTG server that checks your website.
•
The DNS record at your Domain Registrar points to your hosting provider
Step 2/3
•
Register a free account at DNSdynamic.org and create a new domain name (mydomain.dnsd.info) with the IP address of your Hosting Provider.
•
At your Domain Registrar, remove the A Record and create a new CName Record for your domain, pointing to the domain name at DNSdynamic.org
•
Convince yourself that your website is still reachable.
Step 3/3
•
PRTG's HTTP sensor has detected that your website is down
•
The PTF.SwitchProvider notification is fired and finds your failover provider in its .ini file
•
PTF.SwitchProvider checks if the failover is up and changes the IP setting at DNSdynamic.org
•
Within minutes, your website is up again!
PTF.SwitchProvider gets its settings from the SwitchProvider.ini file. Both the .exe and the .ini file need to be placed in the \Notifications\EXE folder of your PRTG installation. The .ini file contains information about your domain, your hosting providers, your DNSdynamic account and information that makes it possible to send you an email when a provider switch has taken place.
.INI File
[domain] name=mydomain.com pagetitle=Welcome at my domain
The [domain] section holds information about your domain name and the title of your home page. The pagetitle field can be left empty, but provides extra security when switching providers.
You can enter as much [provider] sections as you like. Finding a provider that is up takes place in the order they are listed, so make sure to place your preferred provider at the top of the list.
In the [dnsdynamic] section, you need to enter the information about your DNSdynamic account.
In the [email] section, enter information about your mail server and the user who gets an email when provider switching has taken place.
Tip: all passwords can be encrypted, using the PassHash tool. This prevents them from being stored in plain text.
Test your setup Use the -p= parameter to force SwitchProvider to switch to a specific provider. I.E.SwitchProvider.exe -p=Provider1 or SwitchProvider.exe -p=Provider2. Next, open your DNSdynamic account and check that your dns record has changed.
Setting up the Notification After copying the SwitchProvider.exe and .ini file to the \Notifications\EXE folder of your PRTG installation and modifying the content of the .ini file, you need to create a new notification on your PRTG server. Name the notification 'Switch hosting provider', choose to execute a program and select the Switchprovider.exe program. The parameter field can be left empty. On the HTTP sensor, go to the 'Notifications' tab and under 'Object Triggers' add a new 'State Trigger' that will fire the new 'Switch hosting provider' notification when the HTTP sensor is down for more than 300 seconds. (see image below)
Finished When your website is down for more than 5 minutes (300 seconds), your DNS record will automatically switch to the first provider in the .ini file that is up.
Tip: running the Switchprovider.exe as a scheduled task will automatically switch DNS record back to your preferred hosting provider when it is up again.
SWITCHPROVIDER
The slides below will show you how to set up your DNS records in order to accomplish this.