Skip to content

Json support for show platform temperature #3997

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

selldinesh
Copy link

What I did

Added json support for show platform temperature

How I did it

How to verify it

admin@sonic:~$ show platform temperature
Sensor Temperature High TH Low TH Crit High TH Crit Low TH Warning Timestamp


       CB_temp(0x4B)           29.5       80.0       N/A             N/A            N/A      False  20240923 00:32:07
     CPU_Core_0_temp           46.0       82.0       N/A           104.0            N/A      False  20240923 00:32:07
     CPU_Core_1_temp           46.0       82.0       N/A           104.0            N/A      False  20240923 00:32:07
     CPU_Core_2_temp           46.0       82.0       N/A           104.0            N/A      False  20240923 00:32:07
     CPU_Core_3_temp           45.0       82.0       N/A           104.0            N/A      False  20240923 00:32:07
    CPU_Package_temp           46.0       82.0       N/A           104.0            N/A      False  20240923 00:32:07
       FB_temp(0x4C)           35.0       80.0       N/A             N/A            N/A      False  20240923 00:32:07

MB_FrontMAC_temp(0x49) 28.5 80.0 N/A N/A N/A False 20240923 00:32:07
MB_LeftCenter_temp(0x4A) 28.0 80.0 N/A N/A N/A False 20240923 00:32:07
MB_RearMAC_temp(0x48) 30.5 80.0 N/A N/A N/A False 20240923 00:32:07
PSU-1 temp sensor 1 N/A N/A N/A N/A N/A False 20240923 00:32:07
PSU-2 temp sensor 1 37.0 80.0 N/A N/A N/A False 20240923 00:32:07
admin@sonic:~$ show platform temperature --help
Usage: show platform temperature [OPTIONS]

Show device temperature information

Options:
--json Output in JSON format
-h, -?, --help Show this message and exit.
admin@sonic:~$ show platform temperature --json
[
{
"Sensor": "CB_temp(0x4B)",
"Temperature": "29.5",
"High_TH": "80.0",
"Low_TH": "N/A",
"Crit_High_TH": "N/A",
"Crit_Low_TH": "N/A",
"Warning": "False",
"Timestamp": "20240923 00:32:07"
},
{
"Sensor": "CPU_Core_0_temp",
"Temperature": "46.0",
"High_TH": "82.0",
"Low_TH": "N/A",
"Crit_High_TH": "104.0",
"Crit_Low_TH": "N/A",
"Warning": "False",
"Timestamp": "20240923 00:32:07"
},
{
"Sensor": "CPU_Core_1_temp",
"Temperature": "46.0",
"High_TH": "82.0",
"Low_TH": "N/A",
"Crit_High_TH": "104.0",
"Crit_Low_TH": "N/A",
"Warning": "False",
"Timestamp": "20240923 00:32:07"
},
{
"Sensor": "CPU_Core_2_temp",
"Temperature": "46.0",
"High_TH": "82.0",
"Low_TH": "N/A",
"Crit_High_TH": "104.0",
"Crit_Low_TH": "N/A",
"Warning": "False",
"Timestamp": "20240923 00:32:07"
},
{
"Sensor": "CPU_Core_3_temp",
"Temperature": "45.0",
"High_TH": "82.0",
"Low_TH": "N/A",
"Crit_High_TH": "104.0",
"Crit_Low_TH": "N/A",
"Warning": "False",
"Timestamp": "20240923 00:32:07"
},
{
"Sensor": "CPU_Package_temp",
"Temperature": "46.0",
"High_TH": "82.0",
"Low_TH": "N/A",
"Crit_High_TH": "104.0",
"Crit_Low_TH": "N/A",
"Warning": "False",
"Timestamp": "20240923 00:32:07"
},
{
"Sensor": "FB_temp(0x4C)",
"Temperature": "35.0",
"High_TH": "80.0",
"Low_TH": "N/A",
"Crit_High_TH": "N/A",
"Crit_Low_TH": "N/A",
"Warning": "False",
"Timestamp": "20240923 00:32:07"
},
{
"Sensor": "MB_FrontMAC_temp(0x49)",
"Temperature": "28.5",
"High_TH": "80.0",
"Low_TH": "N/A",
"Crit_High_TH": "N/A",
"Crit_Low_TH": "N/A",
"Warning": "False",
"Timestamp": "20240923 00:32:07"
},
{
"Sensor": "MB_LeftCenter_temp(0x4A)",
"Temperature": "28.0",
"High_TH": "80.0",
"Low_TH": "N/A",
"Crit_High_TH": "N/A",
"Crit_Low_TH": "N/A",
"Warning": "False",
"Timestamp": "20240923 00:32:07"
},
{
"Sensor": "MB_RearMAC_temp(0x48)",
"Temperature": "30.5",
"High_TH": "80.0",
"Low_TH": "N/A",
"Crit_High_TH": "N/A",
"Crit_Low_TH": "N/A",
"Warning": "False",
"Timestamp": "20240923 00:32:07"
},
{
"Sensor": "PSU-1 temp sensor 1",
"Temperature": "N/A",
"High_TH": "N/A",
"Low_TH": "N/A",
"Crit_High_TH": "N/A",
"Crit_Low_TH": "N/A",
"Warning": "False",
"Timestamp": "20240923 00:32:07"
},
{
"Sensor": "PSU-2 temp sensor 1",
"Temperature": "37.0",
"High_TH": "80.0",
"Low_TH": "N/A",
"Crit_High_TH": "N/A",
"Crit_Low_TH": "N/A",
"Warning": "False",
"Timestamp": "20240923 00:32:07"
}
]

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

Copy link

linux-foundation-easycla bot commented Jul 23, 2025

CLA Missing ID CLA Not Signed

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants