WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Site Monitor
Categories : PHP Update Picture
Demian Turner
Date : Oct 15th 2001
Grade : 5 of 5 (graded 2 times)
Viewed : 3384
File : siteMonitor.php
Images : No Images for this code example.
Search : More code by Demian Turner
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

<?php
//        siteMonitor.php

//        a utility designed to send out an email if pingtimes
//        on a target server exceed desired delay times

//        system call to ping desired host, use IP address
        $rawPing = `ping -c 10 xxx.xxx.xxx.xxx`;

//        extract average time from string
        eregi("mdev = (.*)ms", $rawPing, $return);

//        grab desired first element of array and assign to $string
        $strPing = $return[0];

//        echo to screen for debugging :)
        echo("<br> raw string =" . $strPing);

//        extract average delay from string
        $delaySeconds = substr($strPing, 13, 5);

//        convert to conventional milliseconds
        $delayMilliseconds = $delaySeconds * 1000;

//        echo to screen for debugging :)
        echo("<br> formatted string =" . $delayMilliseconds);

//        send out warning email if desired pingtime exceeded
        if ($delayMilliseconds > 200)        {
mail ("user@domain.com", "we've got a delay here
                of $delayMilliseconds milliseconds", "");
        }
?>



Query2Report : Generating Html, Pdf and Csv Reports from SQL Query
Categories : PHP, PHP, HTML, PDF, Excel
Calendar using Date function
Categories : HTML and PHP, PHP, Date Time, Calendar
Invision Forums Latest Threads list
Categories : PHP, Miscellaneous, Databases, MySQL
Pseudo Non Parsed Header. Output to the the browser as the script runs.
Categories : PHP, HTTP, HTML and PHP
UDMSearch - a free search engine, indexing system.
Categories : Search Engines, Linux, PHP, MySQL, ODBC
how to check if a string contains a letter from a different language?
Categories : PHP, Regexps, Languages
Unix Disk Information with graphs
Categories : PHP, Shell Scripting, Filesystem
fforum fumanchi forum MySQL treestructure
Categories : Complete Programs, PHP, MySQL
ibase_close -- Close a connection to an InterBase database
Categories : PHP, PHP Functions, InterBase
Display variables when a form is submitted using POST/GET
Categories : PHP, Functions, Variables, Debugging
Sort the results from a SELECT query (any number of columns) into an array automatically.
Categories : PHP, PHP Classes, Arrays, Databases, MySQL
directory, opendir, listfiles, files in a directory, get directory
Categories : PHP, Filesystem
Show Source with Line Numbers
Categories : PHP, Regexps, Filesystem
Will a call to pg_Close terminate a persistent PostgreSQL connection? (i.e. one opened with pg_pConnect)
Categories : PostgreSQL, PHP
Tropicalm Genetree Family (MySQL based family tree)
Categories : PHP, Interfaces, Databases, MySQL, Complete Programs
 Demian Turner wrote :719
This script has been tailored to what "ping -c" returns on a Redhat 7.1 Linux installation.  You may need to customise the string parsing to your particular system.  The script is explained in more detail at http://www.phpkitchen.com/article.php?story=2001070313581898