Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
where is the perl library located? [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Majed17
Apprentice
Apprentice


Joined: 31 Aug 2011
Posts: 209
Location: Minsk, Belarus

PostPosted: Tue Dec 12, 2017 2:15 pm    Post subject: where is the perl library located? [solved] Reply with quote

Health be upon you,
i'm trying to run a perl script for nagios, but it requires the path to the perl libarary.
i modified it as follows:
Code:
my $perl_library = '/usr/lib64/perl5/';
use strict;
use lib $perl_library;

but it throws out an error:

Code:
Use of uninitialized value $path in string eq at /usr/lib64/perl5/5.24.3/x86_64-linux/lib.pm line 24.
Empty compile time value given to use lib at ./check_tacacs_plus.pl line 12.
Use of uninitialized value $path in pattern match (m//) at /usr/lib64/perl5/5.24.3/x86_64-linux/lib.pm line 29.
Use of uninitialized value $path in -e at /usr/lib64/perl5/5.24.3/x86_64-linux/lib.pm line 29.
Use of uninitialized value $path in concatenation (.) or string at /usr/lib64/perl5/5.24.3/x86_64-linux/lib.pm line 37.
Use of uninitialized value $path in concatenation (.) or string at /usr/lib64/perl5/5.24.3/x86_64-linux/lib.pm line 37.
Use of uninitialized value $path in concatenation (.) or string at /usr/lib64/perl5/5.24.3/x86_64-linux/lib.pm line 37.
Use of uninitialized value $path in concatenation (.) or string at /usr/lib64/perl5/5.24.3/x86_64-linux/lib.pm line 37.
Use of uninitialized value $path in concatenation (.) or string at /usr/lib64/perl5/5.24.3/x86_64-linux/lib.pm line 37.
Use of uninitialized value $path in concatenation (.) or string at /usr/lib64/perl5/5.24.3/x86_64-linux/lib.pm line 37.
Use of uninitialized value $dir in concatenation (.) or string at /usr/lib64/perl5/5.24.3/x86_64-linux/lib.pm line 77.
Use of uninitialized value $dir in concatenation (.) or string at /usr/lib64/perl5/5.24.3/x86_64-linux/lib.pm line 78.
Use of uninitialized value $dir in concatenation (.) or string at /usr/lib64/perl5/5.24.3/x86_64-linux/lib.pm line 79.
Use of uninitialized value $dir in concatenation (.) or string at /usr/lib64/perl5/5.24.3/x86_64-linux/lib.pm line 80.
Use of uninitialized value $_ in hash element at /usr/lib64/perl5/5.24.3/x86_64-linux/lib.pm line 50.
Use of uninitialized value $_ in concatenation (.) or string at /usr/lib64/perl5/5.24.3/x86_64-linux/DynaLoader.pm line 145.
read error

the program had initially this line:
Code:
use lib "/usr/local/nagios/libexec";

Any help?
_________________
Seek and you shall find, Knock and it shall be opened, cry and you shall find comfort.


Last edited by Majed17 on Fri Dec 15, 2017 7:44 am; edited 1 time in total
Back to top
View user's profile Send private message
v_andal
Guru
Guru


Joined: 26 Aug 2008
Posts: 506
Location: Germany

PostPosted: Tue Dec 12, 2017 2:40 pm    Post subject: Reply with quote

Well, you have too many problems in one question. I'm not sure which one should be explained :)

First of all, if some script complains about missing libraries, then you should show those errors, not the errors after your fixes.

Second, the "use lib" operation is performed at "parsing time", which happens before "run-time". And the "my $perl_library = '/usr/lib64/perl5';" is executed at "run-time". So the "use lib" does not see your variable, or more precisely, it sees uninitialized variable, since "run-time" has not happened yet.

Third, /usr/lib64/perl5/ does not contain perl libraries. The actual libraries are located in directory like /usr/lib64/perl5/5.24.3 and other subdirectories of /usr/lib64/perl5. These are system libraries and perl already knows about them, you don't need to manually add them.
Back to top
View user's profile Send private message
Majed17
Apprentice
Apprentice


Joined: 31 Aug 2011
Posts: 209
Location: Minsk, Belarus

PostPosted: Wed Dec 13, 2017 6:23 am    Post subject: Reply with quote

Thank you for caring!
Well, iam no programmer yet.
the original plugin produces an output of:
Code:
read error

I just followed the instructions on this page:
https://exchange.nagios.org/directory/Plugins/Network-Protocols/TACACS%20/check_tacacs_plus/details
I think you can figure it out.
_________________
Seek and you shall find, Knock and it shall be opened, cry and you shall find comfort.
Back to top
View user's profile Send private message
v_andal
Guru
Guru


Joined: 26 Aug 2008
Posts: 506
Location: Germany

PostPosted: Wed Dec 13, 2017 7:52 am    Post subject: Reply with quote

Majed17 wrote:

I just followed the instructions on this page:
https://exchange.nagios.org/directory/Plugins/Network-Protocols/TACACS%20/check_tacacs_plus/details
I think you can figure it out.


Sorry, but I don't use nagios, so I have no idea what that script is supposed to do. From the error you provided ("read error") I can say, that the problem is not with libraries but with the setup. The script can't obtain some information somewhere (firewall restriction? server crash?).

You'll be better off if you ask some nagios expert in an appropriate forum. But don't forget to describe there what you are trying to do.
Back to top
View user's profile Send private message
Majed17
Apprentice
Apprentice


Joined: 31 Aug 2011
Posts: 209
Location: Minsk, Belarus

PostPosted: Thu Dec 14, 2017 8:38 am    Post subject: Reply with quote

I tried creating a post in nagios forum, but i haven't received a conformation, which means they don't want to help.
Nagios is not needed to check this script. All you need is a tacacs server.
here is the output of connecting to a router instead of the tacacs server:
/usr/lib64/nagios/plugins $ ./check_tacacs_plus.pl -H routerIP -k kawabanga -u me -p hid
CRITICAL: connection failed
_________________
Seek and you shall find, Knock and it shall be opened, cry and you shall find comfort.
Back to top
View user's profile Send private message
v_andal
Guru
Guru


Joined: 26 Aug 2008
Posts: 506
Location: Germany

PostPosted: Thu Dec 14, 2017 10:45 am    Post subject: Reply with quote

Same thing. I don't have tacacs server :)

Again, your error "CRITICAL: connection failed" indicates that the script can not talk to server. Are you sure that the server is available? Once again, it is not problem of the script, it is problem of your environment/setup. Do you know how to work with "netstat", "telnet", "tcpdump" or "wireshark"? Those can help you to debug network problems.
Back to top
View user's profile Send private message
Majed17
Apprentice
Apprentice


Joined: 31 Aug 2011
Posts: 209
Location: Minsk, Belarus

PostPosted: Fri Dec 15, 2017 7:43 am    Post subject: Reply with quote

All what was needed was to telnet to port 49 on the tacacs server, it immediately closed and so the problem was revealed.
to anyone interested, here is the complete solution:
https://support.nagios.com/forum/viewtopic.php?f=35&t=46722
check the site later today that is when they approve new posts.
_________________
Seek and you shall find, Knock and it shall be opened, cry and you shall find comfort.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum