CDEFs not working

Support questions about the Threshold plugin

Moderators: Developers, Moderators

daemon
Cacti User
Posts: 61
Joined: Tue Jun 21, 2005 12:16 pm

Post by daemon »

alright, I believe I've found the exact part of the code that is the cause of my woes. if you look at the function get_current_value, at one point it does a search in $result["data_source_names"] for rrd_maximum. when I printed out the array, though, it only has three values, none of which are rrd_maximum:

[0] => traffic_in
[1] => traffic_out
[2] => nth_percentile_maximum

so, if we can figure out why it's not in this array and (more usefully) how to get it in there, this should be fixed. here's the code with the problem line called out.

Code: Select all

function get_current_value($rra, $ds, $cdef = 0) {
        global $config;
        $last_time_entry = thold_rrd_last($rra, "AVERAGE");

        // This should fix and "did you really mean month 899 errors", this is because your RRD has not polled yet
        if ($last_time_entry == -1)
                $last_time_entry = time();

        // Round down to the nearest 100
        $last_time_entry = (intval($last_time_entry /100) * 100) - 300;
        $last_needed = $last_time_entry + 300;

        $result = rrdtool_function_fetch($rra, trim($last_time_entry), trim($last_needed));

        // Return Blank if the data source is not found (Newly created?)
        if (!isset( $result["data_source_names"])) return "";

-------> $idx = array_search($ds, $result["data_source_names"]);

        // Return Blank if the value was not found (Cache Cleared?)
        if (!isset($result["values"][$idx][0]))
                        return "";

        $value = $result["values"][$idx][0];
        if ($cdef != 0)
                $value = thold_build_cdef($cdef, $value, $rra, $ds);
        return round($value, 4);
}

cacti 0.8.6h | cactid 0.8.6g
mysql 4.1.16 | net-snmp 5.1.2-11 | rrdtool 1.0.50 | apache 2.2.0 | php 5.1.2 | RHEL AS rel. 4 kernel 2.6.9-22.ELsmp
apperrault
Cacti User
Posts: 379
Joined: Fri Feb 16, 2007 11:37 am
Location: Emeryville, CA
Contact:

Post by apperrault »

Hi all,
How do i apply the patch included in this post. I am relatively new to Cacti. I am trying to get the THold plugin to work properly, but i don't understand what to do with this patch file. Any assistance would be greatly appreciated.

app
[b]Cacti Version[/b] - 0.8.7b
[b]Plugin Architecture[/b] - 2.2 Beta
[b]Poller Type[/b] - CMD.php
[b]Server Info[/b] - Linux 2.6.9-78.0.1.ELsmp
[b]Web Server[/b] - Apache/2.0.52 (Red Hat)
[b]PHP[/b] - 4.3.9
[b]MySQL[/b] - 4.1.22
[b]RRDTool[/b] - 1.2.23
[b]SNMP[/b] - 5.1.2
[b]Plugins[/b][list]Global Plugin Settings (settings - v0.5)
SuperLinks (superlinks - v0.72)
Host Info (hostinfo - v0.2)
Report Creator (reports - v0.3)
Update Checker (update - v0.4)
Realtime for Cacti (realtime - v0.35)
Cacti Log View (clog - v1.1)
RRD File Cleaner (rrdclean - v0.36)
Network Discovery (discovery - v0.9)
Uptime (uptime - v0.4)[/list]
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

apperrault wrote:Hi all,
How do i apply the patch included in this post. I am relatively new to Cacti. I am trying to get the THold plugin to work properly, but i don't understand what to do with this patch file. Any assistance would be greatly appreciated.

app
You are using thold v0.3.2, the above patch is old, and should actually already be applied and possibly even changed a little.
apperrault
Cacti User
Posts: 379
Joined: Fri Feb 16, 2007 11:37 am
Location: Emeryville, CA
Contact:

Post by apperrault »

I am using 0.3.2 version. I would really love to use this plugin, as an addition to Nagios that we are using here in our office, this way i can set specific thresholds for certain systems, that we want monitored differently than the corporate standard. Any assistance in getting this up and running would be greatly apprecaited.

Thanks much

app
[b]Cacti Version[/b] - 0.8.7b
[b]Plugin Architecture[/b] - 2.2 Beta
[b]Poller Type[/b] - CMD.php
[b]Server Info[/b] - Linux 2.6.9-78.0.1.ELsmp
[b]Web Server[/b] - Apache/2.0.52 (Red Hat)
[b]PHP[/b] - 4.3.9
[b]MySQL[/b] - 4.1.22
[b]RRDTool[/b] - 1.2.23
[b]SNMP[/b] - 5.1.2
[b]Plugins[/b][list]Global Plugin Settings (settings - v0.5)
SuperLinks (superlinks - v0.72)
Host Info (hostinfo - v0.2)
Report Creator (reports - v0.3)
Update Checker (update - v0.4)
Realtime for Cacti (realtime - v0.35)
Cacti Log View (clog - v1.1)
RRD File Cleaner (rrdclean - v0.36)
Network Discovery (discovery - v0.9)
Uptime (uptime - v0.4)[/list]
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

apperrault wrote:I am using 0.3.2 version. I would really love to use this plugin, as an addition to Nagios that we are using here in our office, this way i can set specific thresholds for certain systems, that we want monitored differently than the corporate standard. Any assistance in getting this up and running would be greatly apprecaited.

Thanks much

app
What isn't working? The above patch should not be necessary anymore as it has already been integrated.
apperrault
Cacti User
Posts: 379
Joined: Fri Feb 16, 2007 11:37 am
Location: Emeryville, CA
Contact:

Post by apperrault »

I cannot get percentages to work. I have tried creating the CDEF and applying it to the THold, but if i put in 90, for the space used, i don't get 90% i get alerted that the system is over 90 (MBs i would assume).

How do i get it to apply the percentages correctly?

app
[b]Cacti Version[/b] - 0.8.7b
[b]Plugin Architecture[/b] - 2.2 Beta
[b]Poller Type[/b] - CMD.php
[b]Server Info[/b] - Linux 2.6.9-78.0.1.ELsmp
[b]Web Server[/b] - Apache/2.0.52 (Red Hat)
[b]PHP[/b] - 4.3.9
[b]MySQL[/b] - 4.1.22
[b]RRDTool[/b] - 1.2.23
[b]SNMP[/b] - 5.1.2
[b]Plugins[/b][list]Global Plugin Settings (settings - v0.5)
SuperLinks (superlinks - v0.72)
Host Info (hostinfo - v0.2)
Report Creator (reports - v0.3)
Update Checker (update - v0.4)
Realtime for Cacti (realtime - v0.35)
Cacti Log View (clog - v1.1)
RRD File Cleaner (rrdclean - v0.36)
Network Discovery (discovery - v0.9)
Uptime (uptime - v0.4)[/list]
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

apperrault wrote:I cannot get percentages to work. I have tried creating the CDEF and applying it to the THold, but if i put in 90, for the space used, i don't get 90% i get alerted that the system is over 90 (MBs i would assume).

How do i get it to apply the percentages correctly?

app
What is your CDEF?
apperrault
Cacti User
Posts: 379
Joined: Fri Feb 16, 2007 11:37 am
Location: Emeryville, CA
Contact:

Post by apperrault »

Hi there, here is what my CDEF looks like:

Code: Select all

cdef=CURRENT_DATA_SOURCE,CURRENT_DS_MAXIMUM_VALUE,/,100,*
I have also attached a screen shot of the actual page.

Thanks for the help

app
Attachments
CDEF.PNG
CDEF.PNG (83.56 KiB) Viewed 6275 times
[b]Cacti Version[/b] - 0.8.7b
[b]Plugin Architecture[/b] - 2.2 Beta
[b]Poller Type[/b] - CMD.php
[b]Server Info[/b] - Linux 2.6.9-78.0.1.ELsmp
[b]Web Server[/b] - Apache/2.0.52 (Red Hat)
[b]PHP[/b] - 4.3.9
[b]MySQL[/b] - 4.1.22
[b]RRDTool[/b] - 1.2.23
[b]SNMP[/b] - 5.1.2
[b]Plugins[/b][list]Global Plugin Settings (settings - v0.5)
SuperLinks (superlinks - v0.72)
Host Info (hostinfo - v0.2)
Report Creator (reports - v0.3)
Update Checker (update - v0.4)
Realtime for Cacti (realtime - v0.35)
Cacti Log View (clog - v1.1)
RRD File Cleaner (rrdclean - v0.36)
Network Discovery (discovery - v0.9)
Uptime (uptime - v0.4)[/list]
lordzik
Posts: 11
Joined: Wed Jan 24, 2007 4:15 am

Post by lordzik »

apperrault wrote:Hi there, here is what my CDEF looks like:

Code: Select all

cdef=CURRENT_DATA_SOURCE,CURRENT_DS_MAXIMUM_VALUE,/,100,*
I have also attached a screen shot of the actual page.

Thanks for the help

app
Isn't CURRENT_DS_MAXIMUM_VALUE the maximum SEEN value of this DS? I mean if your HDD has 40GB and at some point it had 35GB used, CURRENT_DS_MAXIMUM_VALUE would return 35GB (not 40GB)?
redphive
Posts: 9
Joined: Wed Jan 08, 2003 7:50 pm

Post by redphive »

Hi,

I have installed thold 0.3.2 and the plugin architecture and so far so good. The one thing I am having a problem with is the CDEFs. I don't know if I should or should not be able to use custom CDEFs or not.

Currently I have the following available:
Make Stack Negative
Make Per 5 Minutes
turn Bytes into Bits
Multiply by 1024
Diviser Par Dix

I have a total of 11 CDEFs in this installation.

Any advice?
luizmultirede
Posts: 14
Joined: Wed Jan 03, 2007 12:06 pm

Post by luizmultirede »

Hi Cigamit

Where I put the patch that you put above??

Regards
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

luizmultirede wrote:Hi Cigamit

Where I put the patch that you put above??

Regards
The patch is not necessary, it is already in the latest (and several versions back) of thold.
sukanta
Cacti User
Posts: 139
Joined: Tue Jan 26, 2010 6:12 am

Re: CDEFs not working

Post by sukanta »

Sorry to pulled up this old post..Still thold is not supporting CURRENT_DS_MAXIMUM_VALUE..Any idea??


0.4.2
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: CDEFs not working

Post by cigamit »

sukanta wrote:Sorry to pulled up this old post..Still thold is not supporting CURRENT_DS_MAXIMUM_VALUE..Any idea??


0.4.2
I will put that on my todo list for the next few revisions.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests