Summary_Reports_Model Class Reference

Big, fat TODO: Almost every method asks the DB for all data and returns it. More...

Inheritance diagram for Summary_Reports_Model:
Reports_Model

Public Member Functions

 get_events (Op5Auth $auth)
 Used from the HTTP API.
 build_alert_summary_query ($fields=null, $is_api_call=false, $blacklisted_criteria=array(), $db_table=null, $auth=null)
 Create the base of the query to use when calculating alert summary.
 top_alert_producers ()
 Get alert summary for "top (hard) alert producers".
 alert_totals ()
 Get alert totals.
 recent_alerts ()
 Find and return the latest $this->options['summary_items'] alert producers according to the search criteria.
 histogram ($slots=false)
 Fetch alert history for histogram report.
 histogram_data ($query, $date_str='j', $slots=false, $newstatesonly=false)
 Populate slots for histogram.

Static Public Member Functions

static add_event_comment ($timestamp, $event_type, $host_name, $service, $comment, $username)
 Add a new comment to the event pointed to by the timestamp/event_type/host_name/service.

Detailed Description

Big, fat TODO: Almost every method asks the DB for all data and returns it.

Instead, users should subscribe what they're interested in, and be fed that data once the query runs, once.


Member Function Documentation

Summary_Reports_Model::alert_totals (  ) 

Get alert totals.

This is identical to the toplist in many respects, but the result array is different.

Returns:
Array of counts divided by object types and states
Summary_Reports_Model::build_alert_summary_query ( fields = null,
is_api_call = false,
blacklisted_criteria = array(),
db_table = null,
auth = null 
)

Create the base of the query to use when calculating alert summary.

Each caller is responsible for adding sorting and limit options as necessary.

Parameters:
$fields string Comma separated list of database columns the caller needs
$is_api_call boolean = false
$blacklisted_criteria array = array()
$db_table string = null
$auth auth module to use, if not using default
Returns:
string (sql)
Summary_Reports_Model::get_events ( Op5Auth $  auth  ) 

Used from the HTTP API.

Parameters:
$auth Op5Auth
Returns:
array
Summary_Reports_Model::histogram ( slots = false  ) 

Fetch alert history for histogram report.

Parameters:
$slots array with slots to fill with data
Returns:
array with keys: min, max, avg, data
Summary_Reports_Model::histogram_data ( query,
date_str = 'j',
slots = false,
newstatesonly = false 
)

Populate slots for histogram.

Parameters:
$query sql
$date_str string for use in PHP date()
$slots array with slots to fill with data
$newstatesonly bool Used to decide if to ignore repated events or not
Returns:
array Populated slots array with found data
Summary_Reports_Model::top_alert_producers (  ) 

Get alert summary for "top (hard) alert producers".

Returns:
Array in the form { rank => array() }

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

Generated on 4 Apr 2014 for ninja by  doxygen 1.6.1