NAME

Thruk::Utils::CLI - Utilities Collection for CLI Tool

DESCRIPTION

Utilities Collection for CLI scripting with Thruk. Allows you to access internal structures and change config information.

METHODS

new

    new([ $options ])

 $options = {
    verbose         => 0-2,         # be more verbose
    credential      => 'secret',    # secret key when accessing remote instances
    remoteurl       => 'url',       # url where to access remote instances
    local           => 0|1,         # local requests only
 }

create CLI tool object

get_c

    get_c()

return Thruk::Context context object

BACKEND CONNECTION POOL

The Backend Connection Pool can be uses for own querys against all connected backends in Thruk.

get_db

    get_db()

Return connection pool as a Thruk::Backend::Manager object.

CONFIG TOOL - OBJECT CONFIGURATION

These methods will only be available if you have the config tool plugin enabled and if you set core config items to access the core objects config.

get_object_db

    get_object_db()

Return config database as a Monitoring::Config object.

store_objects

    store_objects()

Store changed objects. Changes will be stashed into Thruks internal object cache and can then be saved, reviewed or discarded.

request_url

    request_url($c, $url, $cookies)

returns requested url as string. In list context returns ($code, $result)

set_downtime

    set_downtime($c, $downtime, $cmd_typ, $backends, $start, $end, $hours, $minutes)

set downtime.

    downtime is a hash like this:
    {
        author  => 'downtime author'
        host    => 'host name'
        service => 'optional service name'
        comment => 'downtime comment'
        fixed   => 1
    }

    cmd_typ is:
         55 -> hosts
         56 -> services
         84 -> hostgroups
        122 -> servicegroups

EXAMPLES

there are some cli scripting examples in the examples subfolder of the source package.

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.