Re: Proposal for Network::Monitor

From: Date: Fri, 05 Nov 2004 12:11:13 +0000
Subject: Re: Proposal for Network::Monitor
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-34210@lists.php.net to get a copy of this message
Robert Peake wrote:
Hi All, This seems like a potentially useful package to write. Looking forward to comments. Best, Robert @link: http://pear.php.net/pepr/pepr-proposal-show.php?id=171 Purpose To provide a unified interface for checking the availability services on external servers and sending meaningful alerts through a variety of media if a service becomes unavailable. Elements The service monitoring aspect of this package is essentially a unified interface to a number of packages designed to interact with Internet services. Initially, this list includes:
    * Net_SMTP
    * HTTP_Request
    * Net_DNS
    * Net_FTP
And would also include the Net_Telnet package that is currently being proposed. The alert generation aspect is represented entirely through the use of PEAR_Error objects. The alert sending aspect is currently a unified interface to:
    * Net_SMTP
    * Net_SMS
whereby messages can be generated and sent directly from the package. This makes this package more robust in the event that the monitored servce that goes down is the SMTP relay for the package itself -- the package can still generate and send an SMTP message to an external address. Structure The package object inputs and stores two arrays -- one representing the person(s) to be notified in the event of a failure and the other representing the servers to be monitored. Each person can be assigned a notification type (currently SMTP, SMS, or both). Each server can be assigned any number and combination of services to be monitored (currently SMTP, HTTP, DNS, and FTP). Application The most common application for this package is a simple monitoring script that cna be run at a scheduled interval to check remote services and send an alert if a service is down. <?PHP require('Net/Monitor.php'); $monitor = new Net_Monitor(); $users = array('User1' => array('SMTP'=>'user1@example.com'),
               'User2' => array('SMTP'=>'user2@example.com');
$servers = array('foo.example.com'=>array('SMTP','DNS'),
                 'bar.example.com'=>array('HTTP','FTP','DNS'));
$monitor->setUsers($users); $monitor->setServers($servers); $monitor->checkAll(); ?> » Dependencies
    * Net_SMTP
    * HTTP_Request
    * Net_DNS
    * Net_FTP
(others to follow)
Nice idea. In order to evaluate the quality of a hosting provider, it would be nice if it was also able to archive response timings. One could easily generate graphs with this data (with Image_Graph), to see if (and how many) times the server was down, and how fast it responds. -- og

« previous php.pear.dev (#34210) next »