Closed arno-st closed 7 months ago
This is likely not a bug. Check your Thold Device Down Subject and make sure that
Devices Error: <DESCRIPTION> (<HOSTNAME>) is DOWN
Well it' happen with an upgrade of the dev repo 2weeks ago, I didn't change myThold setting.
And I have this in the config:
Device Error: <DESCRIPTION> (<HOSTNAME>) is DOWN
And the message is only displaying that:
Device Error: (10.2.253.124) is DOWN
Missing the DESCRIPTION
and before the upgrade it was:
Device Error: se-ech-8502 (10.85.0.18) is DOWN
Include the DESCRIPTION in this case.
And the all email is empty: `System Error : (10.2.253.124) is Reason:
Average system response: 79.37 ms System availability: 92.82 % Total Checks Since Clear: 216433 Total Failed Checks: 15541 Last Date Checked DOWN : 2023-11-13 08:20:05 Device Previously UP for: 4m NOTES: Device NOTES: `
and the config is:
System Error : <DESCRIPTION> (<HOSTNAME>) is <DOWN/UP><br>Reason: <MESSAGE><br><br>Average system response: <AVG_TIME> ms<br>System availability: <AVAILABILITY><br>Total Checks Since Clear: <TOT_POLL><br>Total Failed Checks: <FAIL_POLL><br>Last Date Checked DOWN : <LAST_FAIL><br>Device Previously UP for: <DOWNTIME><br>NOTES: <NOTES><br>Device NOTES: <DNOTES>
So sorry but I don't see what is causing this issue on my side.
So I find the issue. On sept 19 you made a change for the fix str_replace null value deprecated (#620)
change made on line 7750 of thold_function.php (the cacti log is to help me find the issue)
`function thold_str_replace($search, $replace, $subject) { cacti_log("thold_str_replace: " .print_r($search, true), true, "thold"); cacti_log("thold_str_replace replace: " .print_r($replace, true), true, "thold"); cacti_log("thold_str_replace: " .print_r(($replace == 0), true), true, "thold");
if (empty($replace) || $replace == 0) {
$replace = '';
}
cacti_log("thold_str_replace end: " .print_r($replace, true), true, "thold"); return str_replace($search, $replace, $subject); }` and since then it dosen't work correctly.
And here is the output when a device is going down, the $host from polling.php is correct; but when I enter into thold_str_replace here is what I get:
`
13/11/2023 18:06:17 - thold thold_str_replace:
13/11/2023 18:06:17 - thold thold_str_replace replace: 10.85.0.6
13/11/2023 18:06:17 - thold thold_str_replace:
13/11/2023 18:06:17 - thold thold_str_replace end: 10.85.0.6
13/11/2023 18:06:17 - thold thold_str_replace:
13/11/2023 18:06:17 - thold thold_str_replace replace: se-test-ws-c3560cx-12pd-s
13/11/2023 18:06:17 - thold thold_str_replace: 1
13/11/2023 18:06:17 - thold thold_str_replace end:
`
Just for the 2 field needed for the $subject field.
The HOSTNAME is exchanged with the IP address of my device (you can see with this line:
thold thold_str_replace end: 10.85.0.6
But the DESCRIPTION is somehow screw up, and at the end it result is:
thold thold_str_replace end:
But when entering the function I find the right value:
thold thold_str_replace replace: se-test-ws-c3560cx-12pd-s
but the test
$replace == 0
is returning true so replace is change with this line
$replace = ''
I have other field that are screw up, like NOTES, all SNMP_*, MESSAGE, SITE, DOWN/UP
Did you follow me or I'm to inside my mind and not clear enough ? PS: Sorry put I can't the code inside the correct format!?!
So some news, It's happen on all thold message. Now I receive an alert about a power supply on a switch, the Alert message is suppose to give me the URL of the graph, but it's not! The email I got:
Device: sre-b30-130 (10.30.1.32)
URL: Link to Graph in Cacti
Message: ALERT:sre-b30-130 - Cisco Env - Switch 2 Power Supply 2 [SupplyState] went below Threshold of 500 m with 0
And the Thold message configuration:
An Alert has been issued that requires your attention. <br><br><strong>Device</strong>: <DESCRIPTION> (<HOSTNAME>)<br><strong>URL</strong>: <URL><br><strong>Message</strong>: <SUBJECT><br><br><GRAPH>
Why the link to the graph, is just showing a text, instead of the real link to the graph ?
And I think, as eplain in the previous post, that it still a bug!
You need to specify HTML Email on the Console > Configuration > Settings > Alert/Thresholds page.
No that's not the case.
it's really en relation with the change you made on september 19, sorry I try everything you propose, but the only way to make it work as it should be is changing the line I inform you 3 weeks ago, all other stuff is irrelevant.
And again I didn't change the format of my email, but the code change and then it's messy now ;)
Okay interesting. Can you propose a solution via a pull request? Also @xmacan can you look into this one?
ok, I will have a look on it.
@arno-st I think that you have PHP version < 8.0. Look here https://www.php.net/manual/en/types.comparisons.php PHP below 8.0: `<?php
$a = "Hi"; if ($a == 0) { echo "true"; } else { echo "false"; }` Here is true returned. Newer php returns false;
Ok, just to update. It's working fine, thanks
And yes I have PHP 7.4.33
Hello, I just upgrade my thold from the latest dev repo (as of today second of November).
And now when I receive a device down notification the header look like this:
Device Error: (10.85.0.18) is DOWN
And the email like that: ` System Error : (10.85.0.18) is Reason:
Average system response: 5.56 ms System availability: 99.04 % Total Checks Since Clear: 1949046 Total Failed Checks: 18802 Last Date Checked DOWN : 2023-11-02 12:44:09 Device Previously UP for: 4m NOTES: Device NOTES: `
Before it was like this:
Device Error: se-ech-8502 (10.85.0.18) is DOWN
And the email: System Error : se-ech-8502 (10.85.0.18) is DOWN Reason: SNMP not performed due to setting or ping result, ICMP: Ping timed out
Average system response: 5.56 ms System availability: 99.04 % Total Checks Since Clear: 1948881 Total Failed Checks: 18784 Last Date Checked DOWN : 2023-11-02 09:59:11 Device Previously UP for: 4m NOTES: EZV: En service Device NOTES:
The contend of the DOWN Subject or DOWN Messaged under Configuration 'Alert/Thold' hasen't change.
And I'ts the same from the Restoral message.
Cacti 1.2.25 Thold 1.8 (but since a while ;) )