View previous topic :: View next topic |
Author |
Message |
Majed17 Guru
Joined: 31 Aug 2011 Posts: 328 Location: Minsk, Belarus
|
Posted: Tue Dec 12, 2017 2:15 pm Post subject: where is the perl library located? [solved] |
|
|
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 |
|
|
v_andal Guru
Joined: 26 Aug 2008 Posts: 541 Location: Germany
|
Posted: Tue Dec 12, 2017 2:40 pm Post subject: |
|
|
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 |
|
|
Majed17 Guru
Joined: 31 Aug 2011 Posts: 328 Location: Minsk, Belarus
|
|
Back to top |
|
|
v_andal Guru
Joined: 26 Aug 2008 Posts: 541 Location: Germany
|
Posted: Wed Dec 13, 2017 7:52 am Post subject: |
|
|
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 |
|
|
Majed17 Guru
Joined: 31 Aug 2011 Posts: 328 Location: Minsk, Belarus
|
Posted: Thu Dec 14, 2017 8:38 am Post subject: |
|
|
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 |
|
|
v_andal Guru
Joined: 26 Aug 2008 Posts: 541 Location: Germany
|
Posted: Thu Dec 14, 2017 10:45 am Post subject: |
|
|
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 |
|
|
Majed17 Guru
Joined: 31 Aug 2011 Posts: 328 Location: Minsk, Belarus
|
Posted: Fri Dec 15, 2017 7:43 am Post subject: |
|
|
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 |
|
|
|