-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdump_ipmi_commands.sh
More file actions
31 lines (28 loc) · 887 Bytes
/
Copy pathdump_ipmi_commands.sh
File metadata and controls
31 lines (28 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# Description: Dumps all ipmi commands from ironic conductor log, useful to troubleshoot ironic issue.
set -e -o pipefail
NODE=$1
IRONIC_LOG=/var/log/ironic/ironic-conductor.log
if [[ -z $NODE ]]; then
echo "Usage: $0 <node>"
exit 1
fi
get_node_driver_info()
{
NODE=$1
PROPERTY=$2
if [[ -z $NODE ]]; then
echo "Usage: $0 <node> <attr>"
echo "For example: $0 node-1"
echo " $0 node-1 ipmi_address"
exit 1
fi
NODE_INFO=$(openstack baremetal node show $NODE | awk -F '|' '/driver_info/{print $3}' | sed "s/u'/\"/g" | tr "'" '"')
if [[ -z $PROPERTY ]]; then
echo $NODE_INFO | jq
else
echo $NODE_INFO | jq ".ipmi_address" | tr -d '"'
fi
}
IPMI_ADDRESS=$(get_node_driver_info $NODE ipmi_address)
cat $IRONIC_LOG | grep ipmitool | grep $IPMI_ADDRESS | grep -o '".*"' | tr -d '"'