Skip to content

Commit

Permalink
Added server model printing at container startup
Browse files Browse the repository at this point in the history
  • Loading branch information
tigerblue77 committed Jan 28, 2024
1 parent 384b955 commit 6492980
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Dell_iDRAC_fan_controller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,23 @@ function gracefull_exit () {
exit 0
}

# Help debugging when people are posting their output
# /!\ This function only works when started in local mode /!\
function get_Dell_server_model () {
# Check that the Docker host IPMI device (the iDRAC) has been exposed to the Docker container
if [ ! -e "/dev/mem" ]; then
echo "/!\ Could not open device at /dev/mem, check that you added the device to your Docker container or stop using local mode. Exiting." >&2
exit 1
fi
apt-get install dmidecode -qq > /dev/null 2>&1

SERVER_MANUFACTURER=$(dmidecode -s system-manufacturer)
SERVER_MODEL=$(dmidecode -s system-product-name)

apt-get remove --purge dmidecode -qq > /dev/null
apt-get clean -qq
}

# Trap the signals for container exit and run gracefull_exit function
trap 'gracefull_exit' SIGQUIT SIGKILL SIGTERM

Expand All @@ -113,6 +130,9 @@ echo "iDRAC/IPMI host: $IDRAC_HOST"
# Check if the iDRAC host is set to 'local' or not then set the IDRAC_LOGIN_STRING accordingly
if [[ $IDRAC_HOST == "local" ]]
then
get_Dell_server_model
echo "Server model: $SERVER_MANUFACTURER $SERVER_MODEL"

# Check that the Docker host IPMI device (the iDRAC) has been exposed to the Docker container
if [ ! -e "/dev/ipmi0" ] && [ ! -e "/dev/ipmi/0" ] && [ ! -e "/dev/ipmidev/0" ]; then
echo "/!\ Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0, check that you added the device to your Docker container or stop using local mode. Exiting." >&2
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ docker run -d \
-e CPU_TEMPERATURE_THRESHOLD=<decimal temperature threshold> \
-e CHECK_INTERVAL=<seconds between each check> \
-e DISABLE_THIRD_PARTY_PCIE_CARD_DELL_DEFAULT_COOLING_RESPONSE=<true or false> \
--cap-add SYS_RAWIO \
--device=/dev/ipmi0:/dev/ipmi0:rw \
--device=/dev/mem:/dev/mem:ro \
tigerblue77/dell_idrac_fan_controller:latest
```

Expand Down Expand Up @@ -112,6 +114,8 @@ services:
Dell_iDRAC_fan_controller:
image: tigerblue77/dell_idrac_fan_controller:latest
container_name: Dell_iDRAC_fan_controller
cap_add:
- SYS_RAWIO # Required for dmidecode to work
restart: unless-stopped
environment:
- IDRAC_HOST=local
Expand All @@ -121,6 +125,7 @@ services:
- DISABLE_THIRD_PARTY_PCIE_CARD_DELL_DEFAULT_COOLING_RESPONSE=<true or false>
devices:
- /dev/ipmi0:/dev/ipmi0:rw
- /dev/mem:/dev/mem:rw # Required for dmidecode to work
```
2. to use with LAN iDRAC:
Expand Down

0 comments on commit 6492980

Please sign in to comment.