NAME

Thruk::Utils::Render - Report Rendering Utilities Collection

DESCRIPTION

Report Rendering Utilities Collection. All subs will be available in report templates. Templates are Template::Toolkit templates and are responsible for the report layout, the mail content and the required parameters for a report.

METHODS

sort_by_key

  sort_by_key()

return sorted list of hashes

current_page

  current_page()

return and increase page number

calculate_availability

  calculate_availability()

calculate availability from stash data

outages

  outages($logs, $start, $end, $x, $y, $step1, $step2, $max)

print outages from log entries

set_unavailable_states

  set_unavailable_states($states)

set list of states which count as unavailable

get_report_timeperiod

  get_report_timeperiod()

return report timeperiod in human readable form

get_events

  get_events()

set events by pattern from eventlog

get_url

  get_url()

save content from url

count_event_totals

  count_event_totals()

count host / service totals from events

get_availability_percents

  get_availability_percents()

return list of availability percent as json list

get_month_name

  get_month_name(date, monthNamesList)

return human readable month name

get_week_name

  get_week_name(date)

return human readable week name

get_day_name

  get_day_name(date)

return human readable day name

get_graph_source

  get_graph_source(c, host, service)

return index of first graph for given host (or service) provided by the _GRAPH_SOURCE custom variable or 0 as default fallback.

get_pnp_image

  get_pnp_image(hst, svc, start, end, width, height, source)

return base64 encoded pnp image if possible. A string will be returned if no PNP graph can be exported.

dump

  dump(...)

dump variables to stderr

html_all_inclusive

  html_all_inclusive($c, $url, $page, [$include_js])

make html page include all remove css, js and images

page_splice

  page_splice($data, $size_per_page, $max_pages)

cut data in chunks of $size_per_page size. $max_pages is the maximum number of pages or -1 for all.

round_decimals

  round_decimals($float, $decimals, [$round_method])

Round number to given decimals. method can be 'floor' or 'round'.

  - round will do a standard mathematical round

set_action_image_data_urls

  set_action_image_data_urls($c, $urls)

replaces hash of urls with data urls

_absolutize_url

  returns a absolute url

  expects
  $VAR1 = origin url
  $VAR2 = target link

EXAMPLES

See the shipped reports for some examples. Shipped reports are in the 'plugins/plugins-available/reports2/templates/reports' folder.

AUTHOR

Sven Nierlein, 2009-present, <sven@nierlein.org>

LICENSE

This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.