New plugin: Predict (v0.1)

Announcements concerning Plugins for Cacti

Moderators: Developers, Moderators

rvd
Posts: 34
Joined: Wed Nov 21, 2007 10:09 am
Location: France

New plugin: Predict (v0.1)

Post by rvd »

Hi everybody,
RRDtool provides a great feature : PREDICT.
Of course, you can use it in CDEFs but have then to rewrite your graphs to really enjoy it.
So I created a plugin, originally called predict which allows you to watch a datasource and its "normal" behaviour (calculated with RRDTool feature PREDICT) between 2 dates. The end date may be in the future... cacti as a fortune teller ! :)
By the way, remember that PREDICT will just estimate a datasource basing on its previous values.
Beware, it works on datasources, not on graphs (maybe in a later version ???).
You can download it and see screenshots there : http://docs.cacti.net/userplugin:predict
Any remark/suggestion will be appreciated.
exseven
Posts: 13
Joined: Tue Jun 24, 2008 9:57 am

Re: New plugin: Predict (v0.1)

Post by exseven »

Tried out the plugin and I am getting an error when attempting to generate a graph. Any idea?


PHP Fatal error: Call to undefined function hash() in /usr/local/share/cacti/plugins/predict/predict_res.php on line 54" while reading response header from upstream
rvd
Posts: 34
Joined: Wed Nov 21, 2007 10:09 am
Location: France

Re: New plugin: Predict (v0.1)

Post by rvd »

ok try to install php-hash
if you can't you may try to replace in line 54
$hash_calc = hash('md5', "$ds_id$date_start$date_end$tspan$units$win");
with
$hash_calc = "$ds_id$date_start$date_end$tspan$units$win";
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Re: New plugin: Predict (v0.1)

Post by mcutting »

This plugin doesn't seem to create any images in the tmp directory, nor can I see them in the console. I even set 777 rights on the relevant directories - still nothing - any thoughts ?
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
rvd
Posts: 34
Joined: Wed Nov 21, 2007 10:09 am
Location: France

Re: New plugin: Predict (v0.1)

Post by rvd »

Please have a look in your http error_log file and tell me about.
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Re: New plugin: Predict (v0.1)

Post by mcutting »

Does this help ?

Code: Select all

ERROR: invalid rpn expression in: 3600,-4,300,a,PREDICT
[Fri Nov 23 08:43:04 2012] [error] [client xxx.xxx.xxx.xxx] File does not exist: /usr/share/cacti/site/plugins/predict/tmp/f_test.png, referer: http://cactiserver/cacti/plugins/predict/predict_res.php
[Fri Nov 23 08:43:06 2012] [error] [client xxx.xxx.xxx.xxx] PHP Notice:  Undefined index: Week in /usr/share/cacti/site/plugins/predict/predict.php on line 64, referer: http://cactiserver/cacti/plugins/predict/predict_res.php
[Fri Nov 23 08:43:06 2012] [error] [client xxx.xxx.xxx.xxx] PHP Notice:  Undefined index: AREA in /usr/share/cacti/site/plugins/predict/predict.php on line 68, referer: http://cactiserver/cacti/plugins/predict/predict_res.php
[Fri Nov 23 08:43:06 2012] [error] [client xxx.xxx.xxx.xxx] PHP Notice:  Undefined index: LINE2 in /usr/share/cacti/site/plugins/predict/predict.php on line 70, referer: http://cactiserver/cacti/plugins/predict/predict_res.php
[Fri Nov 23 08:43:06 2012] [error] [client xxx.xxx.xxx.xxx] PHP Warning:  unlink(tmp/f_test.png): No such file or directory in /usr/share/cacti/site/plugins/predict/predict.php on line 75, referer: http://cactiserver/cacti/plugins/predict/predict_res.php
[Fri Nov 23 08:43:06 2012] [error] [client xxx.xxx.xxx.xxx] File does not exist: /var/www/favicon.ico
ERROR: invalid rpn expression in: 3600,-4,300,a,PREDICT
[Fri Nov 23 08:43:07 2012] [error] [client xxx.xxx.xxx.xxx] File does not exist: /usr/share/cacti/site/plugins/predict/tmp/f_test.png, referer: http://cactiserver/cacti/plugins/predict/predict_res.php
ERROR: Could not make sense out of '08:432012-11-24'
[Fri Nov 23 08:46:44 2012] [error] [client xxx.xxx.xxx.xxx] File does not exist: /usr/share/cacti/site/plugins/predict/tmp/f_62322012-11-22 08:432012-11-24 08:4336003300.png, referer: http://cactiserver/cacti/plugins/predict/predict_res.php
ERROR: Could not make sense out of '08:432012-11-24'
[Fri Nov 23 08:46:57 2012] [error] [client xxx.xxx.xxx.xxx] File does not exist: /usr/share/cacti/site/plugins/predict/tmp/f_62322012-11-22 08:432012-11-24 08:4336003300.png, referer: http://cactiserver/cacti/plugins/predict/predict_res.php
[Fri Nov 23 08:48:05 2012] [error] [client xxx.xxx.xxx.xxx] PHP Notice:  Undefined index: Week in /usr/share/cacti/site/plugins/predict/predict.php on line 64, referer: http://cactiserver/cacti/plugins/predict/predict_res.php
[Fri Nov 23 08:48:05 2012] [error] [client xxx.xxx.xxx.xxx] PHP Notice:  Undefined index: AREA in /usr/share/cacti/site/plugins/predict/predict.php on line 68, referer: http://cactiserver/cacti/plugins/predict/predict_res.php
[Fri Nov 23 08:48:05 2012] [error] [client xxx.xxx.xxx.xxx] PHP Notice:  Undefined index: LINE2 in /usr/share/cacti/site/plugins/predict/predict.php on line 70, referer: http://cactiserver/cacti/plugins/predict/predict_res.php
[Fri Nov 23 08:48:05 2012] [error] [client xxx.xxx.xxx.xxx] PHP Warning:  unlink(tmp/f_62322012-11-22 08:432012-11-24 08:4336003300.png): No such file or directory in /usr/share/cacti/site/plugins/predict/predict.php on line 75, referer: http://cactiserver/cacti/plugins/predict/predict_res.php
[Fri Nov 23 08:48:05 2012] [error] [client xxx.xxx.xxx.xxx] File does not exist: /var/www/favicon.ico
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
rvd
Posts: 34
Joined: Wed Nov 21, 2007 10:09 am
Location: France

Re: New plugin: Predict (v0.1)

Post by rvd »

May be the issue is in my reply to exseven on 11/06 :
ok try to install php-hash
if you can't you may try to replace in line 54
$hash_calc = hash('md5', "$ds_id$date_start$date_end$tspan$units$win");
with
$hash_calc = "$ds_id$date_start$date_end$tspan$units$win";
The plugin was tested with php-hash. If you have it, it's better and keep line 54 in predict_res.php
If you have not, replace line 54 with something like
$hash_calc = preg_replace('/\W/','',"$ds_id$date_start$date_end$tspan$units$win");
to avoid having special chars, I suppose that spaces in the temp filename was not a good idea, sorry ! :(
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Re: New plugin: Predict (v0.1)

Post by mcutting »

Already tried that, and your just posted suggestion, but still no image - sorry :D
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
rvd
Posts: 34
Joined: Wed Nov 21, 2007 10:09 am
Location: France

Re: New plugin: Predict (v0.1)

Post by rvd »

What does say the error_log now ?
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Re: New plugin: Predict (v0.1)

Post by mcutting »

Code: Select all

[Fri Nov 23 10:43:18 2012] [error] [client xxx.xxx.xxx.xxx] File does not exist: /usr/share/cacti/site/plugins/predict/tmp/f_623220121122103720121124103736003300.png, referer: http://cactiserver/cacti/plugins/predict/predict_res.php
[Fri Nov 23 11:01:52 2012] [error] [client xxx.xxx.xxx.xxx] PHP Notice:  Undefined offset: 3 in /usr/share/audit/admin_pc_add_2.php on line 1744
[Fri Nov 23 11:01:52 2012] [error] [client xxx.xxx.xxx.xxx] PHP Notice:  Undefined offset: 4 in /usr/share/audit/admin_pc_add_2.php on line 1745
[Fri Nov 23 11:01:52 2012] [error] [client xxx.xxx.xxx.xxx] PHP Notice:  Undefined offset: 5 in /usr/share/audit/admin_pc_add_2.php on line 1746
[Fri Nov 23 11:01:52 2012] [error] [client xxx.xxx.xxx.xxx] PHP Notice:  Undefined offset: 6 in /usr/share/audit/admin_pc_add_2.php on line 1747
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
rvd
Posts: 34
Joined: Wed Nov 21, 2007 10:09 am
Location: France

Re: New plugin: Predict (v0.1)

Post by rvd »

Solved upgrading rrdtool to 1.4.7
rvd
Posts: 34
Joined: Wed Nov 21, 2007 10:09 am
Location: France

Re: New plugin: Predict (v0.1)

Post by rvd »

See attached v0.1.1 :
- Temporary file name now depends on php hash module installed or not
- Put default settings at plugin installation

It seems that RRDTOOL needs to be at least 1.4.x, even though I saw 1.3.x elsewhere :(

Thx to mcutting and Julio Vargas
Attachments
predict-0.1.1.zip
(55.57 KiB) Downloaded 278 times
rvd
Posts: 34
Joined: Wed Nov 21, 2007 10:09 am
Location: France

Re: New plugin: Predict (v0.1)

Post by rvd »

New version available there :
http://docs.cacti.net/_media/userplugin ... _0.1.3.zip
Fixes issues with ds names under windows especially colon in file name which could not let rrdtool graph work.
Thank you Praveen Kumar !
Laura4321
Posts: 8
Joined: Fri Feb 15, 2013 4:48 am

Re: New plugin: Predict (v0.1)

Post by Laura4321 »

Hello,

I´m trying to use this plugin because I think it is very interesting but I have the same problem, no graph appears when I execute it.

I have installed Predict 0.1.3 in Windows Server 2008 R2 Standard.

Do I need something else? Should I change something more?

Thanks in advance.

Regards,

Laura.
rvd
Posts: 34
Joined: Wed Nov 21, 2007 10:09 am
Location: France

Re: New plugin: Predict (v0.1)

Post by rvd »

As seen with Laura, solved by changing rights ton tmp directory
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests