Thold 2.x - Thresholding/Alerting module for cacti 8.6

Support questions about the Threshold plugin

Moderators: Developers, Moderators

Locked
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Post by chadd »

TheWitness wrote:Please note "sanitize_search_string" can be found in lib/functions.php on line 1643. Have you made any modifications to functions.php? Does you apache log have any other errors? Does functions.php compile successfully "php -l <cacti>/lib/functons.php"

TheWitness
Actually I looked in the '/lib/functions.php' file and found no instance of 'sanitize_search_string'. I did a diff between the 'functions.php' file and the 'functions.php.bak' which thold made when installed, and found that one of the missing things was the 'sanitize_search_string' function. I have attached the diff to this message. I am thinking about putting the 'sanitize' function in, but I know it can't be that easy of a fix ;-).. Can you help?
Attachments
diff.txt
UNIX diff between functions.php and the .bak which was created when I installed thold.
(5.71 KiB) Downloaded 320 times
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

You should perform a diff against the production 0.8.6f functions.php from what you have and make the corrections based upon that.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
petero
Posts: 13
Joined: Sun Jul 17, 2005 3:45 pm
Location: Poland

Post by petero »

Since its been a while since last patch and i see some fixex added on this forum.
Can anyone with thold working on 0.8.6f could post thold patch with super short install method?

And since it seem to be big addon ,would be great to put in additional scripts.Here at forum it hard to follow.

Thanx for helping
[quote][b]Cacti Version[/b] - 0.8.7b
[b]Plugin Architecture[/b] - 2.2 Beta
[b]Poller Type[/b] - Cactid v
[b]Server Info[/b] - Linux 2.6.20
[b]Web Server[/b] - Apache
[b]PHP[/b] - 5.2.6
[b]PHP Extensions[/b] - xmlwriter, libxml, dom, xmlreader, xml, tokenizer, session, pcre, SimpleXML, SPL, PDO, sockets, snmp, SQLite, standard, Reflection, posix, pdo_sqlite, mysql, mbstring, json, iconv, hash, gd, filter, date, ctype, zlib, apache2handler
[b]MySQL[/b] - 5.0.41-debug
[b]Plugins[/b][list]Large Site Performane
Network Discovery (discovery - v0.8.4)
Global Plugin Settings (settings - v0.5)
Nagios plugin for Cacti (npc - v2.0.0b)[/list][/quote]
alexus
Posts: 40
Joined: Fri Feb 04, 2005 8:38 pm
Location: Brooklyn, New York
Contact:

Post by alexus »

i tryed installing it for my cacti 0.8.6f and i got it somehow to at least appear in my cacti.. but i cant set even one thershold.. so obviosly i'm donig something wrong...

under managment i click at Thresholds and it says following

To add more elements - go to:
'Data Sources' -> 'select a host' (on top) -> and click the 'Template Name / Click for THold' section for the desired element

You can also auto-create baseline thresholds per device - go to:
'Devices' -> Click on a desierd device -> Click on 'Create graphs for this host' -> Click on 'Auto-create thresholds'


so i go to Data Sources, click on my disired device and i dont know where to click for template name / click for thold..

i dont have that...

can someone help me ?

please?

thanks in advance
[url]http://alexus.org/[/url] - [url]http://alexus.biz/[/url] - [url]http://alexus.fm/[/url] - [url]http://lexus.gs/[/url]
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Post by chadd »

TheWitness wrote:You should perform a diff against the production 0.8.6f functions.php from what you have and make the corrections based upon that.

TheWitness
That is what I did the diff on, the original 0.8.6f functions.php and the modified by thold2.1a functions.php.

I installed it from FreeBSD ports, and reinstalled it from ports just last week, so I am pretty sure I have the right file.

I will give it a shot, and see if I can't get it working. If I can I will supply the fixed functions.php file. Thanks.
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Post by chadd »

chadd wrote:
TheWitness wrote:You should perform a diff against the production 0.8.6f functions.php from what you have and make the corrections based upon that.

TheWitness
That is what I did the diff on, the original 0.8.6f functions.php and the modified by thold2.1a functions.php.

I installed it from FreeBSD ports, and reinstalled it from ports just last week, so I am pretty sure I have the right file.

I will give it a shot, and see if I can't get it working. If I can I will supply the fixed functions.php file. Thanks.
Looks like I made it a bigger deal than it is. I just added the 'sanitize' function to the bottom of the 'functions.php' file that thold edited (which is where it was in the other file ;-) and it seems to have fixed the errors. I am attaching the fixed file, though it may not be completley devoid of errors, it work.. Just take the '.txt' off the end of the file.
Attachments
functions.php.txt
(88.23 KiB) Downloaded 425 times
a2line59
Posts: 45
Joined: Mon May 23, 2005 8:20 am
Location: France

Post by a2line59 »

i change my cacti version. Before i used 0.8.6c and i change for 0.8.6f
i used thold for 0.8.6c and now i have not thold for 0.8.6f

i see that a patch exists to use thold with 0.8.6f. I see it's a file to change.
can i change file in thold for 0.8.6c or do i need to apply thold for 0.8.6e ?
i see that a patch exists for 0.8.6e but i use Windows and extension is .patch
so i think they i have a little problem to apply this patch ?

how can i make ?

thanks
cub
Posts: 4
Joined: Mon May 16, 2005 9:06 am

Access Denied

Post by cub »

After installing the newest version of thold, I went to the site, clicked on the thold tab on cacti web interface and I got "Access Denied". I was logged in with "Admin" user.

Thanks in advance for any input.
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Post by chadd »

a2line59 wrote:i change my cacti version. Before i used 0.8.6c and i change for 0.8.6f
i used thold for 0.8.6c and now i have not thold for 0.8.6f

i see that a patch exists to use thold with 0.8.6f. I see it's a file to change.
can i change file in thold for 0.8.6c or do i need to apply thold for 0.8.6e ?
i see that a patch exists for 0.8.6e but i use Windows and extension is .patch
so i think they i have a little problem to apply this patch ?

how can i make ?

thanks
Sorry, the 'patch' file I put up there is from a UNIX installation, and it was for a thold2.1a on cacti 0.8.6f. But it is not actually a 'patch' it is just the functions.php file. Apparently thold2.1a, when installed, does not keep the 'sanitize_string' function in functions.php. So, I just added that function back. I am not sure how different the function.php file is between a unix and windows install, but if it is the same, you should just be able to replace you old file with this one. Just remember to make a backup in case it doesn't work ;-).
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

As far as the PHP portion of the installation, they are identical. As far as Cactid is concerned, the source is identical, the binaries differ.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
mvam
Cacti User
Posts: 87
Joined: Wed Jun 01, 2005 2:00 pm
Location: Seattle

Post by mvam »

changing directions a bit..

i started getting this: Notice: Undefined offset: 0 in /cacti/thold.php on line 65

on i'd say half my data sources when i try and setup a threshold. when i try to auto-create thresholds i get:

Update failed:

INSERT INTO thold (element, rra) VALUES (, 798)
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 798)' at line 1

not too helpful, anyway its a little frustrating. if anyone has any idea.. please feel free to share :D
alexus
Posts: 40
Joined: Fri Feb 04, 2005 8:38 pm
Location: Brooklyn, New York
Contact:

Re: Access Denied

Post by alexus »

cub wrote:After installing the newest version of thold, I went to the site, clicked on the thold tab on cacti web interface and I got "Access Denied". I was logged in with "Admin" user.

Thanks in advance for any input.
you need to give yourself accesss for that in user managment
[url]http://alexus.org/[/url] - [url]http://alexus.biz/[/url] - [url]http://alexus.fm/[/url] - [url]http://lexus.gs/[/url]
SilentMobius
Posts: 1
Joined: Tue Jul 26, 2005 7:16 am

Post by SilentMobius »

mvam wrote:changing directions a bit..
i started getting this: Notice: Undefined offset: 0 in /cacti/thold.php on line 65
I get something similar on line 35 of thold-functions.php

Looking at that function:

Code: Select all

function get_current_value($rra, $ds)
{
        global $config;
        $last_time_entry = rrd_last($rra, "MAX");
        $last_needed = $last_time_entry + 900;
        $result = rrdtool_function_fetch($rra, $last_time_entry-200, $last_needed);
        $idx = array_search($ds, $result["data_source_names"]);
        return round($result["values"][$idx][0]);
}
I found out I was getting (using XML_serializer)

Code: Select all

<result>
  <data_source_names>
    <def>hdd_free</def>
    <def>hdd_used</def>
    <def>ninety_fifth_percentile_maximum</def>
  </data_source_names>
  <values>
    <def />
    <def />
  </values>
</result>
No data in the structure, hence no array index 0

So I spent some time fiddling and I think that:

Code: Select all

$last_time_entry = rrd_last($rra, "MAX");
Isn't giving us what we want (we're getting beyond my understanding of cacti now)

So I played about a bit and found that:

Code: Select all

$result = rrdtool_function_fetch($rra, $last_time_entry-100, $last_needed);
worked fine (though may be giving a slightly earlier value) an example dump from this looks like:

Code: Select all

<result>
  <data_source_names>
    <def>hdd_free</def>
    <def>hdd_used</def>
    <def>ninety_fifth_percentile_maximum</def>
  </data_source_names>
  <values>
    <def>
      <def>3564592.16</def>
    </def>
    <def>
      <def>62325995.84</def>
    </def>
    <def>
      <def>62325995.84</def>
    </def>
  </values>
I guess the question is why doesn't the rrd_last($rra, "MAX"); give a value thats usable.
alexus
Posts: 40
Joined: Fri Feb 04, 2005 8:38 pm
Location: Brooklyn, New York
Contact:

Post by alexus »

if I click Auto-create thresholds I get

Update failed:
INSERT INTO thold (element, rra) VALUES (, 57)
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 57)' at line 1

mysql> select * from thold;
+----+---------+------+
| id | element | rra |
+----+---------+------+
| 1 | 25 | 44 |
+----+---------+------+
1 row in set (0.00 sec)

mysql>

thats what i have there right now...
[url]http://alexus.org/[/url] - [url]http://alexus.biz/[/url] - [url]http://alexus.fm/[/url] - [url]http://lexus.gs/[/url]
mvam
Cacti User
Posts: 87
Joined: Wed Jun 01, 2005 2:00 pm
Location: Seattle

Post by mvam »

i have 25 rows, which is exactly what shows up on my list..

Code: Select all

mysql> select * from thold;
+----+---------+------+
| id | element | rra  |
+----+---------+------+
|  1 | 142     |  196 |
|  2 | 142     |  197 |
|  3 | 142     |  199 |
|  4 | 143     |  200 |
|  5 | 143     |  201 |
|  6 | 143     |  203 |
|  7 | 144     |  204 |
|  8 | 144     |  205 |
|  9 | 144     |  207 |
| 10 | 145     |  208 |
| 11 | 145     |  209 |
| 12 | 145     |  211 |
| 13 | 146     |  212 |
| 14 | 146     |  213 |
| 15 | 146     |  215 |
| 16 | 147     |  216 |
| 17 | 147     |  217 |
| 18 | 147     |  219 |
| 19 | 148     |  220 |
| 20 | 148     |  221 |
| 21 | 148     |  223 |
| 22 | 377     |  530 |
| 23 | 378     |  532 |
| 24 | 379     |  533 |
| 25 | 380     |  534 |
+----+---------+------+
25 rows in set (0.00 sec)
luckily thats a pretty small number. i thought about dropping the tables for thold and performing a re-install. i'd like to use that as a last resort however.

i think i might have some damaged rrd files, if thats the case then i have some pretty big issues to clear up.
Locked

Who is online

Users browsing this forum: No registered users and 0 guests