root@sonic:/home/cisco# show platform temperature Sensor Temperature High TH Low TH Crit High TH Crit Low TH Warning Timestamp ----------------------- ------------- --------- -------- -------------- ------------- --------- ----------------- ..... MB_PORT_Sensor 21.375 120.0 -5.0 125.0 -10.0 False 20240116 21:16:16 MB_TMP421_Local 121.0 120.0 -5.0 125.0 -10.0 True 20240116 21:16:16 MB_VDDS_VDDA_TEMP_L1 52.0 125.0 -5.0 135.0 -10.0 False 20240116 21:16:16 ..... def _refresh_temperature_status(self, parent_name, thermal, thermal_index): ..... warning = False if temperature != NOT_AVAILABLE and temperature_status.set_over_temperature(temperature, high_threshold): self._log_on_status_changed(not temperature_status.over_temperature, 'High temperature warning cleared: {} temperature restored to {}C, high threshold {}C'. format(name, temperature, high_threshold), 'High temperature warning: {} current temperature {}C, high threshold {}C'. format(name, temperature, high_threshold) ) if temperature_status.over_temperature: # Formulate event for this fault: board temp sensor exceeded temp high threshold self.log_warning('Temp FAULT occured!') test_source = "sonic-event" test_event_tag = "EVENT" test_event_key = "{}:{}".format(test_source, test_event_tag) test_event_params = { "id": "10", "resource": "thermalctld", "text": "sonic-event yang: thermal variation test", "time-created": "Dec202023", "type-id": "TEMPERATURE_EXCEEDED", "severity": "CRITICAL", } # Get event handle and publish this thermal fault as and event evt_hdl = events_init_publisher(test_source) if evt_hdl: self.log_info('Got the fault event publisher handle:{}'.format(evt_hdl)) # Sleep ASYNC_CONN_WAIT to ensure async connectivity is complete. # Messages published before connection are silently dropped by ZMQ. time.sleep(0.3) pub_params = FieldValueMap() evt_params = dict(test_event_params) for k,v in evt_params.items(): pub_params[k] = v rc = event_publish(evt_hdl, test_event_tag, pub_params) if (rc != 0): self.log_warning('Failed to publish event! rc:{}'.format(rc)) else: self.log_info('Successfully published event rc:{}'.format(rc)) else: self.log_warning('Failed to get fault event publisher handle:{}'.format(evt_hdl)) else: self.log_warning('Temp WITHIN RANGE') warning = warning | temperature_status.over_temperature ......