[solved][0.8.8b] spine poller not waiting for script/exit

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

Moderators: Developers, Moderators

Post Reply
ClontarfX
Posts: 4
Joined: Tue Jan 06, 2015 2:13 am

[solved][0.8.8b] spine poller not waiting for script/exit

Post by ClontarfX »

Hi All,

I've got an issue where a simple script using hddtemp is not being polled/captured by the spine poller (I think).

The script takes approximately 2.5 seconds to complete

Code: Select all

root@wdhq:/usr/share/cacti/site/scripts# time ./hdd_temps.sh
hddtemp_sda:55.0 hddtemp_sdb:53.0 hddtemp_sdc:53.0 hddtemp_sdd:52.0 hddtemp_sde:53.0 hddtemp_sdf:54.0

real    0m2.383s
user    0m0.009s
sys     0m0.059s
However the cacti log shows the poller is finishing in less than a second.

Code: Select all

01/06/2015 07:15:01 AM - SYSTEM STATS: Time:0.3310 Method:spine Processes:4 Threads:4 Hosts:5 HostsPerProcess:2 DataSources:28 RRDsProcessed:17
Clearly the poller isn't waiting for the script to finish before saying "All done, here's your rrd data".

As a result, the graph for that rrd shows values of zero (was previously showing NaN).

Any ideas why the poller isn't waiting for the script to return data before finishing?
Last edited by ClontarfX on Tue Jan 06, 2015 2:48 am, edited 2 times in total.
ClontarfX
Posts: 4
Joined: Tue Jan 06, 2015 2:13 am

Re: [0.8.8b] spine poller not waiting for script/exit

Post by ClontarfX »

I think I just figured it out. bash interprets my script fine, but when that same script gets called by spine, it doesn't interpret my dodgy string handling...

Code: Select all

hddtemp_sda=`hddtemp /dev/sda | cut -d " " -f 4 | cut -c 1-2`
echo hddtemp_sda:$hddtemp_sda.0
bash correctly interprets the ".0" as an appended string to the variable $hddtemp_sda

spine doesn't like this though...

Code: Select all

01/06/2015 03:30:01 PM - SPINE: Poller[0] Host[1] TH[1] DS[42] SCRIPT: sh /usr/share/cacti/site/scripts/hdd_temps.sh, output: hddtemp_sda:.0 hddtemp_sdb:.0 hddtemp_sdc:.0 hddtemp_sdd:.0 hddtemp_sde:.0 hddtemp_sdf:.0
I've now removed that so it only returns the value without the appended .0, however spine now returns nothing (can't parse the variables?)

Code: Select all

01/06/2015 03:35:02 PM - SPINE: Poller[0] Host[1] TH[1] DS[42] SCRIPT: sh /usr/share/cacti/site/scripts/hdd_temps.sh, output: hddtemp_sda: hddtemp_sdb: hddtemp_sdc: hddtemp_sdd: hddtemp_sde: hddtemp_sdf:
Is there some trick for returning variables in a bash script for spine?
ClontarfX
Posts: 4
Joined: Tue Jan 06, 2015 2:13 am

Re: [0.8.8b] spine poller not waiting for script/exit

Post by ClontarfX »

Ignore me, rookie mistake. hddtemp does not allow non-root.

chmod +x path/to/hddtemp has solved my problem :)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest