-2

i am new to perl so need you help alot i try to create perl plugin using this link,

http://itwarriors.com/?p=1

i have created file name check_test.pl in (/usr/local/nagios/libexec),

#! /usr/bin/perl
use strict;
use Getopt::Long qw(:config no_ignore_case);
my ($host, $server, $instances);
my $result = GetOptions(
“H|host=s” => \$host,
“s|server=s” => \$server,
“i|instances=s” => \$instances,
);
print “My host IP is $host\n”;
print “My Server IP is $server\n”;
print “Times Server found are $instances\n”;

and after getting this error,

[root@localhost libexec]# ./check_test.pl -h 192.168.1.101 -s 192.168.1.110 -i 2 bash: ./check_test.pl: Permission denied

i try to add ,

# 'check_test' command definition
define command{
command_name    check_test
command_line    $USER1$/check_test.pl -H $HOSTADDRESS$ -s 12489 
}

command in command.cfg

instead of that i am getting error permission denied please hekp for this error that what actually error is???

Prince John Wesley
  • 62,492
  • 12
  • 87
  • 94
Syed Raza
  • 149
  • 1
  • 12
  • 26
  • Alter the permissions of the script so that Nagios--or whatever other service that needs to run the script--can run the script. –  Oct 24 '11 at 08:49
  • how do i alter the permissions of the script ?? :( – Syed Raza Oct 24 '11 at 08:52
  • Take a look at `man chmod` (in particular, the first manual page). –  Oct 24 '11 at 08:54
  • man chmod ??? what is it i haven't understand please let me know in detail about it ! – Syed Raza Oct 24 '11 at 09:12
  • Type `man chmod` on the command line and hit enter. If you're presented with a choice as to which manual page (aka man page) to use, select the first one. Documentation is your friend. Use it. –  Oct 24 '11 at 09:24
  • now i am getting error "unrecognize character \xE2 at./check_test.pl line 6" ??? what is the error my code is define above??? – Syed Raza Oct 24 '11 at 09:30
  • Does line 6 of your script correspond to the sixth line of code that you've posted above? –  Oct 24 '11 at 09:34
  • What is the encoding of `check_test.pl`? Try `use utf8;`. –  Oct 24 '11 at 10:13
  • i have got the error my code is fine actually i copy paste it thats why is was giving error but when i type it it goes fine ! – Syed Raza Oct 24 '11 at 10:38

1 Answers1

1

I think your script needs execution permission:

chmod +x check_test.pl 
Miguel Prz
  • 13,718
  • 29
  • 42