The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Ocs::Nagios - Import OCS Inventory devices in Nagios

VERSION

Version 0.02

SYNOPSIS

    use Ocs::Nagios;

    my $obj = new Ocs::Nagios( server => $server,
                           soap_user => $soap_user,
                           soap_pass => $soap_pass,
                           soap_port => $soap_port,
                           directory => $directory
    );
    ...

METHODS

new() - Create a new OCS::Nagios object

init() - Initialize OCS::Nagios object and get devices results

host() - Create a Host cfg File

service() - Create a Nagios Service in cfg file

EXAMPLES

1. Connect to SOAP OcsInventory Server and generate files for Nagios

This example create a .cfg file for the host, add a host definition and a service ping

     use strict;
     use warnings;
     use Ocs::Nagios;

     my $server="192.168.0.100";
     my $soap_user="soap";
     my $soap_pass="pass";
     my $soap_port=80;
     my $directory="/etc/nagios2/conf.d/";

     my $obj = new Ocs::Nagios( server => $server,
                           soap_user => $soap_user,
                           soap_pass => $soap_pass,
                           soap_port => $soap_port,
                           directory => $directory
     );

     my %hash=$obj->init();

     while ((my $host,my $ip) = each(%hash)) {
     print "KEY : $host, Value : $ip\n";
     # Create a host Object
     $obj->host( host => $host,
              ip => $ip,
              template => "generic-host"
     );
     # Create a SERVICE for this host
     $obj->service( template => "generic-service",
                 service_description => "PING",
                 check_command => "check_ping!100.0,20%!500.0,60%"
     );
     }

AUTHOR

Julien SAFAR, <jsasys at gmail.com>

BUGS

Please report any bugs or feature requests to bug-ocs-nagios at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Ocs-Nagios. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Ocs::Nagios

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2009 Julien SAFAR, all rights reserved.

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