Ugly way of calculating % for threshold

Support questions about the Threshold plugin

Moderators: Developers, Moderators

lordzik
Posts: 11
Joined: Wed Jan 24, 2007 4:15 am

Ugly way of calculating % for threshold

Post by lordzik »

Hi,
i wanted to make a threshold based on % of used disk space (i saw few suggestions about this but none of them worked for me). However, i was able to do it after little modifications of cacti and threshold plugin
I'm polling disk total capacity and present usage using standard template Host MIB - Available Disk Space (screen01)

Step 1: I created new CDEF (screen02)
cdef=CURRENT_DATA_SOURCE,100,*,VALUE_OF_HDD_TOTAL,/

To get 'VALUE_OF_HDD_TOTAL' please add one line to file include/config_arrays.php

Code: Select all

$custom_data_source_types = array(
        "CURRENT_DATA_SOURCE" => "Current Graph Item Data Source",
        "ALL_DATA_SOURCES_NODUPS" => "All Data Sources (Don't Include Duplicates)",
        "ALL_DATA_SOURCES_DUPS" => "All Data Sources (Include Duplicates)",
        "CURRENT_DS_MINIMUM_VALUE" => "Current Data Source Item: Minimum Value",
        "SIMILAR_DATA_SOURCES_NODUPS" => "All Similar Data Sources (Don't Include Duplicates)",
        "CURRENT_DS_MAXIMUM_VALUE" => "Current Data Source Item: Maximum Value",
        "CURRENT_GRAPH_MINIMUM_VALUE" => "Graph: Lower Limit",
        "CURRENT_GRAPH_MAXIMUM_VALUE" => "Graph: Upper Limit",
        "VALUE_OF_HDD_TOTAL" => "Value of hdd_total data source");
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ add this line
Step 2: After adding new CDEF, one more modification to file plugins/thold/thold-functions.php is needed:

Code: Select all

                              switch ($cdef['value']) {
                               case 'CURRENT_DATA_SOURCE':
                                  $cdef['value'] = $oldvalue; // get_current_value($rra, $ds, 0);
                                  break;
                               case 'VALUE_OF_HDD_TOTAL':
                                  $cdef['value'] = get_current_value($rra, 'hdd_total', 0);
                                  break;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ add 3 last lines

Step 3: After that, i created threshold template for data field "hdd_used " (screen03)

Step 4: At the bottom, select CDEF you created in step 1 ("Threshold CDEF Apply this CDEF before returning the data"). Save and wait 2 polling cycles. After that you should see current value in %! (screen04)

Forgive me my poor english.
Attachments
screen04.GIF
screen04.GIF (42.11 KiB) Viewed 22966 times
screen03.GIF
screen03.GIF (8.37 KiB) Viewed 22966 times
screen02.GIF
screen02.GIF (8.68 KiB) Viewed 22966 times
screen01.GIF
screen01.GIF (30.82 KiB) Viewed 22966 times
damien
Posts: 4
Joined: Tue Jan 03, 2006 6:01 am

Post by damien »

Thanks lordzik, ugly way but it work fine :)
marcmo
Posts: 27
Joined: Wed Sep 21, 2005 3:39 pm

Post by marcmo »

Worked for me as well. Thanks!
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

Works a treat for me as well - not that ugly...
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
apperrault
Cacti User
Posts: 379
Joined: Fri Feb 16, 2007 11:37 am
Location: Emeryville, CA
Contact:

Post by apperrault »

That worked like a charm.

Thanks for the tip. Now i can really use THold

thanks

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]
tonzy0907
Posts: 19
Joined: Wed May 30, 2007 6:16 am

Thanku

Post by tonzy0907 »

Thank u so much
apperrault
Cacti User
Posts: 379
Joined: Fri Feb 16, 2007 11:37 am
Location: Emeryville, CA
Contact:

Post by apperrault »

Apparently this CDEF no longer works with the new version of THold. Does anyone have any other ways of doing this?

Please help

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]
marcmo
Posts: 27
Joined: Wed Sep 21, 2005 3:39 pm

Post by marcmo »

It works -- you just have to patch thold-functions.php again. As I recall this is the only change I had to make once I installed the new plugin:

[root@augustus thold]# diff thold-functions.php thold-functions.php.DIST
301,303d300
< case 'VALUE_OF_HDD_TOTAL':
< $cdef['value'] = get_current_value($rra, 'hdd_total', 0);
< break;

marcmo
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

App - it does work - I am using it now...
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
apperrault
Cacti User
Posts: 379
Joined: Fri Feb 16, 2007 11:37 am
Location: Emeryville, CA
Contact:

Post by apperrault »

OK, I will re-install the non-SVN version and see if i can get it to work.

Are you running the version from the cactiusers.org page?

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]
apperrault
Cacti User
Posts: 379
Joined: Fri Feb 16, 2007 11:37 am
Location: Emeryville, CA
Contact:

Post by apperrault »

I have another question. How do i do that diff that is posted above? I tried typing what is listed there, and it says diff is not a recognized program.

If you could help, or post your thold-functions.php, that would be great.

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]
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

App - I just went over the guide in this post again to make the changes to the latest version. However, here's the file you need:
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
apperrault
Cacti User
Posts: 379
Joined: Fri Feb 16, 2007 11:37 am
Location: Emeryville, CA
Contact:

Post by apperrault »

Hey MCutting. Thanks for posting this. I forgot to post back on Friday. I went through and looked at the previous posts, and I determined what i needed to do, and I got everything to work.

All is running smoothly now!!

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]
redcap
Posts: 18
Joined: Mon Jan 23, 2006 5:49 am

Post by redcap »

I don't seem to be able to choose Threshold templates in the left menu bar, although this plugin is installed.

Any clue?
Thanks
using 0.8.6j debian
looc
Cacti User
Posts: 110
Joined: Mon Aug 13, 2007 3:40 am

Post by looc »

that's a well way~
it can create calculating % thold for windows drive,because windows drive(Host MIB-hard drive space)have hdd_total&hdd_userd
but
liunx(ucd/net -hard drive space) hasn't hdd_total,it has hdd_free&hdd_used
how can run it to linux disk calculaing?
Cacti Version - 0.8.7 & spine
Plugin Architecture - 1.3
Server Info - Windows 2003 EP
Web Server -IIS6.0
PHP - 5.2.3
MySQL - 4.1.10
RRDTool - 1.2.15
SNMP - 5.4.1
--------------------------
plugins:
reportit 0.5.1|monitor 0.8.1|thold 0.3.8
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest