Net_Monitor
[ class tree: Net_Monitor ] [ index: Net_Monitor ] [ all elements ]

Class: Net_Monitor

Source Location: /Net_Monitor-0.2.1/Net/Monitor.php

Class Overview


class Net_Monitor


Author(s):

Methods


Inherited Variables

Inherited Methods


Class Details

[line 39]
class Net_Monitor
  • Access: public


[ Top ]


Method Detail

Net_Monitor (Constructor)   [line 122]

void Net_Monitor( [array $services = array()], [array $alerts = array()], [ $options = array()])

function Net_Monitor
  • Access: public

Parameters:

array   $services   — 
array   $alerts   — 
   $options   — 

[ Top ]

check   [line 270]

mixed check( mixed $server, string $service)

function check

Check a single service ($service) on a single server ($server)

  • Access: public

Parameters:

mixed   $server   — 
string   $service   — 

[ Top ]

checkAll   [line 206]

void checkAll( )

function checkAll

Checks all services and sends all alerts.

  • Access: public

[ Top ]

getState   [line 420]

array getState( )

function getState

Retrieves previous state information from the directory specified in $_options['state_directory'] via a file named $_options['state_file']

  • Access: public

[ Top ]

loadAlerters   [line 310]

void loadAlerters( )

function loadAlerters

Load alert objects into Net_Monitor so that each type of alert is only used once.

  • Access: public

[ Top ]

loadClients   [line 285]

void loadClients( )

function loadClients

Load all clients into the Net_Monitor object so that each type of service client is only instantiated once.

  • Access: public

[ Top ]

printAlert   [line 565]

void printAlert( string $host, string $service, array $result)

function printAlert

Prints the alert for a host/service to STDOUT. Formats the alert according to $_options['alert_line'].

  • Access: public

Parameters:

string   $host   — 
string   $service   — 
array   $result   —  (code, message)

[ Top ]

resetHostState   [line 533]

void resetHostState( string $host, [mixed $service = null])

function resetHostState

Resets the state for a single host ($host). Optionally takes in a second parameter, $service which maybe an array, whereby the function only resets the results for that/those particular host/service test.

  • Access: public

Parameters:

string   $host   — 
mixed   $service   — 

[ Top ]

resetState   [line 504]

boolean resetState( )

function resetState

Resets the results and results differential arrays and deletes the state file.

Returns true if the file has been deleted or never existed in the first place; false otherwise.

  • Access: public

[ Top ]

saveState   [line 388]

void saveState( [array $results = null])

function saveState

Saves the current $_results array to the directory specified in $_options['state_directory'] as a file named $_options['state_file'].

If an array ($results) is passed to the function, that array is saved as state, otherwise this function acts upon $_results.

  • Access: public

Parameters:

array   $results   — 

[ Top ]

setAlerts   [line 186]

void setAlerts( array $alerts)

function setAlerts

Sets the alerts for the class

Overwrites $_alerts with input array ($alerts)

Net_Monitor_Alerts are of the form:

 $alerts = array('User1' => array('SMTP'=>'user1@example.com'),
                 'User2' => array('SMTP'=>'user2@example.com'));


Parameters:

array   $alerts   — 

[ Top ]

setOptions   [line 145]

void setOptions( array $options)

function setOptions

Sets additional options for the class

Merges input array ($options) with $this->_options

  • Access: public

Parameters:

array   $options   — 

[ Top ]

setServices   [line 167]

void setServices( array $services)

function setServices

Sets the services to monitor for the class

Overwrites $_services with input array ($services)

Net_Monitor_Services are of the form:

 $services = array('foo.example.com'=>array('SMTP','DNS'),
                   'bar.example.com'=>array('HTTP','FTP','DNS'));

  • Access: public

Parameters:

array   $services   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:30:59 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.