blob: 5199713935bdfac496e5b7f987f8d7b6ab1bd8c3 [file] [log] [blame]
Jayanth Othayothf8f6d552017-10-15 05:34:37 -05001#!/bin/bash
2#
Marri Devender Rao6d7f7532018-12-04 09:10:02 -06003# config: 1234 5
Jayanth Othayothf8f6d552017-10-15 05:34:37 -05004# @brief: Collect Chassis state information.
5#
6
7. $DREPORT_INCLUDE/functions
8
Amithash Prasad734c41e2025-10-02 14:50:25 -07009services=$(busctl list | awk '{print $1}' | grep -E "xyz.openbmc_project.State.Chassis([0-9]*)?$")
10for service in ${services}; do
11 objpath=$(busctl tree --list $service | tail -n 1)
12 index=$(echo "$service" | grep -o '[0-9]*$')
13 if [ -z "$index" ]; then
14 file_name="chassis-state.log"
15 desc="Chassis State"
16 else
17 file_name="chassis${index}-state.log"
18 desc="Chassis${index} State"
19 fi
20 command="busctl get-property ${service} ${objpath} \
21 xyz.openbmc_project.State.Chassis CurrentPowerState"
22 add_cmd_output "$command" "$file_name" "$desc"
23done