Get Disk Info

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
sailci
Posts: 3
Joined: Wed Sep 02, 2015 5:56 pm

Get Disk Info

Post by sailci »

I have setup check_usolved_disks.php, it is executable, it is in /usr/local/nagios/libexec directory, permissions look correct (same as everything else in that directory). When I try to test it from the command line I get ./check_usolved_disks.php: /usr/bin/php^M: bad interpreter: No such file or directory. php is installed and /usr/bin/php also exists. I am new to Nagios and new to Linux so just looking for some thoughts as to what could be wrong with this. Thanks...
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Get Disk Info

Post by hsmith »

sailci wrote:I have setup check_usolved_disks.php, it is executable, it is in /usr/local/nagios/libexec directory, permissions look correct (same as everything else in that directory). When I try to test it from the command line I get ./check_usolved_disks.php: /usr/bin/php^M: bad interpreter: No such file or directory. php is installed and /usr/bin/php also exists. I am new to Nagios and new to Linux so just looking for some thoughts as to what could be wrong with this. Thanks...

Can you check the top of the file to make sure that the shebang (#!) line isn't messed up? I've noticed bad things have happened when I try pasting occasionally.
Former Nagios Employee.
me.
sailci
Posts: 3
Joined: Wed Sep 02, 2015 5:56 pm

Re: Get Disk Info

Post by sailci »

#!/usr/bin/php
<?php

Is the top two lines. Looks right to me? when I do a which php it does return that path. I also tried php -f <path to file> --args -H localhost -C public -w90 -c 95 and it just gives me PHP usage instructions. I am obviously missing something.

Thanks...
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Get Disk Info

Post by tmcdonald »

http://stackoverflow.com/questions/1992 ... -directory

Basically you have some Windows-style line endings that are messing it up. You should be able to yum install dos2unix and run it against the file to fix it.
Former Nagios employee
sailci
Posts: 3
Joined: Wed Sep 02, 2015 5:56 pm

Re: Get Disk Info

Post by sailci »

Looks like that did the trick....thank you so much
Locked