Uptime site script API

Discussion in 'Tips/Tricks/Mods' started by S0ft, Dec 17, 2014.

  1. S0ft

    S0ft Member HowtoForge Supporter

    I found a very interesting tool to check your website uptime
    currently I get notifications by email Google Talks + SMS
    level is easy

    I made this tutorial to help my friends on how to create a uptime monitoring service for FREE and show your users how your site is doing!
    You will need some things setup first:
    Part A. An UptimeRobot Account: http://uptimerobot.com/
    Part B. The following files: https://github.com/digibart/upscuits
    Part A:
    1. Get a free account form UptimeRobot
    2. Setup a Monitor and start by using either Ping or HTTP/S.
    3. Then go to "My Settings" at the top if you aren't already there.
    4. Scroll down to the bottom and setup a API (NOT the main API just), it will be labeled: "Monitor-Specific API Keys"
    5. Setup a API Key then go to Part B
    Part B:
    1. Download the files from github
    2. Extract the file and go to the public/js and rename

    3. Open the file config.js and edit the API Key to match your API key
    4. Zip up the whole public folder and upload to your site and then again extract
    5. Done! You can also edit the HTML page if you like, but it is just very nice to leave a developers name there! (I am not the developer)

    Example http://upscuits.pixelbakkerij.nl/
    Last edited: Dec 17, 2014
  2. S0ft

    S0ft Member HowtoForge Supporter

    another form with Php code

    echo "<table><tr><th>Monitor Name</th><th>Status</th><th>Total Uptime</th></tr>";
    $url = "http://api.uptimerobot.com/getMonitors?apiKey=" . $apiKey . "&format=xml";
    $xml = file_get_contents($url);
    $xml = new SimpleXMLElement ($xml);
    foreach($xml->monitor as $monitor) {
      echo "<tr>";
      echo "<td>";
      echo $monitor['friendlyname'];
      echo "</td><td>";
      if ($monitor['status'] == 2) {
        echo "Online";
      elseif ($monitor['status'] == 9) {
        echo "Offline";
      else {
        echo "Not Available";
      echo "</td><td>";
      if ($monitor['alltimeuptimeratio'] > 95) {
        echo "<b style=\"color:green;\">" . $monitor['alltimeuptimeratio'] . "%</b></td></tr>";
      else {
        echo "<b style=\"color:red;\">" . $monitor['alltimeuptimeratio'] . "%</b></td></tr>";
    echo "</table>";

    This will output something like this:
    Monitor Name | Status | Total Uptime
    Server 1 | Online | 99.97%
    Server 2 | Offline | 94.91%
  3. Shobha Patwal

    Shobha Patwal New Member

    How to do it using APIV2 of uptime robot , I want to show response time..
  4. S0ft

    S0ft Member HowtoForge Supporter

    With this script you can do something like this
    It shouldn't be difficult, you don't even need uptimerobot to create this script with PHP
    You need an IP block, then it passes it to the arrays of each IP and pings with PHP every IP every 5, if an IP is inactive with PHP, you can configure it by mailing it shows all the results with a loop

Share This Page