Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Using uptimerobot's webhook with cloudflare to achieve HA (downtime no longer than ~6 minutes)
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Using uptimerobot's webhook with cloudflare to achieve HA (downtime no longer than ~6 minutes)

blackblack Member
edited July 2014 in Tutorials

The script - https://raw.githubusercontent.com/blackdotsh/UptimeFlare/master/renameMe.php




License: MIT

Dependencies: Web Server, PHP, php-curl lib


Setup:

1. I suggest you rename the php file to something obscure.

2. Add / change the global vars section. It consists of credentials and other information that needs to be modified to your needs.

3. Upload this script to the desired server, make sure the script is accessible via the internet.

4. On uptimeRobot:

Create a new alert contact and select web hook. For url, put in the url to the php script and add "?key=YourKeySetInThePHPScript&"

If my $key was set to HelloWorld and I renamed my script to monitorUP.php which is accessible via 127.0.0.1, then for the url I would put

 http://127.0.0.1/monitorUP.php?key=HelloWorld&; 
Make sure you have the & at the end. There's no ; at the end, I don't know how to fix the formatting on vanilla forums :/

5. Add this alert type to your websites. It's recommended that you have more than the PHP hook as an alert type, so you can switch it back to the primary server once it's up. With this setup, a website shouldn't have a downtime of more than ~6 minutes, assuming your DNS provider does not cache queries.


Enjoy :D

Comments

  • The problem with most monitorings is that they don't give users their IP's to whitelist. At least they don't give a way to get them by robot/script - it's really a shit to parse their pages just to get IP's. It usually cause the problems for such scripts to work correctly.

    The only free monitoring i know, which gives you IP's in good formats, is StatusCake. So, would love to see StatusCake support in your script. https://www.statuscake.com/API/Locations/txt

  • blackblack Member

    Profforg said: The problem with most monitorings is that they don't give users their IP's to whitelist.

    http://uptimerobot.com/locations

    Thanked by 1wych
  • wychwych Member
    edited July 2014

    I imagine that will be useful for alot of people,

    although a simple google search did show it for me when I wanted that list ;)

  • black said: http://uptimerobot.com/locations

    Profforg said: At least they don't give a way to get them by robot/script - it's really a shit to parse their pages just to get IP's.

    To get IP's from your URL - i will need to write a parser. I don't want to waste time for it. In the URL there must not be any information, except IP networks.

  • Profforg said: To get IP's from your URL - i will need to write a parser. I don't want to waste time for it. In the URL there must not be any information, except IP networks.

    Just get the information from their DNS servers. If they change you get immediate updates. No need to parse HTML.

  • NodePingNodePing Member
    edited July 2014

    Profforg said: At least they don't give a way to get them by robot/script

    We publish our locations via:

  • Silvenga said: Just get the information from their DNS servers. If they change you get immediate updates. No need to parse HTML.

    And what if they will add new DNS names? It's not a static list.

    NodePing said: We publish our locations via:

    https://nodeping.com/FAQ#Monitoring_IPs

    https://nodeping.com/content/txt/pinghosts.txt

    DNS query: probes.nodeping.com

    Good for you, but you don't have free plan.

    P.S. Cool idea with DNS query.

  • jarjar Patron Provider, Top Host, Veteran
    edited July 2014

    Problem with uptime robot is that it either uses ping or it gives insane false positives. I still use it, I'm not sure why, I just laugh at the weekly false positives I get at multiple locations on multiple networks, for sites I can actively visit. Ping has it's own problems as a standalone test. DDOS protection, for example, might sometimes block ICMP entirely (depends on the circumstance/equipment).

    Send a feature request to port-monitor.com, these guys are awesome :)

  • blackblack Member

    @Jar said:
    Problem with uptime robot is that it either uses ping or it gives insane false positives. I still use it, I'm not sure why, I just laugh at the weekly false positives I get at multiple locations on multiple networks, for sites I can actively visit. Ping has it's own problems as a standalone test. DDOS protection, for example, might sometimes block ICMP entirely (depends on the circumstance/equipment).

    I have noticed some false positives as well but I recall that happening awhile ago, lately it's been fine. The initial implementation did a double check to make sure the website is down but I removed it for some reason. Perhaps I'll add that back in the next update.

  • said: I don't know how to fix the formatting on vanilla forums :/

    cough &

  • blackblack Member

    Rallias said: cough &

    Shoot, I can't edit my post anymore.

    Can @mpkossen @Spirit @jcaleb @vedran @Nekki edit my post and remove the ";". Thanks!

  • AmitzAmitz Member
    edited July 2014

    Funny, I had/have no problems with false positives and Uptimerobot.

    Thanks to the OP for the script!

  • howardsl2howardsl2 Member
    edited July 2014

    Thank you @black for the useful script.

    An alternative method to achieve HA is to use Monit and Cloudflare:
    http://blog.booru.org/?p=12

    (Credit goes to @INIZ as he mentioned it in an older thread.)

    If the link above does not work for you, try google's cache:
    http://webcache.googleusercontent.com/search?q=cache:GHKoHAU_-FoJ:blog.booru.org/?p=12+&cd=5&hl=en&ct=clnk&gl=us

  • mikhomikho Member, Host Rep

    David_P wrote a nice guide here http://www.lowendguide.com/3/monitoring/setup-a-ha-round-robin-blog-on-debian-7-with-cloudflare/
    On using multiple Lowendspirit.com servers on different locations with one monitoring server to update the DNS records at Cloudflare.

  • blackblack Member
    edited July 2014

    Interesting reads. I made a conscious decision when I chose uptimerobot for monitoring, as they have servers in different locations so when one server says it's down, the others can confirm. It's free and I don't have to maintain these servers.

    In the next release, the script will check the backup server to see if it's up. If it is, then switch to it. I also plan on adding the ability to give the script a list of backup servers, so in case a backup server fails, it'll check the next available backup server.

    Edit: Script now checks to make sure the backup IP is accessible via HTTP before switching to the failover server. I need to add something like config.php and use require_once for easier use.

  • black said: I made a conscious decision when I chose uptimerobot for monitoring, as they have servers in different locations so when one server says it's down, the others can confirm. It's free and I don't have to maintain these servers.

    Did you ever tried to read other monitoring websites? Many of them are using confirmation servers. You looks like to spam uptimerobot. Are you affiliated?

    Statuscake also have different servers and you can even set the number of Confirmation Servers (on free plan either).

  • Profforg said: Did you ever tried to read other monitoring websites? Many of them are using confirmation servers. You looks like to spam uptimerobot. Are you affiliated?

    I don't think this is the case, and he's been an active member for a long time. I'm not entirely sure why you're being so narcissistic.

    I wish some other monitoring providers weren't so expensive; I found a few more that look decent, and have a free / cheap plan:

    Any others to add? I've been looking for a while now since StatusCake increased their prices.

  • Profforg said: Did you ever tried to read other monitoring websites? Many of them are using confirmation servers. You looks like to spam uptimerobot. Are you affiliated?

    It's not my intention to spam "uptimerobot", it's a service I have used for a long time and I've had a positive experience with them. When they released a webhooks feature, I took an initiative to build something off of it. I am not affiliated with them in any way.

    Profforg said: Statuscake also have different servers and you can even set the number of Confirmation Servers (on free plan either).

    Statuscake doesn't have https monitoring on the free plan, hence why I never tried them. I don't really need to try other monitoring services because the current one I use works fine for my needs.

  • black said: Statuscake doesn't have https monitoring on the free plan, hence why I never tried them.

    There are no problem with https on their free plan. Just no certificate monitoring. Uptimerobot don't have a feature to check certificate, as i know.

  • You looks like to spam statuscake. Are you affiliated?

  • Amitz said: You looks like to spam statuscake. Are you affiliated?

    Sure

  • @Profforg said:
    There are no problem with https on their free plan. Just no certificate monitoring. Uptimerobot don't have a feature to check certificate, as i know.

    I see, when I was looking at their pricing list they had an "X" on SSL monitoring so I assumed it doesn't support SSL. I signed up to see if it does any better than UptimeRobot. Their "Ping URL" looks remarkably similar to web hooks, so it'd be an easy transition.

  • awvnxawvnx Member
    edited August 2014

    pingdom also has a free plan for one web page to monitor, when registering from Cloudflare. One minute uptime monitoring, response time, and realtime page load time monitoring (if adding some Javascript). They publish their IP's too.

    Not sure if you can sign up for multiple domains in Cloudflare to get more free plans.

  • black said: I see, when I was looking at their pricing list they had an "X" on SSL monitoring so I assumed it doesn't support SSL. I signed up to see if it does any better than UptimeRobot. Their "Ping URL" looks remarkably similar to web hooks, so it'd be an easy transition.

    Yes, they do. Support for statuscake for this script would be awesome.

    awvnx said: pingdom also has a free plan for one web page to monitor, when registering from Cloudflare. One minute uptime monitoring, response time, and realtime page load time monitoring (if adding some Javascript).

    Pingdom looks like greedy hucksters. They let you use only one page to monitor when there are many better companies, which will let you monitor hundreds of pages for free. Also, before there was only 15 minutes interval for free plan, as i remember. And their e-mails seems to be highly delayed. Maybe things better now, but i guess it's a bad company.

  • @Profforg said:
    Sure

    Damn! Do I have to put tags around everything I write so that people understand that I am just making some fun? ;-)

  • awvnxawvnx Member
    edited August 2014

    @Profforg said:
    Pingdom looks like greedy hucksters. They let you use only one page to monitor when there are many better companies, which will let you monitor hundreds of pages for free. Also, before there was only 15 minutes interval for free plan, as i remember. And their e-mails seems to be highly delayed. Maybe things better now, but i guess it's a bad company.

    I think you get what you pay for. One minute checking and I got emails to my gmail instantly when the site went down. But yeah, it's pricey if you want more than one page to monitor. Works fine for my purpose, although I'd look elsewhere if I wanted to monitor more stuff.

Sign In or Register to comment.