THOLD 1.4

Support questions about the Threshold plugin

Moderators: Developers, Moderators

Lalbee99
Cacti User
Posts: 135
Joined: Mon Mar 03, 2008 2:07 pm

THOLD 1.4

Post by Lalbee99 »

What happened in THOLD 1.4! On the thresholds tab prior to upgrade from 1.2.4 thresholds for filesystems showed easy to read utilization percentages. Since the upgrade it appears to attempt to show utilization in K,M. This is not making my operators happy at all. Any ideas how to correct this?
bmfmancini
Cacti User
Posts: 248
Joined: Wed Mar 13, 2019 3:37 pm
Location: toronto
Contact:

Re: THOLD 1.4

Post by bmfmancini »

can you post examples pls ? screenshot of how its being read
also a look at the graph and data source would be helpful

Which version of Cacti ?
windows or Linux deployment ?
Telecom Lifer, Monitoring and performance enthusiast, Father, Husband

Cacti Bug Hunter and Member

www.seanmancini.com
sean(at)seanmancini.com
github.com/bmfmancini

My Cacti scripts and templates ( Non official)
Cacti install wizard https://github.com/bmfmancini/cacti-install-wizard
Cacti templates https://github.com/bmfmancini/Cacti-templates

Always willing to help!
Lalbee99
Cacti User
Posts: 135
Joined: Mon Mar 03, 2008 2:07 pm

Re: THOLD 1.4

Post by Lalbee99 »

I am running Cacti version 1.2.7 . This is on a RHEL 7 server.


Thold_124.jpg
Thold_124.jpg (346.23 KiB) Viewed 6758 times
thold_14.jpg
thold_14.jpg (372.73 KiB) Viewed 6758 times
graph.jpg
graph.jpg (480.91 KiB) Viewed 6758 times
datasource.jpg
datasource.jpg (415.51 KiB) Viewed 6758 times
cigamit
Developer
Posts: 3350
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: THOLD 1.4

Post by cigamit »

Post what one of the thresholds looks like, seems like you are missing the Data Manipulation settings.
tholdpercent.png
tholdpercent.png (7.71 KiB) Viewed 6752 times
Lalbee99
Cacti User
Posts: 135
Joined: Mon Mar 03, 2008 2:07 pm

Re: THOLD 1.4

Post by Lalbee99 »

data_manipulation.jpg
data_manipulation.jpg (406.28 KiB) Viewed 6744 times
Lalbee99
Cacti User
Posts: 135
Joined: Mon Mar 03, 2008 2:07 pm

Re: THOLD 1.4

Post by Lalbee99 »

No ideas why this happens with an upgrade to 1.4 of thresholds.
cigamit
Developer
Posts: 3350
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: THOLD 1.4

Post by cigamit »

I don't have the issue, but I am running the latest git verison of thold.

You can try this.

open thold_functions.php
find this function

Code: Select all

function thold_format_number($value, $digits = 2, $baseu = 1024, $show_suffix = true) {
	$units = '';
	$suffix = '';

	if ($baseu == 1024 && $show_suffix) {
		$suffix = 'i';
	}

	if (!is_numeric($value)) {
		return '-';
	}

	if ($value == '0') {
		return '0';
	}

and after that portion (there is more code in the function below that)
add this line

Code: Select all

	return number_format_i18n($value, $digits, $baseu);
that will make it return formatted data without the unit descriptors.
Lalbee99
Cacti User
Posts: 135
Joined: Mon Mar 03, 2008 2:07 pm

Re: THOLD 1.4

Post by Lalbee99 »

Same result. I even took the development version and installed and still the same. When the php upgrade script runs it generates the following errors
2020/08/10 13:39:50 - ERROR PHP NOTICE in Plugin 'thold': Undefined index: name in file: /cacti/cacti/plugins/thold/includes/database.php on line: 1285
2020/08/10 13:39:50 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/thold/extras/upgrade.php[32]:thold_upgrade_database(), /plugins/thold/includes/database.php[1285]:CactiErrorHandler())
2020/08/10 13:39:50 - ERROR PHP NOTICE in Plugin 'thold': Undefined index: id in file: /cacti/cacti/plugins/thold/includes/database.php on line: 1285
2020/08/10 13:39:50 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/thold/extras/upgrade.php[32]:thold_upgrade_database(), /plugins/thold/includes/database.php[1285]:CactiErrorHandler())
2020/08/10 13:39:50 - THOLD WARNING: Threshold Template with Name and ID 0 Aligns with no matching Data Template
2020/08/10 15:29:49 - ERROR PHP NOTICE in Plugin 'thold': Undefined index: name in file: /cacti/cacti/plugins/thold/includes/database.php on line: 1285
2020/08/10 15:29:49 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/thold/extras/upgrade.php[32]:thold_upgrade_database(), /plugins/thold/includes/database.php[1285]:CactiErrorHandler())
2020/08/10 15:29:49 - ERROR PHP NOTICE in Plugin 'thold': Undefined index: id in file: /cacti/cacti/plugins/thold/includes/database.php on line: 1285
2020/08/10 15:29:49 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/thold/extras/upgrade.php[32]:thold_upgrade_database(), /plugins/thold/includes/database.php[1285]:CactiErrorHandler())
2020/08/10 15:29:49 - THOLD WARNING: Threshold Template with Name and ID 0 Aligns with no matching Data Template
cigamit
Developer
Posts: 3350
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: THOLD 1.4

Post by cigamit »

That just appears to be an issue with a thold template that isn't assigned a datasource. If you make the above change to the devel version, does it fix the display issue for you?
Lalbee99
Cacti User
Posts: 135
Joined: Mon Mar 03, 2008 2:07 pm

Re: THOLD 1.4

Post by Lalbee99 »

I spun up a new RHEL 7 vm and installed the latest version of cacti (Version 1.2.14) and installed the development branch of THOLD from github. I made the change you requested above. I imported the filesystem template from my production cacti server (which works correctly). I then configured a client to monitor filesystems with thresholds and I still don't see utilization %, I see utilization in data units (K,M,G)
Lalbee99
Cacti User
Posts: 135
Joined: Mon Mar 03, 2008 2:07 pm

Re: THOLD 1.4

Post by Lalbee99 »

The problem with this plugin is the following code: This is what is changing my utilization values in THOLD to the metric units listed below. Is there a reason for this change?

function thold_format_number($value, $digits = 2, $baseu = 1024, $show_suffix = true) {
$units = '';
$suffix = '';

if ($baseu == 1024 && $show_suffix) {
$suffix = 'i';
}

if (!is_numeric($value)) {
return '-';
}

if ($value == '0') {
return '0';
}

return number_format_i18n($value, $digits, $baseu);

if (abs($value) < 1) {
$units = ' m';
$value *= $baseu;

if (abs($value) < 1) {
$units = ' &#181;';
$value *= $baseu;
} else {
return number_format_i18n($value, $digits, $baseu) . $units . $suffix;
}

if (abs($value) < 1) {
$units = ' n';
$value *= $baseu;
} else {
return number_format_i18n($value, $digits, $baseu) . $units . $suffix;
}

if (abs($value) < 1) {
$units = ' p';
$value *= $baseu;
} else {
return number_format_i18n($value, $digits, $baseu) . $units . $suffix;
}
} else {
if (abs($value) >= $baseu) {
$units = ' K';
$value /= $baseu;
} else {
return number_format_i18n($value, $digits, $baseu) . $units . $suffix;
}

if (abs($value) >= $baseu) {
$units = ' M';
$value /= $baseu;
} else {
return number_format_i18n($value, $digits, $baseu) . $units . $suffix;
}

if (abs($value) >= $baseu) {
$units = ' G';
$value /= $baseu;
} else {
return number_format_i18n($value, $digits, $baseu) . $units . $suffix;
}

if (abs($value) >= $baseu) {
$units = ' T';
$value /= $baseu;
Lalbee99
Cacti User
Posts: 135
Joined: Mon Mar 03, 2008 2:07 pm

Re: THOLD 1.4

Post by Lalbee99 »

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

Re: THOLD 1.4

Post by cigamit »

That's the exact piece of code I told you to change above..........
Lalbee99
Cacti User
Posts: 135
Joined: Mon Mar 03, 2008 2:07 pm

Re: THOLD 1.4

Post by Lalbee99 »

I did and it did not change a thing. What was the purpose of adding this code. It drastically changes the users interpretation of the THOLD gui value. In the older thold versions if you choose within the thold template a percentage of another value it would display as a %. Now with the new thold it is going to get what the percentage value is and display it in units instead of percentage. This will confuse operators/users.
cigamit
Developer
Posts: 3350
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: THOLD 1.4

Post by cigamit »

The point of that code was facilitate the display of very small numbers (such as 0.000045) or for very large numbers. If the above change isn't working for you, then your issues may be in another area and not that function.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests