Counters Code
  Home arrow Counters Code arrow Server Uptime Statistics
Moblin
Try It Free
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Forums Sitemap 
Dedicated Servers  
Download TestComplete 
JMSL Numerical Library 
IBM® developerWorks
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
COUNTERS CODE

Server Uptime Statistics
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2004-08-24

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
    Try It Free
     
    ADVERTISEMENT

    Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!

    This script generates a table of values which contain the following data:

    Average server load
    Server Uptime (In days)
    Server Uptime (as percentage of the year so far)
    Server Name
    Server Port
    Server Software
    Server Gateway

    This is displayed on the browser for either your personal use or for public display.

    You can find more scripts on my site here

    By : Andrew

    <?php
    /*
    Author: Andrew Walsh
    Username: Andrew
    Email: andrew@walshdev.com
    Url: http://walshdev.com
    */
    $uptime = @exec('uptime');
    preg_match("/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/",$uptime,$avgs);
    $uptime = explode(' up ', $uptime);
    $uptime = explode(',', $uptime[1]);
    $uptime = $uptime[0].', '.$uptime[1];
    $start=mktime(0, 0, 0, 1, 1, date("Y"), 0);
    $end=mktime(0, 0, 0, date("m"), date("j"), date("y"), 0);
    $diff=$end-$start;
    $days=$diff/86400;
    $percentage=($uptime/$days) * 100;
    $load=$avgs[1].",".$avgs[2].",".$avgs[3]."";
    $page='<html>
    <head>
    <title>Server Statistics For '.getenv('SERVER_NAME').'</title>
    <style type="text/css">
    td{
    border-style: solid;
    border-width: 1px;
    color: #000000;
    }
    table{
    border-style: solid;
    border-width: 1px;
    color: #000000;
    }
    tr{
    border-style: solid;
    border-width: 1px;
    color: #000000;
    }
    </style>
    </head>

    <body>

    <table width="100%" cellspacing="0" cellpadding="0" style="border: 1 solid #000000" border="1">
    <tr>
    <td width="50%" bgcolor="#3973AC" style="border: 1 solid #000000"><font color="#FFFFFF">Server
    Details</font></td>
    <td width="50%" bgcolor="#3973AC" style="border: 1 solid #000000"><font color="#FFFFFF">Server
    Statistics</font></td>
    </tr>
    <tr>
    <td width="50%" bgcolor="#7CA8D3" style="border: 1 solid #000000">&nbsp;</td>
    <td width="50%" bgcolor="#7CA8D3" style="border: 1 solid #000000">&nbsp;</td>
    </tr>
    <tr>
    <td width="50%" bgcolor="#7CA8D3" style="border: 1 solid #000000"><b>Name:</b>&nbsp;'.getenv('SERVER_NAME').'
    </td>
    <td width="50%" bgcolor="#7CA8D3" style="border: 1 solid #000000"><b>Uptime</b>
    (days): '.$uptime.'</td>
    </tr>
    <tr>
    <td width="50%" bgcolor="#7CA8D3" style="border: 1 solid #000000"><b>Port:</b>
    '.getenv('SERVER_PORT').'</td>
    <td width="50%" bgcolor="#7CA8D3" style="border: 1 solid #000000"><b>Uptime
    </b>
    (%): '.$percentage.'%</td>
    </tr>
    <tr>
    <td width="50%" bgcolor="#7CA8D3" style="border: 1 solid #000000"><b>Software:
    </b>
    '.getenv('SERVER_SOFTWARE').'</td>
    <td width="50%" bgcolor="#7CA8D3" style="border: 1 solid #000000"><b>Load:</b>&nbsp; '.$load.' </td>
    </tr>
    <tr>
    <td width="50%" bgcolor="#7CA8D3" style="border: 1 solid #000000"><b>Protocol:</b>&nbsp; '.getenv('SERVER_PROTOCOL').'</td>
    <td width="50%" bgcolor="#7CA8D3" rowspan="3" style="border: 1 solid #000000"><small>Server statistics provided by <a href="http://www.kendocreations.co.uk">ServerStat</a> 1.0</small></td>
    </tr>
    <tr>
    <td width="50%" bgcolor="#7CA8D3" style="border: 1 solid #000000"><b>Gateway:</b>&nbsp;'.getenv('GATEWAY_INTERFACE').'</td>
    </tr>
    <tr>
    <td width="50%" bgcolor="#7CA8D3" style="border: 1 solid #000000">&nbsp;</td>
    </tr>
    </table>
    <p align="center"><small>Created By: Andrew Walsh</small></p>
    </body>

    </html>';
    echo $page;
    ?>
    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More Counters Code Articles
    More By Codewalkers

     

    IBM® developerWorks developerWorks - FREE Tools!


    NEW! Evaluate IBM Lotus Sametime Standard V8.0

    Visit IBM developerWorks to download a free trial of the latest release of IBM Lotus Sametime Standard V8.0. Lotus Sametime Standard V8.0 is a platform for unified communications and collaboration that combines security features with an extensible, open solution including integrated Voice over IP, geographic location awareness, mobile clients, and a robust Business Partner community offering telephony and video integration.
    FREE! Go There Now!


    NEW! Webcast: Accelerating Software Innovation with System z

    Attend this launch webcast with Scott Hebner, Vice President of IBM Rational Marketing and Strategy, where he will overview Rational’s new offerings and programs to help customers accelerate software innovation on System z. He will discuss how these solutions help organizations extend their core business processes toward modern architectures such as SOA and web technologies to deliver business improvements that stand the test of time.
    FREE! Go There Now!


    NEW! Webcast: Extreme transaction processing with WebSphere Extended Deployment

    In this webcast, you'll get an introduction to the eXtreme Transaction Processing (XTP) features of WebSphere Extended Deployment and the common architectural traits required by XTP applications. See how WebSphere Extended Deployment's ObjectGrid feature provides a state-of-the-art infrastructure for hosting XTP applications.
    FREE! Go There Now!


    NEW! Download IBM WebSphere Portal V6.1 beta code

    Download the IBM WebSphere Portal V6.1 beta code and learn more about the rich features and enhancements in IBM WebSphere Portal V6.1. WebSphere Portal provides a composite application or business mashup framework and the advanced tooling needed to build flexible, SOA-based solutions, and scalability to meet the needs of any size organization.
    FREE! Go There Now!


    NEW! Webcast: Striking the right balance between manual and automated testing

    Join this webcast to learn how IBM Rational's Functional Testing solution enables you to implement automation your way, at your pace, with your existing staff. In this webcast, you’ll learn how you can eliminate redundancy of manual test scripts, reduce errors, and increase test coverage through test automation. After this presentation you will understand how IBM Rational Functional Testing solution can streamline your manual testing and make test automation easily attainable.
    FREE! Go There Now!


    NEW! IBM Rational Systems Development e-Kit

    As systems increase in complexity, communication between systems and software teams becomes more and more difficult. Now, there’s a way to improve product quality and communication.<br />Read the “Model Driven Systems Development” white paper to see how. Also included in this kit are more educational white papers, customer examples, tutorials, informative Webcasts, and best practices for designing, building and managing systems.<br />
    FREE! Go There Now!


    NEW! Try the IBM SOA Sandbox for People

    Visit IBM developerWorks to try the IBM SOA Sandbox for people. The SOA Sandbox for people provides a trial environment with the necessary tooling and components required to enable consistent human and process interaction and collaboration, showing how you can improve user experience and business productivity.
    FREE! Go There Now!


    Role of Integrated Requirements Management in Software Delivery

    As organizations integrate software into every aspect of business, they are constantly pressured to deliver faster, better, and cheaper results. Unfortunately, a “dis-integrated” software delivery approach reduces returns while increasing costs. This IBM Rational White Paper shows how Integrated Requirements Management aligns organizations around maximizing value and keeping pace with change.
    FREE! Go There Now!


    NEW! Best Practices in Integrated Requirements Management

    Poor Requirements Management capabilities in an Enterprise have been linked to excessive project failures, escalating IT costs, and failure to deliver competitive advantage into the marketplace. Join Brianna M Smith from IBM Rational and learn about how successful organizations align IT and Business stakeholders through collaborative processes and tools for effective requirements management, and how an integrated approach across the IT lifecycle can provide unparalleled visibility and traceability to ensure that project teams are delivering on the business vision by "doing the right things" and "doing things right."
    FREE! Go There Now!


    NEW! Don't wait! Try the Rational Application Developer (RAD) v7.5 open beta code today

    Download the Rational Application Developer (RAD) v7.5 open beta code and start developing applications for the JEE5 standard which features EJB3.0, JPA, JSF 1.2, JSP 2.1 and Servlet 2.5 standards. When you use this beta you will see how you can increase developer productivity for already existing applications with improved support for refactoring, as well as adding new features to existing applications. In addition, the beta provides tooling for JD Edwards, Oracle, SAP, Siebel and PeopleSoft to improve the developer productivity with these enterprise systems.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    COUNTERS CODE ARTICLES

    - TG Who's Online
    - Text Based Counter that formats output
    - Counter & visitor statistics
    - Server Uptime Statistics
    - Chris Dingman's Hit Tracker Script
    - Graph Maker Function
    - Simple userOnline class
    - Adv. Log file generator
    - Logwriter
    - time_left()
    - Basic Statistics
    - Easy Counter
    - countCodeLines
    - MySQL Counter
    - bandwidthmeter





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway