NAME

Thruk::Backend::Manager - Manager of backend connections

DESCRIPTION

Manager of backend connections

METHODS

new

create new manager

init

initialize this model

disable_hidden_backends

  disable_hidden_backends()

returns list of hidden backends

get_peers

  get_peers([$all])

returns all configured peers (except config-only)

get_peer_by_key

  get_peer_by_key()

returns peer by key

get_peer_by_name

  get_peer_by_name()

returns peer by name

peer_key

  peer_key()

returns all peer keys

sections

  sections()

returns all sections

disable_backend

  disable_backend(<key>)

disable backend by key

enable_backend

  enable_backend(<key>)

ensable backend by key

disable_backends

  disable_backends(<keys_hash>)

disabled backend by key hash

enable_backends

  enable_backends(<keys>, [<exclusive>])

enables all backends

get_default_backends

  get_default_backends()

returns all default backends

get_scheduling_queue

  get_scheduling_queue

returns the scheduling queue

get_performance_stats

  get_performance_stats

wrapper around get_performance_stats

get_hosts

  get_hosts

wrapper around get_hosts

get_services

  get_services

wrapper around get_services

get_contactgroups_by_contact

  get_contactgroups_by_contact

returns a list of contactgroups by contact

get_hostgroup_names_from_hosts

  get_hostgroup_names_from_hosts

returns a list of hostgroups but get list from hosts in order to respect permissions

get_servicegroup_names_from_services

  get_servicegroup_names_from_services

returns a list of servicegroups but get list from services in order to respect permissions

reconnect

  reconnect

runs reconnect on all peers

expand_command

  expand_command

expand a command line with host/service data

set_backend_state_from_local_connections

  set_backend_state_from_local_connections

enables/disables remote backends based on a state from local instances

logcache_stats

  logcache_stats($c)

return logcache statistics

renew_logcache

  renew_logcache($c, [$noforks])

update the logcache

_renew_logcache

  _renew_logcache($c)

update the logcache (internal sub)

close_logcache_connections

  close_logcache_connections($c)

close all logcache connections

_get_macros

  _get_macros

returns a hash of macros

replace_macros

  replace_macros($string, $args, [$macros])

replace macros in given string.

returns ($result, $rc)

$args should be: { host => host object (or service object) service => service object skip_user => 0/1 # skips user macros args => list of arguments }

get_macros

  get_macros($args)

returns a hash of macros

$args should be: { host => host object (or service object) service => service object skip_user => 0/1 # skips user macros filter_user => 0/1 # filters user macros args => list of arguments }

_get_replaced_string

  _get_replaced_string

returns replaced string

_get_obfuscated_string

  _get_obfuscated_string

replace sensitive data with ***

_set_host_macros

  _set_host_macros

set host macros

_set_service_macros

  _set_service_macros

sets service macros

_do_on_peers

  _do_on_peers($function, $options)

returns a result for a function called for all peers

  $function is the name of the function called on our peers
  $options is a hash:
  {
    backend => []     # array of backends where this sub should be called
  }

select_backends

  select_backends($function, [$args])

select backends we want to run functions on

_get_result

  _get_result($peers, $function, $args)

run function on several peers and collect result.

_get_result_lmd

  _get_result_lmd($peers, $function, $arguments)

returns result for given function using lmd

_get_result_serial

  _get_result_serial($peers, $function, $arguments)

returns result for given function

_get_result_parallel

  _get_result_parallel($peers, $function, $arguments)

returns result for given function and args using the worker pool

_get_results_xs_pool

  _get_results_xs_pool($peers, $function, $arg)

get result from xs thread pool

_remove_duplicates

  _remove_duplicates($data)

removes duplicate entries from a array of hashes

_page_data

  _page_data($c, $data, [$result_size], [$total_size])

adds paged data set to the template stash. Data will be available as 'data' The pager itself as 'pager'

reset_failed_backends

  reset_failed_backends([ $c ])

Reset failed backends cache. Retries are useless unless reseting this cache because failed backends won't be asked twice per request.

AUTOLOAD

  AUTOLOAD()

redirects sub calls to out backends

DESTROY

  DESTROY()

destroy this

_sort

  _sort($data, $sortby)

sort a array of hashes by hash keys

  sortby can be a scalar

  $sortby = 'name'

  sortby can be an array

  $sortby = [ 'name', 'description' ]

  sortby can be an hash

  $sortby = { 'DESC' => [ 'name', 'description' ] }

_sort_nr

  _sort_nr($data, $sortby)

sort a array of array by array nr

  sortby must be an array

  [<nr>, <direction>]

  ex.:

  [5, 'asc']
  [5, 'asc', 13, 'desc']

_limit

  _limit($data, $limit)

returns data limited by limit

_set_user_macros

  _set_user_macros($args, $macros)

Sets the USER1-256 macros from a resource file. Shinken supports all kind of macros in resource file, so just replace everything from the resource file.

$args should be: { peer_key => peer key for the host filter => 0/1 # only add allowed macros file => location of resource file args => list of arguments }

_set_result_defaults

  _set_result_defaults()

set defaults for some results

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.