ScheduleDate_Model Class Reference

Class ScheduleDate_Model. More...

Public Member Functions

 get_downtime_command ($downtime, $obj_name)
 Returns a formatted downtime command.
 matches_recurrence ($downtime, $target_date)
 schedule_downtime ($timestamp=false, $schedules=false)
 Schedule downtime.
 edit_schedule ($data, &$id=false)
 Save/update a recurring schedule.
 delete_schedule ($id)
 Delete a scheduled recurring downtime.

Static Public Member Functions

static insert_downtimes ($objects, $object_type, $start_time, $end_time, $start_date, $end_date, $fixed, $duration, $comment)
 Schedule a downtime by submitting it to nagios.
static time_to_seconds ($time)
 Given a time-like string (hh[:mm[:ss]]), return the number of seconds involved.

Static Public Attributes

static $valid_fields
 Fields that a schedule include.
static $valid_types
 A list of valid schedule types - same format (no underscore, trailing s) as in report options.

Protected Member Functions

 get_downtime_objects ($sched, $downtime_window)
 Returns a list of objects eligible for downtime.

Static Protected Member Functions

static check_if_scheduled ($type, $name, $start_time, $end_time, $is_fixed)
 Use a reasonable amount of indicators to determine whether there's already a matching downtime.
static get_nagios_cmd ($type)
 Returns appropriate nagios command.
static determine_downtimetype ($report_type=false)
 Returns appropriate nagios command.

Detailed Description

Class ScheduleDate_Model.


Member Function Documentation

static ScheduleDate_Model::check_if_scheduled ( type,
name,
start_time,
end_time,
is_fixed 
) [static, protected]

Use a reasonable amount of indicators to determine whether there's already a matching downtime.

This prevents downtimes from being scheduled more than once.

ScheduleDate_Model::delete_schedule ( id  ) 

Delete a scheduled recurring downtime.

Parameters:
$id ID of the downtime to delete
Returns:
true on success, false otherwise
static ScheduleDate_Model::determine_downtimetype ( report_type = false  )  [static, protected]

Returns appropriate nagios command.

Parameters:
$report_type string
Returns:
string
ScheduleDate_Model::edit_schedule ( data,
&$  id = false 
)

Save/update a recurring schedule.

Parameters:
$data array
$id int
Exceptions:
Exception 
ScheduleDate_Model::get_downtime_command ( downtime,
obj_name 
)

Returns a formatted downtime command.

Parameters:
$downtime Downtime
$obj_name string
Returns:
string Command format
ScheduleDate_Model::get_downtime_objects ( sched,
downtime_window 
) [protected]

Returns a list of objects eligible for downtime.

Parameters:
$sched object schedule-object
$downtime_window array
Returns:
array list of downtime candidates
static ScheduleDate_Model::get_nagios_cmd ( type  )  [static, protected]

Returns appropriate nagios command.

Parameters:
$type string
Returns:
string
static ScheduleDate_Model::insert_downtimes ( objects,
object_type,
start_time,
end_time,
start_date,
end_date,
fixed,
duration,
comment 
) [static]

Schedule a downtime by submitting it to nagios.

Parameters:
$objects array
$object_type string
$start_time string
$end_time string
$start_date string
$end_date string
$fixed string
$duration string
$comment string
Returns:
boolean
ScheduleDate_Model::matches_recurrence ( downtime,
target_date 
)
Parameters:
$downtime RecurringDowntime
$target_date NinjaDateTime
Returns:
bool
Exceptions:
Exception 

Repeats every Nth day Conditions: 1) Targetdate's /day/ matches the scheduled day-stepping

Repeats every Nth week Conditions: 1) Targetdate's /week/ matches the scheduled week-stepping 2) Targetdate's weekday is one of the scheduled weekdays

Repeats every Nth month Conditions: 1) Targetdate's /month/ matches the scheduled month-interval 2) Targetdate is the "<ordinal> <day> of <month>"

Repeats every Nth year Conditions: 1) Targetdate's /year/ matches the scheduled year-interval 2) Targetdate's month matches recurring month 3) Targetdate is the "<ordinal> <day> of <month>"

ScheduleDate_Model::schedule_downtime ( timestamp = false,
schedules = false 
)

Schedule downtime.

Parameters:
$timestamp false|string Timestamp instead of the default target date (tomorrow)
$schedules false|array List of schedules instead of obtaining schedules from the database
Returns:
int 1 if one or more ext commands failed, otherwise 0
Exceptions:
Exception 

Field Documentation

ScheduleDate_Model::$valid_fields [static]
Initial value:
 array(
                'author',
                'downtime_type',
                'objects',
                'comment',
                'start_time',
                'end_time',
                'duration',
                'fixed',
                'weekdays',
                'months',
                'start_date',
                'end_date',
                'recurrence',
                'recurrence_on',
                'recurrence_ends',
                'exclude_days'
        )

Fields that a schedule include.

These are all valid, and all required. Mostly public for test reasons.

ScheduleDate_Model::$valid_types [static]
Initial value:
 array(
                'hosts',
                'services',
                'hostgroups',
                'servicegroups'
        )

A list of valid schedule types - same format (no underscore, trailing s) as in report options.

Mostly public for test reasons.


The documentation for this class was generated from the following file:
 All Data Structures Functions Variables

Generated on 14 Jan 2020 for ninja by  doxygen 1.6.1