sonic-net / sonic-platform-daemons

Platform module daemons for SONiC
Other
25 stars 159 forks source link

[PMON][psud] Fix the repeated NOTICE log message on Chassis platform #529

Closed mlok-nokia closed 2 months ago

mlok-nokia commented 3 months ago

Description

In psud script, first_run is always true in PsuChassisInfo class. This causes the method update_master_status() always set the psu status_master_led and log the status change messages although the status is not changed. The same NOTICE message is repeated and never stop. Address this issue, added code to set the first_run to False after the first run. This initializes set_led to False before the calculation. So that it won't be True to trigger the set_status_maste_led() and log the same message while the status has NO change.

Motivation and Context

This PR fixes https://github.com/sonic-net/sonic-buildimage/issues/19780 and not set the LED to the same state or log the same message when there is NO change.

How Has This Been Tested?

Checking the syslog on the SUP. The following message will not be repeated if the status is not changed

pmon#psud: PSU supplied power warning cleared: supplied power is back to norma

Additional Information (Optional)

mlok-nokia commented 3 months ago

Change LGTM. Could you paste a syslog comparison before and after your change?

The context of log message is not changed. This PR is to stop logging the same message periodically when the Pusd Master Status is not changed. On the stablized system, we found that the same message is repeated thousand times (see below message). Also, the Pusd.set_status_master_led() has been trigged repeadedly to call the platform specified code to set the Master Led although the Status is not changed. 2024 Aug 2 03:33:14.778967 ixre-cpm-chassis11 NOTICE pmon#psud: message repeated 4420 times: [ PSU supplied power warning cleared: supplied power is back to normal.

mlok-nokia commented 2 months ago

@prgeor @judyjoseph Please cherry-pick this PR to 202405 branch

mssonicbld commented 3 days ago

Cherry-pick PR to 202405: https://github.com/sonic-net/sonic-platform-daemons/pull/561