Script/command - invalid result from cmd

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

Moderators: Developers, Moderators

Post Reply
sorentorp
Posts: 3
Joined: Sat Sep 28, 2013 2:21 pm

Script/command - invalid result from cmd

Post by sorentorp »

Hi Cacti forum, hope you can help me out.

I have started collecting data from my solarpanels, and I would like to draw up these data with Cacti. I place the information in a sqlite database, and can call out the current watt produced by the solarcells with this little script.

Code: Select all

#!/bin/bash

solcelle=sudo sqlite3 db.sqlite "select pac from inverter order by timestamp DESC limit 1;"

echo $solcelle
which fx. outputs - and works perfectly

Code: Select all

boyd@server:~/eversolar-monitor$ ./cacti.sh
1200

Now when I try to add this to cacti as a Data Input method, it fails. Error log shows the following. Note I have addede the command with the full path.

Code: Select all

09/28/2013 09:20:01 PM - CMDPHP: Poller[0] Host[0] DS[48] WARNING: Result from CMD not valid. Partial Result: U
I have set up the script and cacti, by following this guide http://www.cacti.net/downloads/docs/html/how_to.html

I really hope you can help me out! Let me know if you need more information.
paulgevers
Cacti Pro User
Posts: 613
Joined: Tue Aug 29, 2006 4:09 pm
Location: NL

Re: Script/command - invalid result from cmd

Post by paulgevers »

Is the user the cacti cron job runs under allowed to run your script?
Maintainer of cacti in Debian (and Ubuntu).
Cacti 1.* is now officially supported on Debian Stretch via Debian backports
FAQ Ubuntu and Debian differences
Generic cacti debugging
sorentorp
Posts: 3
Joined: Sat Sep 28, 2013 2:21 pm

Re: Script/command - invalid result from cmd

Post by sorentorp »

Yep, thats what gets me off.. Is there any way to get cacti to tell me more in the logs on what is going on?

Code: Select all

root@server:/xxxx/xxxx/eversolar-monitor# su www-data
$
$ ./cacti.sh
2109
Edit: I have set log-level to Debug...
sorentorp
Posts: 3
Joined: Sat Sep 28, 2013 2:21 pm

Re: Script/command - invalid result from cmd

Post by sorentorp »

It seems it was a permission issue. I changed it all to run as root, and now i works... Now all I have to do is backtrack where it goes bad. Thank you for your help!
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests