403 Forbidden at .pm file

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
lexcorp
Posts: 2
Joined: Mon Nov 30, 2020 2:56 pm

403 Forbidden at .pm file

Post by lexcorp »

#perl import_ocs.pl
403 Forbidden at Ocs/Nagios.pm line 55.

Content file import_ocs.pl

Code: Select all

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

#use LWP::UserAgent 5.834; # need local_address
#use LWP::Simple;
#use LWP

#my $ua = LWP::UserAgent->new;
#$ua->default_header('User-Agent' => 'Mozilla/5.0');

my $server="10.120.7.212";
my $soap_user="admin";
my $soap_pass="admin";
my $soap_port=80;
my $directory="/etc/nagios2/conf.d/";
#my $directory="/etc/init.d/nagios";
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%"
);
}
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: 403 Forbidden at .pm file

Post by gormank »

I'd look at line 55 in ocs/nagios.pm.
Locked