Cacti 0.8.8e eats script output

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

Moderators: Developers, Moderators

Post Reply
jaslavko
Posts: 4
Joined: Tue Jun 02, 2015 11:32 am

Cacti 0.8.8e eats script output

Post by jaslavko »

I recently updated the Cacti to 0.8.8e version, after update i see a lot of warnings in log about partial results. After smart investigation i can see in log, eg.:

Code: Select all

07/13/2015 05:35:01 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /srv/www/localhost/cacti/rra/localhost_battv_31.rrd --template bcharge:timeleft:outputv:itemp:battv 1436801700:100.0:19.6:230.0:29.2:13.6
07/13/2015 05:35:01 PM - POLLER: Poller[0] Parsed MULTI output field 'battv:13.6' [map battv->battv]
07/13/2015 05:35:01 PM - POLLER: Poller[0] Parsed MULTI output field 'itemp:29.2' [map itemp->itemp]
07/13/2015 05:35:01 PM - POLLER: Poller[0] Parsed MULTI output field 'outputv:230.0' [map outputv->outputv]
07/13/2015 05:35:01 PM - POLLER: Poller[0] Parsed MULTI output field 'timeleft:19.6' [map timeleft->timeleft]
07/13/2015 05:35:01 PM - POLLER: Poller[0] Parsed MULTI output field 'bcharge:100.0' [map bcharge->bcharge]
07/13/2015 05:35:01 PM - CMDPHP: Poller[0] Host[1] Description[Bonifac] DS[31] Graphs['Bonifac - APC UPS Voltages'] CMD: /bin/sh /srv/www/localhost/cacti/scripts/get_apcups.sh 127.0.0.1, output: 236.0 bcharge:100.0 timeleft:19.6 outputv:230.0 itemp:29.2 battv:13.6
07/13/2015 05:35:01 PM - CMDPHP: Poller[0] Host[1] Description[Bonifac] DS[31] Graphs['Bonifac - APC UPS Voltages'] WARNING: Result from CMD not valid. Partial Result: 236.0 bcharge:100.0 
As one can see in log, the output starts with number 236.0, but when i run script from command line (as webserver user) i can see whole output (the numbers can differ due time distance between each run):

Code: Select all

/bin/sh /srv/www/localhost/cacti/scripts/get_apcups.sh 127.0.0.1
linev:236.0 bcharge:100.0 timeleft:24.2 outputv:230.0 itemp:29.2 battv:13.6
^^^^^
The "linev" value name is missing in log's output. It happens for some other scripts too, but i have some scripts where the name is numerical, and these are working OK.

Please, something changed in this version with script handling, that the first value name is lost? It was working with 0.8.8d version for long time.

thanks
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Cacti 0.8.8e eats script output

Post by phalek »

Can you check your output_poller table ? the output field should be TEXT or LONGTEXT. With boost it may be something different ( based on performance suggestions ).
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
jaslavko
Posts: 4
Joined: Tue Jun 02, 2015 11:32 am

Re: Cacti 0.8.8e eats script output

Post by jaslavko »

sure, i can, but please can you be more verbose? What you mean by the "output_poller"? I am not very familiar with cacti internals...
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Cacti 0.8.8e eats script output

Post by BSOD2600 »

login to mysql.
SHOW COLUMNS FROM CACTI.OUTPUT_POLLER;

if you increase the cacti.log logging level to verbose, any more details shed regarding your script parsing?
MikeMcr
Posts: 17
Joined: Mon Jan 04, 2010 12:44 pm

Re: Cacti 0.8.8e eats script output

Post by MikeMcr »

Same problem here as original poster after upgrading to 0.8.8e. SQL field output is type text. You can see it is eating the output, just like the example the original poster gave.

Code: Select all

07/13/2015 09:55:11 PM - CMDPHP: Poller[0] Host[3] DS[35] CMD: perl /<path>/<script>.pl, output: 14.6 snrd:8.8 attu:0.0 attd:11.1 powu:-2.9 powd:13.5 fecu:0 fecd:81 crcu:0 crcd:0 hecu:0 hecd:0 bwmu:30690000 bwmd:89832000 bwau:19999000 bwad:79999000 uptime:14 trad:102342187 trau:3511868083 memf:400 memb:1352 memc:5120 cpuu:1040390 cpun:0 cpus:1747346
07/13/2015 09:55:11 PM - CMDPHP: Poller[0] Host[3] DS[35] WARNING: Result from CMD not valid. Partial Result: 14.6 snrd:8.8 attu:0 
The output above is wrong. It should start "snru:" so the first 5 characters are being chopped. Why?
MikeMcr
Posts: 17
Joined: Mon Jan 04, 2010 12:44 pm

Re: Cacti 0.8.8e eats script output

Post by MikeMcr »

Comparing the source code with the previous version, this has been caused by the changes to function "strip_quotes" in "functions.php".

It is now stripping non-numeric prefixes from the output string, which is wrong! Reverting this function to the old version fixes the problem.
jaslavko
Posts: 4
Joined: Tue Jun 02, 2015 11:32 am

Re: Cacti 0.8.8e eats script output

Post by jaslavko »

Thanks for confirmation, that it is not a problem on my side ;-)

BTW, i am curious, what is (was) purpose of this change? It is safe to revert these changes or it will affect something other too, please?
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Cacti 0.8.8e eats script output

Post by BSOD2600 »

MikeMcr wrote:It is now stripping non-numeric prefixes from the output string, which is wrong! Reverting this function to the old version fixes the problem.
Please log the bug: http://cacti.net/bugs.php
MikeMcr
Posts: 17
Joined: Mon Jan 04, 2010 12:44 pm

Re: Cacti 0.8.8e eats script output

Post by MikeMcr »

BSOD2600 wrote:Please log the bug: http://cacti.net/bugs.php
Done.
jaslavko wrote:BTW, i am curious, what is (was) purpose of this change? It is safe to revert these changes or it will affect something other too, please?
Sorry, I have no idea why this was changed - there is no mention of it in the change log. If you revert just that function to how it looked in the previous version, it seems to then work fine for me, but who knows for sure.
User avatar
Osiris
Cacti Guru User
Posts: 1424
Joined: Mon Jan 05, 2015 10:10 am

Re: Cacti 0.8.8e eats script output

Post by Osiris »

Misplaced optimization I think. You should only back off the strip_quotes() function change. There appears to be another change in that file that is critical.
Before history, there was a paradise, now dust.
paulgevers
Cacti Pro User
Posts: 613
Joined: Tue Aug 29, 2006 4:09 pm
Location: NL

Re: Cacti 0.8.8e eats script output

Post by paulgevers »

Osiris wrote:Misplaced optimization I think. You should only back off the strip_quotes() function change. There appears to be another change in that file that is critical.
I don't think it was opitimization. Reading the code it looks like it was fixing another issue with + and - (where the sign would be ignored).

The function name is totally wrong as it doesn't describe what the function is supposed to be doing.
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
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests