blob: 7885f55617ca9eba7fcc7f3723284fe151c7bca5 [file] [log] [blame]
Jayanth Othayothf5a66f82017-10-15 05:38:29 -05001#!/bin/bash
2#
Marri Devender Rao6d7f7532018-12-04 09:10:02 -06003# config: 1234 5
Jayanth Othayothf5a66f82017-10-15 05:38:29 -05004# @brief: Collect Host state information.
5#
6
7. $DREPORT_INCLUDE/functions
8
Amithash Prasad7f3c97f2025-10-01 12:42:30 -07009# Discover all services managing host states
10services=$(busctl list | awk '{print $1}' | grep -E "xyz.openbmc_project.State.Host([0-9]*)?$")
11for 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"
24done