Trouble with Thold after upgrading to 0.8.8b

Support questions about the Threshold plugin

Moderators: Developers, Moderators

Post Reply
User avatar
redpeppers01
Posts: 22
Joined: Tue Feb 26, 2013 10:50 pm

Trouble with Thold after upgrading to 0.8.8b

Post by redpeppers01 »

After updating to 0.8.8b i am having thold issues. If i disable thold graphs show up fine, when debugging a graph when thold is enabled i get........

Notice: Undefined offset: 1 in /var/www/html/plugins/thold/setup.php on line 217, 218
and a
Notice: Undefined offset: 2 in /var/www/html/plugins/thold/setup.php on line 216.

I have searched high and low with no help.

also i have tried uninstalling the thold plugin and reinstalling, i have also replaced the thold plugin folder with a known working backup. Same results.

Thanks for any help
Shawn C. Peppers
http://www.directlinkadmin.com
Directlinkadmin ISP Suite - 866-680-8433
Mrys
Posts: 18
Joined: Thu Apr 11, 2013 6:34 am

Re: Trouble with Thold after upgrading to 0.8.8b

Post by Mrys »

I have the same problem. :( :(

Something help?
tylerc
Posts: 24
Joined: Tue Aug 13, 2013 10:59 pm

Re: Trouble with Thold after upgrading to 0.8.8b

Post by tylerc »

Code: Select all

$dsname = $kdef[2];
$temp1  = str_replace(".rrd", "", basename($ddef[1]));
if (substr_count(basename($ddef[1]), "_") == 0)
Those are the lines in question. Your error seems to be because

Code: Select all

$ddef[1]
and

Code: Select all

$kdef[2]
have invalid offets--that is, the number in the square brackets is not indicating a valid position in those arrays. I am not very good at debugging PHP, and the Cacti codebase is kind of spaghetti IMHO, but if you could find a way to print to your page the contents of those two variables, that would be a good start.

The command to get the contents of variables in PHP is:

Code: Select all

var_dump($ddef);
var_dump($ddef);
You may be able to get it to the Cacti log. Try changing your code at those lines to:

Code: Select all

cacti_log('$kdef contents: ' . var_dump($kdef);
$dsname = $kdef[2];
cacti_log('$ddef contents: ' . var_dump($ddef);
$temp1  = str_replace(".rrd", "", basename($ddef[1]));
if (substr_count(basename($ddef[1]), "_") == 0)
Then check your Cacti log and report back.

I'm honestly not sure if the above code will give you the answers you need--I primarily write Perl, but what's the worst that can happen?

Good luck!

--Tyler
User avatar
redpeppers01
Posts: 22
Joined: Tue Feb 26, 2013 10:50 pm

Re: Trouble with Thold after upgrading to 0.8.8b

Post by redpeppers01 »

This code did not work for me, spits out a parser code error. I believe it has to do with the cacti_log part.
Shawn C. Peppers
http://www.directlinkadmin.com
Directlinkadmin ISP Suite - 866-680-8433
Mrys
Posts: 18
Joined: Thu Apr 11, 2013 6:34 am

Re: Trouble with Thold after upgrading to 0.8.8b

Post by Mrys »

Sorry my answer was for other post
I can´t solve this problem.
Last edited by Mrys on Sun Sep 08, 2013 6:15 am, edited 2 times in total.
User avatar
redpeppers01
Posts: 22
Joined: Tue Feb 26, 2013 10:50 pm

Re: Trouble with Thold after upgrading to 0.8.8b

Post by redpeppers01 »

is this just a bandaid?
Shawn C. Peppers
http://www.directlinkadmin.com
Directlinkadmin ISP Suite - 866-680-8433
Mrys
Posts: 18
Joined: Thu Apr 11, 2013 6:34 am

Re: Trouble with Thold after upgrading to 0.8.8b

Post by Mrys »

SOLVED!!

Change this code in setup.php

foreach ($defs as $def) {
if (!substr_count($def, "CDEF") && !substr_count($def, "VDEF")) {
$ddef = explode('"', $def);
$kdef = explode(':', $def);

$dsname = $kdef[0];

$temp1 = str_replace(".rrd", "", basename($ddef[0]));

if (substr_count(basename($ddef[0]), "_") == 0) {
$local_data_id = $temp1;
:wink:
dvc
Posts: 18
Joined: Mon Apr 29, 2013 12:44 am

Re: Trouble with Thold after upgrading to 0.8.8b

Post by dvc »

Mrys wrote:SOLVED!!

Change this code in setup.php

foreach ($defs as $def) {
if (!substr_count($def, "CDEF") && !substr_count($def, "VDEF")) {
$ddef = explode('"', $def);
$kdef = explode(':', $def);

$dsname = $kdef[0];

$temp1 = str_replace(".rrd", "", basename($ddef[0]));

if (substr_count(basename($ddef[0]), "_") == 0) {
$local_data_id = $temp1;
:wink:
That didn't work for me :cry:

After digging around it appears that in Cacti 0.8.8a DEF statements were quoted with double quotes but in 0.8.8b they are now quoted with single quotes.
Which means that on line 214 of thold/setup.php this statement no longer works properly:

Code: Select all

$ddef   = explode('"', $def);
If you change it to split on the single quote:

Code: Select all

$ddef   = explode("'", $def);
and leave everything else as it was in the 0.8.8b release, then it should be ok. Works for me anyway. :wink:
acleech
Posts: 6
Joined: Thu Sep 20, 2007 10:09 am
Location: San Angelo, TX

Re: Trouble with Thold after upgrading to 0.8.8b

Post by acleech »

It's crazy how many issues thold can cause.

dvc, thank you for posting this, that fixed all the issues I had with my CactiEZ0.7 install. Now to migrate over to this new server.
Cacti Version - 1.2.6
Poller Type - SPINE 1.2.6
Server Info - CentOS7
Database - MariaDB 10.3.17
Web Server - Apache 2.4.6
SNMP - NET-SNMP 5.7.2
RRDTool - Version 1.4.8
PHP - 7.3.9
draconis
Posts: 2
Joined: Sat Feb 22, 2014 7:29 am

Re: Trouble with Thold after upgrading to 0.8.8b

Post by draconis »

I had the same problem fixed by replacing the files from the links below

http://svn.cacti.net/viewvc/cacti/branc ... threv=7418
http://svn.cacti.net/viewvc/cacti/branc ... p?view=log

I just did a
find /var/www | grep rra.php and rrd.php

to locate them and dropped them in and overwrote the originals.
sh33zo
Posts: 1
Joined: Thu Jul 10, 2014 6:45 pm

Re: Trouble with Thold after upgrading to 0.8.8b

Post by sh33zo »

dvc wrote:
After digging around it appears that in Cacti 0.8.8a DEF statements were quoted with double quotes but in 0.8.8b they are now quoted with single quotes.
Which means that on line 214 of thold/setup.php this statement no longer works properly:

Code: Select all

$ddef   = explode('"', $def);
If you change it to split on the single quote:

Code: Select all

$ddef   = explode("'", $def);
and leave everything else as it was in the 0.8.8b release, then it should be ok. Works for me anyway. :wink:

AWESOME!! This fixed my graphs!!!!
Gracias homes!!! :lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol:
for the newbs like me...

nano /var/www/html/plugins/thold/setup.php
then ctrl+w to find ddef
then simply change to

Code: Select all

$ddef   = explode("'", $def);
ctrl+x and press enter to save
xfrags
Posts: 7
Joined: Thu Mar 12, 2015 9:18 am

Re: Trouble with Thold after upgrading to 0.8.8b

Post by xfrags »

still getting issues

06/04/2015 01:21:07 PM - PHPSVR: Poller[0] WARNING: Function does not exist INC: 'thold_alerts.php' FUNC: 'script_thold_alerts_count' PARMS: ''
06/04/2015 01:21:07 PM - PHPSVR: Poller[0] WARNING: PHP Script File to be included, does not exist
User avatar
pizu
Posts: 42
Joined: Thu Nov 17, 2011 5:15 pm

Re: Trouble with Thold after upgrading to 0.8.8b

Post by pizu »

tylerc wrote:

Code: Select all

$dsname = $kdef[2];
$temp1  = str_replace(".rrd", "", basename($ddef[1]));
if (substr_count(basename($ddef[1]), "_") == 0)
Those are the lines in question. Your error seems to be because

Code: Select all

$ddef[1]
and

Code: Select all

$kdef[2]
have invalid offets--that is, the number in the square brackets is not indicating a valid position in those arrays. I am not very good at debugging PHP, and the Cacti codebase is kind of spaghetti IMHO, but if you could find a way to print to your page the contents of those two variables, that would be a good start.

The command to get the contents of variables in PHP is:

Code: Select all

var_dump($ddef);
var_dump($ddef);
You may be able to get it to the Cacti log. Try changing your code at those lines to:

Code: Select all

cacti_log('$kdef contents: ' . var_dump($kdef);
$dsname = $kdef[2];
cacti_log('$ddef contents: ' . var_dump($ddef);
$temp1  = str_replace(".rrd", "", basename($ddef[1]));
if (substr_count(basename($ddef[1]), "_") == 0)
Then check your Cacti log and report back.

I'm honestly not sure if the above code will give you the answers you need--I primarily write Perl, but what's the worst that can happen?

Good luck!

--Tyler
worked on 0.8.8h
Regards,
Pizu
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests