Thruk::Utils::Render - Report Rendering Utilities Collection
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.
sort_by_key()
return sorted list of hashes
current_page()
return and increase page number
calculate_availability()
calculate availability from stash data
get_service_filter($service_param)
convert services into a s_filter usable by Avail.pm
expand_service_slas($service_param)
expand services sla levels
outages($logs, $start, $end, $hst, $svc)
print outages from log entries
set_unavailable_states($states)
set list of states which count as unavailable
get_report_timeperiod()
return report timeperiod in human readable form
get_events()
set events by pattern from eventlog
get_url_with_retries($retries, $delay)
calls get_url but retries on errors
get_url()
save content from url
count_event_totals()
count host / service totals from events
get_availability_percents($hst, $svc)
return list of availability percent as json list
get_month_name(date, monthNamesList)
return human readable month name
get_week_name(date)
return human readable week name
get_day_name(date)
return human readable day name
get_graph_source(c, host, service)
return index of first graph for given host (or service) provided by the _GRAPH_SOURCE custom variable or 1 as default fallback.
get_pnp_image(hst, svc, start, end, width, height, source)
return base64 encoded pnp image if possible. An empty string will be returned if no PNP graph can be exported.
dump(...)
dump variables to stderr
html_all_inclusive($c, $url, $page, [$include_js])
make html page include all remove css, js and images
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($float, $decimals, [$round_method])
Round number to given decimals. method can be 'floor' or 'round'.
- round will do a standard mathematical round
replace_css_and_images($text, $url, $report_base_url)
Replace css and images in given text
set_action_image_data_urls($c, $urls)
replaces hash of urls with data urls
returns a absolute url
expects
$VAR1 = origin url
$VAR2 = target link
See the shipped reports for some examples. Shipped reports are in the 'plugins/plugins-available/reports2/templates/reports' folder.