Closed Alys closed 11 months ago
The latest thold development branch is under heavy redevelopment right now. In the new thold version which will be 2.0 there will be eight different baseline methods. There are a few people testing right now, if you would like to be one of them feel free to download and provide your feedback.
Thank you, that's good to know, but the current baseline method is doing what we want on the old version of cacti. Do you know why it's changed, or if there's any workaround? Or if it's easier for you, you could you please tell me which issue this was a duplicate of? I haven't be able to find one similar. Sorry for logging a duplicate though.
Just pick the version that works as expected.
Types
Aggregators
Methods
Don't ask for what used to work, cause it was inconsistent. Think of how you WANT it to work using this model.
I changed it a little this morning.
[Originally posted on the cacti forum.]
Describe the bug The thold plugin converts available swap memory from a positive to a negative value, resulting in incorrect and unnecessary alerts (e.g., sending an email to say that available swap memory -4,116,960 is below calculated baseline threshold -3,293,567.73). This isn't caused by PHP's time zone being wrong.
To Reproduce Steps to reproduce the behavior:
Expected behavior Available swap memory is reported as a positive number instead of a negative number.
Screenshots See below.
Plugin (please complete the following information):
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
We have two cacti servers, both monitoring the same devices with the same settings. Each does its own polling and has its own database. Only one has this problem. Both servers are x86_64, RHEL 7.9.
One of the servers is running cacti version 0.8.8f and thold plugin version 0.5. It's behaving correctly. I'll refer to it below as "the old cacti server".
The other cacti server ("the new cacti server") used to be running those versions but we recently upgraded it to version 1.2.24, and the thold plugin to 1.5.2. Everything seems to be working correctly except that thold is converting the value for available swap memory (ucd_memAvailSwap) from positive to negative. It's doing this for all devices where ucd_memAvailSwap is monitored. It was not doing this before we upgraded it, and thold on the old server is not doing this.
For example, for one device, the current available swap memory is 4,116,960 as shown by
free
:The graph for that device correctly states that the current free swap memory is 4.12 M (on both old and new cacti servers).
On the old cacti server, in the "thold" tab, the data for that device shows that the current value is "4116960" - i.e., it's correct.
However on the new cacti server, in the "Thold" tab, the data for that device is "-4,116,960" - i.e., the right value but negative.
Here's the
thold_template
settings for theucd_memAvailSwap
template:I've seen forum posts about negative values where the solution was to fix PHP's time zone, but I believe that's not relevant to this case. The timezone is correct in the new cacti server's php.ini file as shown below, and the same time zone is in php.ini on the old cacti server.
In case it helps, below is some data for the device that I used in the example above, taken from the database on the new cacti server. The data seems to be the same on the old cacti server, at least where similar database fields exist.
I've managed to work out that thold on the new cacti server is multiplying the value by -1 in the code below, from thold's thold_functions.php file:
Below are sample values for the $v2, $v1, and $cdef_array variables when $cursor is 2, and the value of
$result
:So the calculations done by the thold_rpn function is working as intended (
4116960 * -1
) but I don't understand why that code is being run, or why a similar calculation isn't being done on the old cacti server.