Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thold Current Value is incorrect in 1.8.1 #674

Open
JasonRaptor opened this issue Jun 4, 2024 · 21 comments
Open

Thold Current Value is incorrect in 1.8.1 #674

JasonRaptor opened this issue Jun 4, 2024 · 21 comments
Labels
bug resolved Issue potentially resolved, person opening should close

Comments

@JasonRaptor
Copy link

Describe the bug
Thold Current Value is incorrect in 1.8.1

Hello Sir,

As I have upgraded from v0.8.8h to v1.2.27, and now the Thold Plugin is able to send alert email out, but the current value (Mbytes) can't match with the data showing in Graph (Mbits), even I made self calculation.

Cacti Version: v1.2.27
PHP 8.3.7
MySQL 5.7.43
Thold 1.8.1
NET-SNMP version: 5.5
cmd.php
Concurrent Processes Name: Main Poller, Procs: 40
Max Threads Name: Main Poller, Threads: 60
PHP Servers 10
Minimum Connections: Main Server: Current: 3000, Min Required: 2900

May I know if anyone can help to provide some solution for me ?

To Reproduce
Steps to reproduce the behavior:

  1. Click on "Thold" Plugin Page
  2. Select any Threshold record and click "Edit Threshold"
  3. The "traffic_in / traffic_out"'s Last value cannot match with the Graph (the current value (Mbytes) can't match with the data showing in Graph (Mbits), even I made self calculation)

Expected behavior
The "traffic_in / traffic_out"'s Last value should be match with the Graph

Screenshots
Thold Current Incorrect

Plugin (please complete the following information):

Server (please complete the following information):

  • OS: Microsoft Windows Server 2016 (64-bit) (Virtual Machine)
  • Virtual CPU = 60
  • Memory = 64GB

Additional context
Add any other context about the problem here.

@xmacan
Copy link
Member

xmacan commented Jun 4, 2024

It is from forums. User reported php error too:
2024-06-04 19:18:02 - CMDPHP PHP ERROR Backtrace: (D:\Inetpub\wwwroot\cacti\plugins\thold\poller_thold.php[99]:perform_thold_processes(), D:\Inetpub\wwwroot\cacti\plugins\thold\poller_thold.php[154]:thold_check_all_thresholds(), D:\Inetpub\wwwroot\cacti\plugins\thold\includes\polling.php[332]:thold_check_threshold(), D:\Inetpub\wwwroot\cacti\plugins\thold\thold_functions.php[2219]:get_thold_emails(), D:\Inetpub\wwwroot\cacti\plugins\thold\thold_functions.php[7596]:CactiErrorHandler())
2024-06-04 19:18:02 - ERROR PHP DEPRECATED: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in file: D:\Inetpub\wwwroot\cacti\plugins\thold\thold_functions.php on line: 7596
2024-06-04 19:18:02 - CMDPHP PHP ERROR Backtrace: (D:\Inetpub\wwwroot\cacti\plugins\thold\poller_thold.php[99]:perform_thold_processes(), D:\Inetpub\wwwroot\cacti\plugins\thold\poller_thold.php[154]:thold_check_all_thresholds(), D:\Inetpub\wwwroot\cacti\plugins\thold\includes\polling.php[332]:thold_check_threshold(), D:\Inetpub\wwwroot\cacti\plugins\thold\thold_functions.php[2219]:get_thold_emails(), D:\Inetpub\wwwroot\cacti\plugins\thold\thold_functions.php[7596]:CactiErrorHandler())
2024-06-04 19:18:02 - ERROR PHP DEPRECATED: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in file: D:\Inetpub\wwwroot\cacti\plugins\thold\thold_functions.php on line: 7596
2024-06-04 19:18:02 - CMDPHP PHP ERROR Backtrace: (D:\Inetpub\wwwroot\cacti\plugins\thold\poller_thold.php[99]:perform_thold_processes(), D:\Inetpub\wwwroot\cacti\plugins\thold\poller_thold.php[154]:thold_check_all_thresholds(), D:\Inetpub\wwwroot\cacti\plugins\thold\includes\polling.php[332]:thold_check_threshold(), D:\Inetpub\wwwroot\cacti\plugins\thold\thold_functions.php[2219]:get_thold_emails(), D:\Inetpub\wwwroot\cacti\plugins\thold\thold_functions.php[7596]:CactiErrorHandler())
2024-06-04 19:18:02 - ERROR PHP DEPRECATED: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in file: D:\Inetpub\wwwroot\cacti\plugins\thold\thold_functions.php on line: 7596
2024-06-04 19:18:02 - CMDPHP PHP ERROR Backtrace: (D:\Inetpub\wwwroot\cacti\plugins\thold\poller_thold.php[99]:perform_thold_processes(), D:\Inetpub\wwwroot\cacti\plugins\thold\poller_thold.php[154]:thold_check_all_thresholds(), D:\Inetpub\wwwroot\cacti\plugins\thold\includes\polling.php[332]:thold_check_threshold(), D:\Inetpub\wwwroot\cacti\plugins\thold\thold_functions.php[2219]:get_thold_emails(), D:\Inetpub\wwwroot\cacti\plugins\thold\thold_functions.php[7596]:CactiErrorHandler())
2024-06-04 19:18:02 - ERROR PHP DEPRECATED: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in file: D:\Inetpub\wwwroot\cacti\plugins\thold\thold_functions.php on line: 7596
2024-06-04 19:18:02 - CMDPHP PHP ERROR Backtrace: (D:\Inetpub\wwwroot\cacti\plugins\thold\poller_thold.php[99]:perform_thold_processes(), D:\Inetpub\wwwroot\cacti\plugins\thold\poller_thold.php[154]:thold_check_all_thresholds(), D:\Inetpub\wwwroot\cacti\plugins\thold\includes\polling.php[332]:thold_check_threshold(), D:\Inetpub\wwwroot\cacti\plugins\thold\thold_functions.php[2219]:get_thold_emails(), D:\Inetpub\wwwroot\cacti\plugins\thold\thold_functions.php[7596]:CactiErrorHandler())
2024-06-04 19:18:02 - ERROR PHP DEPRECATED: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in file: D:\Inetpub\wwwroot\cacti\plugins\thold\thold_functions.php on line: 7596
2024-06-04 19:18:02 - CMDPHP PHP ERROR Backtrace: (D:\Inetpub\wwwroot\cacti\plugins\thold\poller_thold.php[99]:perform_thold_processes(), D:\Inetpub\wwwroot\cacti\plugins\thold\poller_thold.php[154]:thold_check_all_thresholds(), D:\Inetpub\wwwroot\cacti\plugins\thold\includes\polling.php[332]:thold_check_threshold(), D:\Inetpub\wwwroot\cacti\plugins\thold\thold_functions.php[2219]:get_thold_emails(), D:\Inetpub\wwwroot\cacti\plugins\thold\thold_functions.php[7596]:CactiErrorHandler())
2024-06-04 19:18:02 - ERROR PHP DEPRECATED: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in file: D:\Inetpub\wwwroot\cacti\plugins\thold\thold_functions.php on line: 7596

Problem is int thold_functions.php on line 7593-7596. Notify_warning_extra can be null. So strlen(null) causes this.

@TheWitness why we have diferent settings for notify_warning_extra and notify_extra (first can be null, second not)?

TheWitness added a commit that referenced this issue Jun 6, 2024
@TheWitness TheWitness added bug resolved Issue potentially resolved, person opening should close labels Jun 6, 2024
@TheWitness
Copy link
Member

This is fixed now, you may grab a fresh copy of thold_functions.php and report back.

@JasonRaptor
Copy link
Author

Thank you @TheWitness , let me have a try on it :)

@JasonRaptor
Copy link
Author

@TheWitness I just tried to stop the Apache, renamed the old php as "thold_functions.php", and place the new php file in there, and start the Apache. But the Cacti Plugin page is being with this error as below.

Sorry, we could not process your last action.
Error: 500 plugin_thold/thold_functions.php at develop · Cacti/plugin_thold
Reason: We read every piece of feedback, and take your input very seriously.

@TheWitness
Copy link
Member

That sounds more like a configuration issue than anything else. Run the following on the file:

php -l -d display_errors=on thold_functions.php

If that does not work, restart the Apache service.

@JasonRaptor
Copy link
Author

@TheWitness I discover that the new "thold_functions.php" is being with different ROWs, may need to upload again

@TheWitness
Copy link
Member

This is the only change. There are not many different rows.

image

You may have a line ending issue with the file. Edit it and make sure you actually have the right file.

@JasonRaptor
Copy link
Author

I have made use of my original php file, and modified with the code, and now it is able to access now.

And now the Current Data should be able to match with the Graph Data, but there is slightly different, is that normal? Is it related to different polling time ?

Thold Current

@JasonRaptor
Copy link
Author

JasonRaptor commented Jun 6, 2024

Hello @TheWitness ,

Thanks for your help. And now the Threshold Status cannot be updated, even the current value is being dropped, it still keep in triggered status as below.

Thold Status Freeze

And also failed to trigger alert when I modified with a super small threshold, and there is no email alert as well.

Failed to trigger

And the below is the current Cacti Log.
11_05PM Log

Thanks a lot for your help.

@bmfmancini
Copy link
Member

@JasonRaptor when you moved the new thold_functions.php file over did you set the same permissions ?
The Thold plugin its self would crash but not deny you access to the main cacti UI so that's strange

@JasonRaptor
Copy link
Author

Hello @bmfmancini I have replaced the coding in the original file, and I can confirm with the same permission as before. But now being with another issue that I mentioned.

Thank you.

@JasonRaptor
Copy link
Author

JasonRaptor commented Jun 7, 2024

Hello,

I have reapply the "thold_functions.php" again, and reboot the server. Now the situation is same as before. The current value that cannot be matched with the Graph as below, but the alert email trigger is normal as previous.

Below is the same Interface on One Network Device
Wrong Threshold Current

And the below is the Cacti Log
12_15PM Log

Thank you.

@JasonRaptor
Copy link
Author

Hello @TheWitness ,

May I know if you can help to provide some solution for me, please?

Thank you.

@TheWitness
Copy link
Member

TheWitness commented Jun 20, 2024

So even though you're plotting bits per second you have to enter the data as it appears in the rrdfile which is in bytes per second. So if you reduce your value to bytes per second I think it should work correctly. Let me know if that works out.

@JasonRaptor
Copy link
Author

Hello @TheWitness ,

Thanks for your follow up with my case. Please take a look at below for my case.

For Example: The Link Bandwidth ==> 3Gbit
Threshold Setting ==> 3Gbit (90%) = 2700 Megabits (Mb)

Convert Mb to B >
2700 Megabits (Mb) = 337500000 Bytes (B)

Then I have the below Setting in Thold

Warning - High / Low Settings
High Threshold = 'I leave it blank'
Low Threshold = 'I leave it blank'
Breach Duration = 5 mins

Alert - High / Low Settings
High Threshold = 337500000
Low Threshold = 300000000
Breach Duration = 15 mins

Then Press "Save" Button

After that, I can see the amount I entered, it changed to below automatically
Alert - High / Low Settings
High Threshold = 337.5M
Low Threshold = 300M
Breach Duration = 15 mins

After few times polling (~15 mins), and I check with the current graph data

Graph:
Inbound (Current) = 1.43 Gbit
Outbound (Current) = 16.61 Mbit

Thold (Traffic_in) (Last: 304.03346 M)
Thold (Traffic_out) (Last: 3.595518 M)

Thank you.

@TheWitness
Copy link
Member

Upload a screenshot of the Threshold > Edit page. Redact anything private.

@JasonRaptor
Copy link
Author

Hello @TheWitness

Thanks for that. Please take a look at the below PrintScreen for your reference. Thank you.

Screenshot001

Screenshot002

Screenshot003

@TheWitness
Copy link
Member

Okay. I'll have to find some time. I'm working on some things for 1.8.2. Maybe by the end of next week I can have this one pinned down.

@JasonRaptor
Copy link
Author

Okay. I'll have to find some time. I'm working on some things for 1.8.2. Maybe by the end of next week I can have this one pinned down.

Thanks a lot @TheWitness

@JasonRaptor
Copy link
Author

JasonRaptor commented Jun 26, 2024

Here is the Latest ScreenShot after being using with the Latest THOLD in Github.

Snipaste_2024-06-26_14-26-40
Snipaste_2024-06-26_14-28-24

And seem that the Data Polling Time for the "THOLD's Current Value" and "Graph Value" is not at the same Time.

@JasonRaptor
Copy link
Author

During the time I edit the "High Threshold" value, I can see the below Cacti Log.

2024-06-26 19:51:31 - CMDPHP PHP ERROR WARNING Backtrace: (D:\Inetpub\wwwroot\cacti\plugins\thold\thold.php[144]:thold_edit(), D:\Inetpub\wwwroot\cacti\plugins\thold\thold.php[2266]:draw_edit_form(), D:\Inetpub\wwwroot\cacti\lib\html_form.php[57]:CactiErrorHandler())
2024-06-26 19:51:31 - ERROR PHP WARNING: Undefined array key "default" in file: D:\Inetpub\wwwroot\cacti\lib\html_form.php on line: 57
2024-06-26 19:51:31 - CMDPHP form_edit Backtrace: (D:\Inetpub\wwwroot\cacti\plugins\thold\thold.php[144]:thold_edit(), D:\Inetpub\wwwroot\cacti\plugins\thold\thold.php[2266]:draw_edit_form(), D:\Inetpub\wwwroot\cacti\lib\html_form.php[56]:cacti_debug_backtrace())
2024-06-26 19:51:31 - CMDPHP WARNING: Cacti Form field 'syslog_settings' does not include a 'value' Column. Using default
2024-06-26 19:51:19 - CMDPHP PHP ERROR WARNING Backtrace: (D:\Inetpub\wwwroot\cacti\plugins\thold\thold.php[144]:thold_edit(), D:\Inetpub\wwwroot\cacti\plugins\thold\thold.php[2266]:draw_edit_form(), D:\Inetpub\wwwroot\cacti\lib\html_form.php[57]:CactiErrorHandler())
2024-06-26 19:51:19 - ERROR PHP WARNING: Undefined array key "default" in file: D:\Inetpub\wwwroot\cacti\lib\html_form.php on line: 57
2024-06-26 19:51:19 - CMDPHP form_edit Backtrace: (D:\Inetpub\wwwroot\cacti\plugins\thold\thold.php[144]:thold_edit(), D:\Inetpub\wwwroot\cacti\plugins\thold\thold.php[2266]:draw_edit_form(), D:\Inetpub\wwwroot\cacti\lib\html_form.php[56]:cacti_debug_backtrace())
2024-06-26 19:51:19 - CMDPHP WARNING: Cacti Form field 'syslog_settings' does not include a 'value' Column. Using default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug resolved Issue potentially resolved, person opening should close
Projects
None yet
Development

No branches or pull requests

4 participants