1f5a66f83SJayanth Othayoth#!/bin/bash 2f5a66f83SJayanth Othayoth# 36d7f753bSMarri Devender Rao# config: 1234 5 4f5a66f83SJayanth Othayoth# @brief: Collect Host state information. 5f5a66f83SJayanth Othayoth# 6f5a66f83SJayanth Othayoth 7f5a66f83SJayanth Othayoth. $DREPORT_INCLUDE/functions 8f5a66f83SJayanth Othayoth 9*7f3c97f7SAmithash Prasad# Discover all services managing host states 10*7f3c97f7SAmithash Prasadservices=$(busctl list | awk '{print $1}' | grep -E "xyz.openbmc_project.State.Host([0-9]*)?$") 11*7f3c97f7SAmithash Prasadfor service in ${services}; do 12*7f3c97f7SAmithash Prasad objpath=$(busctl tree --list $service | tail -n 1) 13*7f3c97f7SAmithash Prasad index=$(echo "$service" | grep -o '[0-9]*$') 14*7f3c97f7SAmithash Prasad if [ -z "$index" ]; then 15f5a66f83SJayanth Othayoth file_name="host-state.log" 16*7f3c97f7SAmithash Prasad desc="Host State" 17*7f3c97f7SAmithash Prasad else 18*7f3c97f7SAmithash Prasad file_name="host${index}-state.log" 19*7f3c97f7SAmithash Prasad desc="Host${index} State" 20*7f3c97f7SAmithash Prasad fi 21*7f3c97f7SAmithash Prasad command="busctl get-property ${service} ${objpath} \ 22*7f3c97f7SAmithash Prasad xyz.openbmc_project.State.Host CurrentHostState" 23f5a66f83SJayanth Othayoth add_cmd_output "$command" "$file_name" "$desc" 24*7f3c97f7SAmithash Prasaddone 25