| Jayanth Othayoth | f5a66f8 | 2017-10-15 05:38:29 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| Marri Devender Rao | 6d7f753 | 2018-12-04 09:10:02 -0600 | [diff] [blame] | 3 | # config: 1234 5 |
| Jayanth Othayoth | f5a66f8 | 2017-10-15 05:38:29 -0500 | [diff] [blame] | 4 | # @brief: Collect Host state information. |
| 5 | # |
| 6 | |
| 7 | . $DREPORT_INCLUDE/functions |
| 8 | |
| Amithash Prasad | 7f3c97f | 2025-10-01 12:42:30 -0700 | [diff] [blame] | 9 | # Discover all services managing host states |
| 10 | services=$(busctl list | awk '{print $1}' | grep -E "xyz.openbmc_project.State.Host([0-9]*)?$") |
| 11 | for service in ${services}; do |
| 12 | objpath=$(busctl tree --list $service | tail -n 1) |
| 13 | index=$(echo "$service" | grep -o '[0-9]*$') |
| 14 | if [ -z "$index" ]; then |
| 15 | file_name="host-state.log" |
| 16 | desc="Host State" |
| 17 | else |
| 18 | file_name="host${index}-state.log" |
| 19 | desc="Host${index} State" |
| 20 | fi |
| 21 | command="busctl get-property ${service} ${objpath} \ |
| 22 | xyz.openbmc_project.State.Host CurrentHostState" |
| 23 | add_cmd_output "$command" "$file_name" "$desc" |
| 24 | done |