#1  
Old 17th December 2014, 21:51
loadingjkr loadingjkr is offline
Senior Member
 
Join Date: May 2012
Location: Perú
Posts: 102
Thanks: 23
Thanked 0 Times in 0 Posts
Thumbs up Uptime site script API

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

Code:
config.example.js
to
Code:
config.js
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 by loadingjkr; 17th December 2014 at 22:12.
Reply With Quote
Sponsored Links
  #2  
Old 17th December 2014, 22:00
loadingjkr loadingjkr is offline
Senior Member
 
Join Date: May 2012
Location: Perú
Posts: 102
Thanks: 23
Thanked 0 Times in 0 Posts
 
Thumbs up

another form with Php code


Code:
<?php
echo "<table><tr><th>Monitor Name</th><th>Status</th><th>Total Uptime</th></tr>";
$apiKey = "PASTE YOUR API CODE HERE";
$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>";
?>
result

This will output something like this:
Monitor Name | Status | Total Uptime
Server 1 | Online | 99.97%
Server 2 | Offline | 94.91%
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Backup script for ISPConfig 3 datahellas Tips/Tricks/Mods 6 22nd April 2012 17:16
Cannot login to phpmyadmin penkku HOWTO-Related Questions 1 24th February 2011 10:26
Need help with PHP script for IP address of sites jeetesting Programming/Scripts 3 7th June 2008 11:30
web site install cruz Installation/Configuration 18 30th May 2007 12:20
apache2 problem laser144 Server Operation 8 15th March 2007 18:32


All times are GMT +2. The time now is 03:34.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.