Ocs::Nagios - Import OCS Inventory devices in Nagios
Version 0.02
use Ocs::Nagios; my $obj = new Ocs::Nagios( server => $server, soap_user => $soap_user, soap_pass => $soap_pass, soap_port => $soap_port, directory => $directory ); ...
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%" ); }
Julien SAFAR, <jsasys at gmail.com>
<jsasys at gmail.com>
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.
bug-ocs-nagios at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Ocs::Nagios
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Ocs-Nagios
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Ocs-Nagios
CPAN Ratings
http://cpanratings.perl.org/d/Ocs-Nagios
Search CPAN
http://search.cpan.org/dist/Ocs-Nagios/
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.
To install Ocs::Nagios, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Ocs::Nagios
CPAN shell
perl -MCPAN -e shell install Ocs::Nagios
For more information on module installation, please visit the detailed CPAN module installation guide.