Skip to content

Conversation

@gordon-nexthop
Copy link

@gordon-nexthop gordon-nexthop commented Nov 25, 2025

What I did

Added ability to have output of show environment to be in json format for easier output parsing.

How I did it

show environment is just a wrapper to sensors. The sensors utility has an option -j such that the ouput is printed in json format. So added a -j, —json option on wrapper function.

How to verify it

admin@gold111:~$ show env -j | head
{
   "tmp451-i2c-96-4c":{
      "Adapter": "i2c-22-mux (chan_id 1)",
      "temp1":{
         "temp1_input": 26.687,
         "temp1_max": 85.000,
         "temp1_min": 0.000,
         "temp1_crit": 85.000,
         "temp1_crit_hyst": 75.000,
         "temp1_max_alarm": 0.000,
admin@gold111:~$

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)

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@gordon-nexthop gordon-nexthop changed the title Provide option for show environment to have json formatted output Improve show environment to have json formatted output option Nov 25, 2025
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@gordon-nexthop gordon-nexthop force-pushed the gordon-nexthop.show_env_json_output branch from a67188a to 413bc85 Compare November 25, 2025 17:11
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@gordon-nexthop gordon-nexthop marked this pull request as ready for review November 25, 2025 20:00
@gordon-nexthop gordon-nexthop force-pushed the gordon-nexthop.show_env_json_output branch from 413bc85 to 96f3f2b Compare November 25, 2025 21:20
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
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