How can I hard code it "ifspeed" (reportit)

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
White Horse
Cacti User
Posts: 54
Joined: Tue Dec 22, 2009 1:54 am

How can I hard code it "ifspeed" (reportit)

Post by White Horse »

I have plugin reportit that need "ifspeed" option in some formulas, but speed is not shaped on interface that I m pooling so instead of 50M he gives me 100M i.e interface maximum.

My question is; how can I hard code it "ifspeed" on every interface. Please be detail as much as you can or link "howto", i tried to google it but - no luck.

Ty, regards
Last edited by White Horse on Mon Apr 05, 2010 5:34 am, edited 1 time in total.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

That depends on your needs. Do you want to set the rrd files ds-maximum? Or do you want to use it with CDEFs? Or do you want to use it outside of cacti?
And another question arises: Does your ifSpeed change with time? E.g. by auto-negotiation or e.g. WLAN?
R.
White Horse
Cacti User
Posts: 54
Joined: Tue Dec 22, 2009 1:54 am

Post by White Horse »

I made report of all my links using Cacti plugin "reportit", in one forumula i use maxValue - that says that he will take "ifspeed" from interface as my max alow bandwidth, and the value is correct for most of the interfaces but for some it is wrong.

For example, I have 1Gig interface that is shaped on on provider side by 50M, but "ifspeed" says it is 1Gig and he is right because no shape-ing or QOS is put on my side. Also on subintefaces he takes speed of physical interface, so that messes up my output info.

I dont thing i need rrd files ds-maximum, I just need to manually enter interface speed (max allowed bandwidth).

I m new to cacti so bear with me, i think Reportit uses interface statistic query to find out "ifspeed" so I maybe I can manualy change "ifspeed" there for problematic interfaces? If so than how?

I dont have wlan, all interfaces are 1G or 100M that are shaped by qos or bandwidth command on cisco routers, but sadly not on all so there rises my problem.
Last edited by White Horse on Sun Apr 04, 2010 6:25 am, edited 1 time in total.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

I'm quite sure that it is possible to use fixed numbers on reportit formulaes. But you will have considered this already.
Is there any "source" for Cacti to retrieve the wanted QoS limit from?
R.
White Horse
Cacti User
Posts: 54
Joined: Tue Dec 22, 2009 1:54 am

Post by White Horse »

EDIT; admins, please move this to Plugin general section

I found solution that is perfect for me, it is not hard coding "ifspeed" but just telling Reportit that takes "maximum value" of DS insted of "ifspeed".

Great help was PHP edit of user BRYLANT that he edited funct_runtime.php and runtime.php so that do the same as mention above but for him only when "ifspeed"=0

For me it is just simple "ifspeed"="maxRRDValue";

In lib_int/funct_runtime.php update code at line 45

Code: Select all

        $sql = "SELECT d.rrd_maximum as maxRRD, c.field_value as maxValue, a.*
                        FROM reportit_data_items as a
                        LEFT JOIN data_local as b
                        ON (b.id=a.id)
                        LEFT JOIN host_snmp_cache as c
                        on (c.host_id=b.host_id AND
                        c.snmp_index=b.snmp_index AND
                        c.snmp_query_id=b.snmp_query_id AND
                        c.field_name='ifSpeed')
                        LEFT JOIN data_template_rrd as d
                        on (d.local_data_id=a.id AND
                        d.data_source_name LIKE 'traffic_in')
                        WHERE a.report_id = $report_id
                        ORDER BY a.id";
and in runtime.php add this at line 437

Code: Select all

               $maxRRDValue            = $report_definitions['data_items'][$i]['maxRRD'];
and update this in line 627

Code: Select all

       //----- Update variables and create calculating parameters -----
        //if($maxValue !== NULL) {
           // if($maxValue > 0 & $maxValue < 4294967295) 
                //$variables['maxValue'] = $maxValue; 
            //elseif($maxValue == 4294967295 & $maxHighValue !== Null) 
               // $variables['maxValue'] = $maxHighValue*1000000; 
            //elseif($maxValue == 0 & $maxRRDValue != 0) 
                $variables['maxValue'] = $maxRRDValue; 
            //else 
                //$variables['maxValue'] = $maxValue;
        //}else{
            //$variables['maxValue'] = $maximum;
        //}
.[/quote]

Also don't forget to edit Interface - Traffic data template. Just check "Maximum Value ** Use Per-Data Source Value (Ignore this Value)" on Inbound traffic and Outbound if necessary.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Moved on user request
R.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests