monitorThe monitor class. This is the entity which contains the details of what is to be monitored, how it is to be monitored and what to do if a given condition arises.
Located in /monitor-defs.php (line 701)
monitor
monitor
([string $name = ""], [string $emailto = ""], [string $emailfrom = ""], [string $emailpager = ""], [string $lockfilepath = ""])
mixed
$condition
= COND_OK (line 729)
Monitor worst case condition
mixed
$emailfrom
= "" (line 708)
Address monitor messages come from
mixed
$emailpager
= "" (line 710)
Address to email SMS txt messages
mixed
$emailto
= "" (line 706)
Address to email monitor messages
mixed
$email_condition_threshold
= COND_WARNING (line 738)
Threshold condition for emailing
mixed
$hostname
= "" (line 717)
Local hostname we are running monitor on
mixed
$locked
= false (line 726)
True if we are locked via lockfile
mixed
$lockfile
(line 723)
Monitor lockfile object
mixed
$lockfilepath
= "" (line 712)
Monitor lockfile path
mixed
$monitors
= array() (line 750)
Array of monitors which do the work
mixed
$name
= "" (line 704)
The name of this monitor instance
mixed
$pager_condition_threshold
= COND_ERROR (line 741)
Threshold condition for paging
mixed
$reportmsg
= "" (line 732)
Report staging for email
mixed
$schedule
(line 747)
Schedule of named timeslots for this monitor
mixed
$smstxtmsg
= "" (line 735)
Report staging for SMS txt
mixed
$tinow
(line 744)
The current Unix timestamp
mixed
$use_lockfile
= true (line 720)
Whether to use a lockfile
Create a new monitor object.
Add a new monitor. Eg. file_monitor, postgres_monitor etc. This just stuffs the object in an array ready to be checked.
Add a time slot to the schedule. This requires two times as per 24hr clock which define a time interval during the day, and gives it a name. You can define any number of these. Timeslots have to be in HH:MM format, separated by a dash "-", eg: '07:30-11:45'.
Check all monitors. Just iterate through them and raise the conditions
contained in the reports each one returns. After collecting the details, we notify anyone which needs to know. If any condition returned from a check is FATAL, then the rule is we stop processing any further checks. Processing is done in order of definition of the monitors added, so put your critical ones first. NOTE: This method always performs a lock() before processing all the monitors, then performs an unlock() at the end.
Iterate through all our monitors, checking in each case. Each monitor will implement its own kind of checking and set its condition afterward.
Raise a condition. The single parameter to this method is a monitor object which will have had its check() method called. This contains the resulting condition and any messages to notify.
Sets the threshold at which we will send messages to email & pager.
Any conditions equal or worse than the threshold will be sent if the message is not nullstring.
Documentation generated by phpDocumentor 1.3.0RC3