UPS

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.
IvanAK
Posts: 25
Joined: Sun Mar 17, 2013 9:43 am

UPS

Post by IvanAK »

Hi all

we uses EATON UPS and im trying to monitor via Nagios, and i have the following errors.
Can some one explain me what this is ?
root@nagios:/usr/local/nagios/libexec# ./check_ups_pow.pl -h
-bash: ./check_ups_pow.pl: /usr/local/groundwork/bin/perl^M: bad interpreter: No such file or directory


root@nagios:/usr/local/nagios/libexec# ./check_ups.0.1.pl
-bash: ./check_ups.0.1.pl: /usr/bin/perl^M: bad interpreter: No such file or directory
root@nagios:/usr/local/nagios/libexec# root@nagios:/usr/local/nagios/libexec# ./check_ups_pow.pl -h
-bash: root@nagios:/usr/local/nagios/libexec#: No such file or directory
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: UPS

Post by jsmurphy »

It's looking for the perl interpreter (at /usr/bin/perl or /usr/local/groundwork/bin/perl) but can't find it. This means you haven't got perl installed or for whatever reason it hasn't been installed in the required /bin directory(s)... you can solve this by either installing perl or copying the binary to the required directories.
MPIvan
Posts: 213
Joined: Thu Nov 22, 2012 6:09 am

Re: UPS

Post by MPIvan »

Well according to this output "perl -v" i guess i have perl install
root@nagios:~# perl -v

This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux-gnu-thread-multi
(with 56 registered patches, see perl -V for more detail)

Copyright 1987-2011, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

root@nagios:~#
and you suggest to
or for whatever reason it hasn't been installed in the required /bin directory(s)... you can solve this by either installing perl or copying the binary to the required directories.

How can i find the binary and copy in other directory or other wise how to force or change the path and say that perl is in that directory ... i will love if i can skip copying binary to other directory i rather change the path
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: UPS

Post by abrist »

Lets find out where it is:

Code: Select all

which perl
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
MPIvan
Posts: 213
Joined: Thu Nov 22, 2012 6:09 am

Re: UPS

Post by MPIvan »

Here it is ..

/usr/bin/perl
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: UPS

Post by lmiltchev »

Open the plugin in vi, type ":set ff?", press "Enter", and check the output. If it's not showing "fileformat=unix", type ":set ff=unix", and hit "Enter". Check the format again by typing ":set ff?" and hitting "Enter". If it is "unix", save and exit (":wq, Enter").

Hope this helps.
Be sure to check out our Knowledgebase for helpful articles and solutions!
MPIvan
Posts: 213
Joined: Thu Nov 22, 2012 6:09 am

Re: UPS

Post by MPIvan »

I dont understand you well

Im using Ubuntu server 12.04 LTS. Should i put somewhere :set ff? in the script file or just open with vi and type that. Also i dont know what to do with this ....
If it's not showing "fileformat=unix", type ":set ff=unix", and hit "Enter". Check the format again by typing ":set ff?" and hitting "Enter". If it is "unix", save and exit (":wq, Enter").
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: UPS

Post by sreinhardt »

Open the plugin in vim
type :set ff?
press "Enter" and check the output.

If it's not showing "fileformat=unix" on the lower right side,

type :set ff=unix
hit "Enter".
Check the format again by typing ":set ff?" and hitting "Enter".
If it is "unix", save and exit (":wq, Enter").

You are doing these steps because the ^M in the first post indicates that this is windows or dos line endings when it needs to be unix.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
MPIvan
Posts: 213
Joined: Thu Nov 22, 2012 6:09 am

Re: UPS

Post by MPIvan »

Hi sreinhardt,

tnx for the explanation here is what iv done for now ...

root@nagios:/usr/local/nagios/libexec# ./check_ups_pow.pl -h
-bash: ./check_ups_pow.pl: /usr/local/groundwork/bin/perl^M: bad interpreter: No such file or directory
root@nagios:/usr/local/nagios/libexec# vim check_ups_pow.pl
root@nagios:/usr/local/nagios/libexec# ./check_ups_pow.pl -h
-bash: ./check_ups_pow.pl: /usr/local/groundwork/bin/perl: bad interpreter: No such file or directory
root@nagios:/usr/local/nagios/libexec#
the output of error is the same but now there is no ^M.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: UPS

Post by abrist »

Try:

Code: Select all

/usr/bin/perl ./check_ups_pow.pl -h
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked