Custom script not returning data after upgrade to v1.02

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
mrquad450
Posts: 5
Joined: Tue Feb 14, 2017 1:15 pm

Custom script not returning data after upgrade to v1.02

Post by mrquad450 »

I have a php script that goes off and collects data, printing it back out to the system. This exact script worked fine until I upgraded to v1.02 a little over a week ago - then it stopped displaying data for all but 2 of the items. Once v1.03 came out this week, I upgraded to it to see if helped - it actually broke the two that were working.

Here's the script:
The php script as seen in Notepad++
The php script as seen in Notepad++
ScreenShot786.png (24.66 KiB) Viewed 789 times
Here's the Data Input Method:
Screenshot of Data Input Method configuration
Screenshot of Data Input Method configuration
ScreenShot785.png (59.51 KiB) Viewed 789 times
Here's the output of the script:

Code: Select all

"root@XXX:/usr/share/cacti/scripts# php welserver.php
date:02/23/2017time:14:19:20Geo_Loop_In:69.237495Geo_Loop_Out:71.262489DHW_Out:72.162498DHW_In:72.499992ColdAirReturn:72.387489SupplyAir:71.937492Geo_Diff:-2.023293Air_Diff:-0.790474DHW_Diff:-0.350632ShopHeatDiff:-0.340446FloorHeat_Out:64.962501ShopAirTemp:66.312492FloorHeat_in:65.299995Geo_Loop_I_Low:69.239051Geo_Loop_O_Low:71.262344OutsideTemp:69.799995Outside_Annual:69.685241
root@XXX:/usr/share/cacti/scripts#"
[/color]


The individual output fields are simple just the name - EXACTLY as it is written out by my script - and have the update RRDfile box checked.

I've tried the script manually - it works great - no issues. For some reason the polling doesn't appear to be liking it - though CLOG isn't showing any errors in requesting that data either.

I'm a bit at a loss after tweaking with it for a couple of weeks... Looking for some advice. :o
cigamit
Developer
Posts: 3368
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: Custom script not returning data after upgrade to v1.02

Post by cigamit »

The script looks like it should function just fine (there are a few things that should be written just for codings sake) One thing is you should remove that closing PHP tag or the blank line after it. It is basically causing it to also output a newline.

The real question I have is why isn't the output you are showing have the proper space between the data sets? The echo is there in your script.
mrquad450
Posts: 5
Joined: Tue Feb 14, 2017 1:15 pm

Re: Custom script not returning data after upgrade to v1.02

Post by mrquad450 »

I think that was a relec of how I copied/pasted...

Here's the actual output:
root@debian:/usr/share/cacti/scripts# php welserver.php
date:02/24/2017 time:15:19:35 Geo_Loop_In:67.549995 Geo_Loop_Out:69.462501 DHW_Out:70.137489 DHW_In:70.025001 ColdAirReturn:69.349998 SupplyAir:69.012489 Geo_Diff:-1.914406 Air_Diff:-0.286667 DHW_Diff:0.112488 ShopHeatDiff:-0.675011 FloorHeat_Out:69.349998 ShopAirTemp:70.587501 FloorHeat_in:70.025001 Geo_Loop_I_Low:67.548072 Geo_Loop_O_Low:69.462478 OutsideTemp:68.900001 Outside_Annual:68.850189
root@debian:/usr/share/cacti/scripts#
That looks better...

Again, this worked perfectly prior to the upgrade, but hasn't worked since the upgrade...Not sure what has changed in this area of code?

Any suggestions for better method of troubleshooting this? It seems far simpler to troubleshoot SNMP based problems rather than script based... I'm open to suggestions...
cigamit
Developer
Posts: 3368
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: Custom script not returning data after upgrade to v1.02

Post by cigamit »

I am wondering if the colons in the time are killing it (since colons are also a separator field). After this part,

Code: Select all

$value = $row->value;
try adding this

Code: Select all

if ($name == 'time') {
  $value = 1;
}
mrquad450
Posts: 5
Joined: Tue Feb 14, 2017 1:15 pm

Re: Custom script not returning data after upgrade to v1.02

Post by mrquad450 »

Here's the output from CLOG:
2017-02-24 22:36:02 - SPINE: Poller[1] DEBUG: The Value of Active Threads is 7 for Device ID 10
2017-02-24 22:36:02 - SPINE: Poller[1] Device[10] Description[WELServer] TH[1] DEBUG: HOST COMPLETE: About to Exit Device Polling Thread Function
2017-02-24 22:36:02 - SPINE: Poller[1] Device[10] Description[WELServer] TH[1] Total Time: 1.1 Seconds
2017-02-24 22:36:02 - SPINE: Poller[1] Device[10] Description[WELServer] TH[1] DS[355] Graphs['Geothermal Air Temperatures','Shop Radiant Floor Temperatures','WELServer DHW','WELServer - Loop Temps','Shop Air Temperatures'] SCRIPT: /usr/bin/php -q /usr/share/cacti/scripts/welserver.php, output: date:1 time:1 Geo_Loop_In:67.999992 Geo_Loop_Out:69.574989 DHW_Out:70.137489 DHW_In:69.799995 ColdAirReturn:68.224998 SupplyAir:66.537498 Geo_Diff:-1.615578 Air_Diff:-1.683159 DHW_Diff:0.326187 ShopHeatDiff:-0.096718 FloorHeat_Out:66.987495 ShopAirTemp:66.199989 FloorHeat_in:67.099998 Geo_Loop_I_Low:67.985298 Geo_Loop_O_Low:69.600875 OutsideTemp:52.700000 Outside_Annual:52.701744
2017-02-24 22:36:01 - SPINE: Poller[1] Device[10] Description[WELServer] DEBUG: The NIFTY POPEN returned the following File Descriptor 11
2017-02-24 22:36:01 - SPINE: Poller[1] Device[10] Description[WELServer] TH[1] NOTE: There are '1' Polling Items for this Device
2017-02-24 22:36:01 - SPINE: Poller[1] Device[10] Description[WELServer] TH[1] Device has no information for recache.
2017-02-24 22:36:01 - SPINE: Poller[1] Device[10] Description[WELServer] DEBUG: ICMP Device Alive, Try Count:1, Time:1.5821 ms
2017-02-24 22:36:01 - SPINE: Poller[1] Device[10] Description[WELServer] DEBUG: Entering ICMP Ping
2017-02-24 22:36:01 - SPINE: Poller[1] DEBUG: In Poller, About to Start Polling of Device for Device ID 10
Here's the output from the updated script (adding the time=1 solution, and I added date=1 as well to be sure):
root@debian:/usr/share/cacti/scripts# php welserver.php
date:1 time:1 Geo_Loop_In:67.887489 Geo_Loop_Out:69.574989 DHW_Out:70.025001 DHW_In:69.799995 ColdAirReturn:68.224998 SupplyAir:66.987495 Geo_Diff:-1.687904 Air_Diff:-1.179337 DHW_Diff:0.286606 ShopHeatDiff:-0.003387 FloorHeat_Out:67.099998 ShopAirTemp:66.312492 FloorHeat_in:67.099998 Geo_Loop_I_Low:67.887107 Geo_Loop_O_Low:69.575012 OutsideTemp:52.924999 Outside_Annual:52.890117
root@debian:/usr/share/cacti/scripts#

It is updating the rrd as I'd expect -- and I've actually got two of the values from above populating now... Air_Diff and Geo_Diff - none of the rest are working?
mrquad450
Posts: 5
Joined: Tue Feb 14, 2017 1:15 pm

Re: Custom script not returning data after upgrade to v1.02

Post by mrquad450 »

Hmmm... I think I've figured this out - but don't know how to fix it.

This was all set to 1 minute polling back in v0.8.8b - upon upgrade it shows 5 minute polling interval using the new 'Data Source Profiles' - however, I have no clue (nor can find any docs) how to create a new 1 minute polling.

Here's what rrdtool shows:
ds[Boiler_Input].index = 0
ds[Boiler_Input].type = "GAUGE"
ds[Boiler_Input].minimal_heartbeat = 120
ds[Boiler_Input].min = -1.0000000000e+02
ds[Boiler_Input].max = 2.0000000000e+02
ds[Boiler_Input].last_ds = "66.537498"
ds[Boiler_Input].value = NaN
ds[Boiler_Input].unknown_sec = 1

Here's the working version for AirDiff:
ds[air_differential].index = 1
ds[air_differential].type = "GAUGE"
ds[air_differential].minimal_heartbeat = 600
ds[air_differential].min = -1.0000000000e+02
ds[air_differential].max = 2.0000000000e+02
ds[air_differential].last_ds = "0.457069"
ds[air_differential].value = 4.5706900000e-01
ds[air_differential].unknown_sec = 0

So, again, I think this is a Data Source Profile issue - but how do I fix this? You can't (from what I can tell) update the minimal heartbeat with rrdtool tuner...?

I'd rather go back to 1 minute polling for the entire system...is that possible to change somewhere?
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests