Trouble with Thold after upgrading to 0.8.8b

Support questions about the Threshold plugin

Moderators: Moderators, Developers

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

Trouble with Thold after upgrading to 0.8.8b

#1 Post by redpeppers01 » Sun Sep 01, 2013 10:44 pm

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

#2 Post by Mrys » Mon Sep 02, 2013 3:33 am

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

#3 Post by tylerc » Tue Sep 03, 2013 5:57 am

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

#4 Post by redpeppers01 » Thu Sep 05, 2013 2:20 am

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

#5 Post by Mrys » Fri Sep 06, 2013 5:19 am

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

#6 Post by redpeppers01 » Fri Sep 06, 2013 5:46 pm

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

#7 Post by Mrys » Tue Sep 10, 2013 6:50 am

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

#8 Post by dvc » Mon Sep 23, 2013 12:02 am

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

#9 Post by acleech » Thu Dec 12, 2013 9:36 pm

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

#10 Post by draconis » Sat Feb 22, 2014 7:38 am

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

#11 Post by sh33zo » Thu Jul 10, 2014 6:48 pm

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

#12 Post by xfrags » Thu Jun 04, 2015 6:23 am

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

#13 Post by pizu » Thu Jul 27, 2017 5:00 am

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