1#!/bin/bash 2# 3# config: 1234 5 4# @brief: Collect Host state information. 5# 6 7. $DREPORT_INCLUDE/functions 8 9# 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 25