[SOLVED] Script output: 0

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
korlaplankton
Posts: 12
Joined: Tue Nov 30, 2010 4:13 pm

[SOLVED] Script output: 0

Post by korlaplankton »

Hello everyone,

I'm a bit of a Cacti newb so apologies if I don't give all of the needed information. I'm trying to get my head around plotting the output of a script -- I believe I have things in Cacti set up properly but when I watch the Cacti log I see

Code: Select all

07/12/2011 09:40:02 AM - SPINE: Poller[0] Host[69] TH[1] DS[662] SCRIPT: /sbin/sh /usr/local/apache2/htdocs/scripts/bulletstats.sh <my hostname>, output: 0
Output: 0 is not the result I'm hoping for. When run from the command line it outputs

signal:-65 noise:-95

I have confirmed that there are no leading or trailing spaces in the output.

The script follows

Code: Select all

#! /sbin/sh

STATS=`ssh admin@$1 mca-status|sed 's/.$//'`
OUTPUT=`echo "$STATS" | grep 'signal' | awk -F'=' '{printf "signal:%s", $2}'
echo "$STATS" | grep 'noise' | awk -F'=' '{printf " noise:%s", $2}'`

echo $OUTPUT
permissions of the script are identical to the other scripts in the scripts directory.

In the associated data input method I have two output fields, 'signal' and 'noise' -- not sure if this impacts what SPINE gets from the scripts.

Can anyone see anything obvious that I'm doing wrong?

thanks a lot!

plankton

EDIT: I should also note that ssh pubkeys are set up, so it shouldn't be hanging on an ssh password prompt.
Last edited by korlaplankton on Thu Jul 14, 2011 1:21 pm, edited 1 time in total.
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Script output: 0

Post by noname »

First, try to specify all commands in your script with full pathname.
korlaplankton
Posts: 12
Joined: Tue Nov 30, 2010 4:13 pm

Re: Script output: 0

Post by korlaplankton »

Hi noname -- thanks for the reply! I wish it was something that simple but I'm already using absolute paths to specify both the command (/usr/local/apache2/htdocs/scripts/bulletstats.sh) and the interpreter (/sbin/sh)

--EDIT: sorry, just re-read your post. I will adjust the script so that the commands in it are specified with full paths as well. Thanks for the suggestion!

--EDIT2: sadly, this did not fix the problem. at this point i am thinking it may be an issue with the ssh pubkeys after all. cacti is running from a jail and spine runs as root. however when you jexec in to the jail you are user 'admin' and there is no su binary. I created the ssh keys using the 'admin' account and while it DID put the keys in /root/.ssh, i wonder if there still might be something odd going on. The logs on the device i'm trying to monitor indicate that this might be the case -- i'm getting 'exit before auth' type errors.

i'll talk to one of our jail gurus. thanks again!
korlaplankton
Posts: 12
Joined: Tue Nov 30, 2010 4:13 pm

Re: Script output: 0

Post by korlaplankton »

Just a quick update -- I solved the problem and it did have to do with the ssh pubkeys and the poller not running as the user it was supposed to.

So, nothing at all to do with Cacti, just our implementation. Apologies and thanks to anyone who actually put some thought in to my issue.

plankton
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: [SOLVED] Script output: 0

Post by noname »

korlaplankton wrote:it did have to do with the ssh pubkeys and the poller not running as the user it was supposed to.
Is it impossible to run cacti and spine as the same user in jail?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest