The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
NAME
    Opsview::REST - Interface to the Opsview REST API

SYNOPSIS
        use Opsview::REST;

        my $ops = Opsview::REST->new(
            base_url => 'http://opsview.example.com/rest',
            user     => 'username',
            pass     => 'password',
        );

        # These are equivalent
        my $status = $ops->get('/status/hostgroup?hostgroupid=1&...');
        my $status = $ops->status(
            'hostgroup',
            'hostgroupid' => [1, 2],
            'filter'      => 'unhandled',
            ...
        );

        # Configuration methods
        my $host1 = $ops->create_host(
            ip                  => '192.168.0.1',
            name                => 'monitoring-slave',
            hostgroup           => { name => 'Monitoring Servers' },
            notification_period => { name => '24x7' },
        );

        $ops->clone_host(
            $host1->{object}->{id},
            name => 'another-host',
            ip   => '192.168.0.2',
        );

        # Reload it after config
        $ops->reload;

DESCRIPTION
    Opsview::REST is a set of modules to access the Opsview REST API, which
    is the recommended method for scripting configuration changes or any
    other form of integration since version 3.9.0

METHODS
  new
    Return an instance of the Opsview::REST.

   Required Arguments
    base_url
        Base url where the REST API resides. By default it is under "/rest".

    user
        Username to login as.

   Other Arguments
    pass
    auth_tkt
        Either the pass or the auth_tkt MUST be passed. It will die horribly
        if none of these are found.

  get($url)
    Makes a "GET" request to the API. The response is properly deserialized
    and returned as a Perl data structure.

  status( $endpoint, [ %args ] )
    Convenience method to request the "status" part of the API. $endpoint is
    the endpoint to send the query to. %args is a hash which will get
    properly translated to URL arguments.

    More info:
    <http://docs.opsview.com/doku.php?id=opsview-community:restapi:status>

  downtimes
  create_downtime( %args )
  delete_downtime( [ %args ] )
    Downtime related methods.

    More info:
    <http://docs.opsview.com/doku.php?id=opsview-community:restapi:downtimes
    >

  events( [ %args ] )
    Get events. An event is considered to be either:

    *   a host or service changing state

    *   a host or service result during soft failures

    *   a host or service in a failure state where 'alert every failure' is
        enabled

    More info:
    <http://docs.opsview.com/doku.php?id=opsview-community:restapi:event>

  acknowledge( [ %args ] )
    Acknowledge problems.

    More info:
    <http://docs.opsview.com/doku.php?id=opsview-community:restapi:acknowled
    ge>

  acknowledge_list
    Lists the problems which the current logged in user has permission to
    acknowledge.

  reload
    Initiates a synchronous reload. Be careful: if your opsview reload takes
    more than 60 seconds to run, this call will time out. The returned data
    contains the info of the reload.

    More info:
    <http://docs.opsview.com/doku.php?id=opsview-community:restapi#initiatin
    g_an_opsview_reload>

  reload_info
    Get status of reload.

    More info:
    <http://docs.opsview.com/doku.php?id=opsview-community:restapi#initiatin
    g_an_opsview_reload>

  get_*
  create_*
  clone_*
  update_*
  delete_*
    This methods will be generated for the following types of objects:
    "contact", "role", "servicecheck", "hosttemplate", "attribute",
    "timeperiod", "hostgroup", "servicegroup", "notificationmethod",
    "hostcheckcommand", "keyword", "monitoringserver".

    They all, except "create", require the object's id. Additionally,
    "create", "clone" and "update" accept a list of key-value pairs.

    More info:
    <http://docs.opsview.com/doku.php?id=opsview3.14:restapi:config>

TODO
    Document and test configuration methods to handle sets of objects.

SEE ALSO
    *   <http://www.opsview.org/>

    *   Opsview REST API Documentation
        <http://docs.opsview.com/doku.php?id=opsview-community:restapi>

AUTHOR
    *   Miquel Ruiz <mruiz@cpan.org>

COPYRIGHT AND LICENSE
    This software is copyright (c) 2012 by Miquel Ruiz.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.