Report plugin ''ReportIt" - v0.7.5a (released 23/12/11)

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
Hinzel
Posts: 16
Joined: Thu Feb 18, 2010 6:01 pm

Post by Hinzel »

Couple more modifications done, and this is now working.

in lib_int/func_validate.php:

Code: Select all

    $valids['operators']['S']   = array('+','-','*','/',',');
    $valids['operators']['R']   = array('+','-','*','/',',');
in lib_int/const_measurands.php

Code: Select all

                                                                'f_hgh' => 'Returns higher value of 2 floats',
                                                                'f_low' => 'Returns lower value of 2 floats');
in cc_measurands:

Code: Select all

        desc[17] = new Object();
        desc[17]["name"] = "f_hgh";
        desc[17]["params"] = '$var1, $var2: values to be compared';
        desc[17]["syntax"] = "<i>float</i> f_hgh <i>(float $var1, float $var2)</i>";
        desc[17]["description"] = "returns the larger of the 2 values, string.";
        desc[17]["example"] = '<table><tr><td width="75" align="left">-->float:<br>-->returns:</td><td align="left">f_high(27,70)<br>70</td></tr></table>';

        desc[18] = new Object();
        desc[18]["name"] = "f_low";
        desc[18]["params"] = '$var1, $var2: values to be compared';
        desc[18]["syntax"] = "<i>float</i> f_low <i>(float $var1, float $var2)</i>";
        desc[18]["description"] = "returns the smaller of the 2 values, string.";
        desc[18]["example"] = '<table><tr><td width="75" align="left">-->float:<br>-->returns:</td><td align="left">f_high(27,70)<br>27</td></tr></table>';

et voila!

95th = f_xth(95)*8
95H = f_hgh(95TH:traffic_in,95TH:traffic_out)
User avatar
browniebraun
Developer
Posts: 791
Joined: Tue Jun 13, 2006 1:17 am
Location: Cologne, Germany

Post by browniebraun »

Hinzel wrote:Couple more modifications done, and this is now working.

in lib_int/func_validate.php:

Code: Select all

    $valids['operators']['S']   = array('+','-','*','/',',');
    $valids['operators']['R']   = array('+','-','*','/',',');
in lib_int/const_measurands.php

Code: Select all

                                                                'f_hgh' => 'Returns higher value of 2 floats',
                                                                'f_low' => 'Returns lower value of 2 floats');
in cc_measurands:

Code: Select all

        desc[17] = new Object();
        desc[17]["name"] = "f_hgh";
        desc[17]["params"] = '$var1, $var2: values to be compared';
        desc[17]["syntax"] = "<i>float</i> f_hgh <i>(float $var1, float $var2)</i>";
        desc[17]["description"] = "returns the larger of the 2 values, string.";
        desc[17]["example"] = '<table><tr><td width="75" align="left">-->float:<br>-->returns:</td><td align="left">f_high(27,70)<br>70</td></tr></table>';

        desc[18] = new Object();
        desc[18]["name"] = "f_low";
        desc[18]["params"] = '$var1, $var2: values to be compared';
        desc[18]["syntax"] = "<i>float</i> f_low <i>(float $var1, float $var2)</i>";
        desc[18]["description"] = "returns the smaller of the 2 values, string.";
        desc[18]["example"] = '<table><tr><td width="75" align="left">-->float:<br>-->returns:</td><td align="left">f_high(27,70)<br>27</td></tr></table>';

et voila!

95th = f_xth(95)*8
95H = f_hgh(95TH:traffic_in,95TH:traffic_out)
Really nice!
Keep in mind that one or both values can be NAN.

Best regards
-Andreas-


Edit: A comma is not an operator. That corrupts the validation of formulas.
Hat das Blümchen einen Knick, war der Schmetterling zu dick! ;)
reportit v0.7.5a
SNMPAgent v0.2.3
Download ReportIt | Download SNMPAgent | ReportIt SVN | ReportIt Templates | Wish list
Hinzel
Posts: 16
Joined: Thu Feb 18, 2010 6:01 pm

Post by Hinzel »

hmmm it's not breaking any of my reports, but would this be safer?

Code: Select all

    $valids['signs']['S']               = array('(', ')', '.', ',');
    $valids['signs']['R']               = array('L', 'R', '.', ',');
User avatar
browniebraun
Developer
Posts: 791
Joined: Tue Jun 13, 2006 1:17 am
Location: Cologne, Germany

Post by browniebraun »

Hinzel wrote:hmmm it's not breaking any of my reports, but would this be safer?

Code: Select all

    $valids['signs']['S']               = array('(', ')', '.', ',');
    $valids['signs']['R']               = array('L', 'R', '.', ',');
Try: f_hgh(95TH:traffic_in,,95TH:traffic_out)
Hat das Blümchen einen Knick, war der Schmetterling zu dick! ;)
reportit v0.7.5a
SNMPAgent v0.2.3
Download ReportIt | Download SNMPAgent | ReportIt SVN | ReportIt Templates | Wish list
sukanta
Cacti User
Posts: 139
Joined: Tue Jan 26, 2010 6:12 am

Post by sukanta »

All Data showing zero after upgrading cacti to 8.7g
sukanta
Cacti User
Posts: 139
Joined: Tue Jan 26, 2010 6:12 am

Post by sukanta »

After reinstalling problem resolved but image is broken....
Attachments
reportit.JPG
reportit.JPG (23.83 KiB) Viewed 17185 times
User avatar
browniebraun
Developer
Posts: 791
Joined: Tue Jun 13, 2006 1:17 am
Location: Cologne, Germany

Post by browniebraun »

sukanta wrote:After reinstalling problem resolved but image is broken....
Which version of ReportIt are you using?

Best regards
-Andreas-
Hat das Blümchen einen Knick, war der Schmetterling zu dick! ;)
reportit v0.7.5a
SNMPAgent v0.2.3
Download ReportIt | Download SNMPAgent | ReportIt SVN | ReportIt Templates | Wish list
sukanta
Cacti User
Posts: 139
Joined: Tue Jan 26, 2010 6:12 am

Post by sukanta »

0.7.2
User avatar
browniebraun
Developer
Posts: 791
Joined: Tue Jun 13, 2006 1:17 am
Location: Cologne, Germany

Post by browniebraun »

sukanta wrote:0.7.2
Hi Sukanta!

At the moment I can not reconstruct the issue you are currently having regarding ReportIt 0.7.2 and Cacti 0.8.7g.
Can you send me more information via PM? Is there only one report affected or does that happen with every report?

Best regards
-Andreas-
Hat das Blümchen einen Knick, war der Schmetterling zu dick! ;)
reportit v0.7.5a
SNMPAgent v0.2.3
Download ReportIt | Download SNMPAgent | ReportIt SVN | ReportIt Templates | Wish list
jumbo
Posts: 6
Joined: Mon Mar 15, 2010 7:23 am

Undefined index: data_type

Post by jumbo »

Hello,

today I have upgraded from Cacti 8.7e to latest 8.7g, installed the latest PIA 8.7g, and copied the new ReportIt 0.7.2 into the plugin directory. All working fine, I was able to install/enable the plugin, however when I looked on the existing report (it got it from previous version from the DB I think), I see a lot of the following error messages:

Code: Select all

Notice: Undefined index: data_type in /usr/share/cacti/site/plugins/reportit/cc_view.php on line 683
Notice: Undefined index: data_precision in /usr/share/cacti/site/plugins/reportit/cc_view.php on line 684
This message is repeated many times, probably for every item in the list. The report tables is below all of these error messages, but instead of interger values it contains this error message in every cell:

Code: Select all

Notice: Undefined index: in /usr/share/cacti/site/plugins/reportit/lib_int/funct_shared.php on line 35
I have tried to rerun the report, it runs it without any complains, but viewing it in Reports tab produces exactly the same output as above. I am attaching the tech_support details.
Attachments
cactitech.txt
(16.61 KiB) Downloaded 2939 times
User avatar
browniebraun
Developer
Posts: 791
Joined: Tue Jun 13, 2006 1:17 am
Location: Cologne, Germany

Re: Undefined index: data_type

Post by browniebraun »

jumbo wrote:Hello,

today I have upgraded from Cacti 8.7e to latest 8.7g, installed the latest PIA 8.7g, and copied the new ReportIt 0.7.2 into the plugin directory. All working fine, I was able to install/enable the plugin, however when I looked on the existing report (it got it from previous version from the DB I think), I see a lot of the following error messages:

Code: Select all

Notice: Undefined index: data_type in /usr/share/cacti/site/plugins/reportit/cc_view.php on line 683
Notice: Undefined index: data_precision in /usr/share/cacti/site/plugins/reportit/cc_view.php on line 684
This message is repeated many times, probably for every item in the list. The report tables is below all of these error messages, but instead of interger values it contains this error message in every cell:

Code: Select all

Notice: Undefined index: in /usr/share/cacti/site/plugins/reportit/lib_int/funct_shared.php on line 35
I have tried to rerun the report, it runs it without any complains, but viewing it in Reports tab produces exactly the same output as above. I am attaching the tech_support details.
There's a bug in ReportIt's upgrade procedure, so that two new columns are missing. Their content is necessary to format the results. You do not have to rerun your reports!
Login to your mysql server and execute following commands:

Code: Select all

ALTER TABLE `reportit_measurands` 
            ADD `data_type` SMALLINT NOT NULL DEFAULT '1', 
            ADD `data_precision` SMALLINT NOT NULL DEFAULT '2'; 
ALTER TABLE `reportit_cache_measurands` 
            ADD `data_type` SMALLINT NOT NULL DEFAULT '1', 
            ADD `data_precision` SMALLINT NOT NULL DEFAULT '2';
Best regards
-Andreas-
Hat das Blümchen einen Knick, war der Schmetterling zu dick! ;)
reportit v0.7.5a
SNMPAgent v0.2.3
Download ReportIt | Download SNMPAgent | ReportIt SVN | ReportIt Templates | Wish list
jumbo
Posts: 6
Joined: Mon Mar 15, 2010 7:23 am

Post by jumbo »

it works, great, thanks a lot

-jumbo
nuzzy
Posts: 42
Joined: Mon Feb 23, 2009 10:33 am

can't get it to show up

Post by nuzzy »

I had a really old version of reportit and ran the uninstall.php file and then completely removed it. I untarred 0.7.2 and placed it in my plugins directory, but it's not showing up under "Plugin Management". I'm running 0.8.7g and 2.8 PIA. Any ideas why this is happening?
Cacti 0.8.8a on CentOS
Mule
Posts: 4
Joined: Mon Aug 09, 2010 11:32 pm

Post by Mule »

browniebraun wrote:
sukanta wrote:0.7.2
Hi Sukanta!

At the moment I can not reconstruct the issue you are currently having regarding ReportIt 0.7.2 and Cacti 0.8.7g.
Can you send me more information via PM? Is there only one report affected or does that happen with every report?

Best regards
-Andreas-
I've struck this same issue and after sitting down and looking at the source for a bit realized that it's probably related to the browser being used. I predominantly use Firefox and it was missing the bgcolor from the tables however in Internet Explorer it was all there.

Digging through the source showed me that sometimes bgcolor='#abcdef' is used, and other places bgcolor='abcdef' (with and without the hash).

After updating all bgcolor entries to include the hash Firefox is again displaying the tables correctly.

BTW, I love this plugin! Are there any plans to extend the reporting to do future predictions (trending/capacity management stuff) and/or calculate when a resource will run out (50 days until the D: drive utilization is at 100% given the current rate of growth)?
Attachments
bgcolorfix.diff.txt
Updates I did to fix it for Firefox. It should apply cleanly being put in the reportit directory then run:
mv bgcolorfix.diff.txt bgcolorfix.diff (may not be necessary, long time since I've used patch heavily)
patch -p1 &lt; bgcolorfix.diff
(7.63 KiB) Downloaded 2905 times
User avatar
browniebraun
Developer
Posts: 791
Joined: Tue Jun 13, 2006 1:17 am
Location: Cologne, Germany

Post by browniebraun »

Mule wrote:
I've struck this same issue and after sitting down and looking at the source for a bit realized that it's probably related to the browser being used. I predominantly use Firefox and it was missing the bgcolor from the tables however in Internet Explorer it was all there.

Digging through the source showed me that sometimes bgcolor='#abcdef' is used, and other places bgcolor='abcdef' (with and without the hash).

After updating all bgcolor entries to include the hash Firefox is again displaying the tables correctly.

BTW, I love this plugin! Are there any plans to extend the reporting to do future predictions (trending/capacity management stuff) and/or calculate when a resource will run out (50 days until the D: drive utilization is at 100% given the current rate of growth)?
Hi Mule!
Many thanks for your help! I know it's time for a clean-up and time to replace all of these ugly inline arguments.
Beside a new plugin I'm currently working on 0.7.3 where I will implement the two new functions "f_high" and "f_low". (Similar to that what Hinzel has proposed but without the limitation of 2 parameters.)
I only did the first step for trending with the creation of f_grd. Probably somebody has a good idea how to calculate the number of seconds until a threshold will be exceeded.

Best regards
-Andreas-
Hat das Blümchen einen Knick, war der Schmetterling zu dick! ;)
reportit v0.7.5a
SNMPAgent v0.2.3
Download ReportIt | Download SNMPAgent | ReportIt SVN | ReportIt Templates | Wish list
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest