diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn2010-r0/psu_sensors.json new file mode 120000 index 0000000000000..5816694317d6a --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn2010-r0/psu_sensors_conf_updater new file mode 120000 index 0000000000000..b9686d838e0f5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn2100-r0/psu_sensors.json new file mode 120000 index 0000000000000..5816694317d6a --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn2100-r0/psu_sensors_conf_updater new file mode 120000 index 0000000000000..b9686d838e0f5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn2410-r0/psu_sensors.json new file mode 120000 index 0000000000000..5816694317d6a --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn2410-r0/psu_sensors_conf_updater new file mode 120000 index 0000000000000..b9686d838e0f5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn2700-r0/psu_sensors.json new file mode 100644 index 0000000000000..8921400fd3832 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/psu_sensors.json @@ -0,0 +1,421 @@ +{ + "platform": { + "MSN2410": { + "default": { + "bus": [ + "i2c-10", + "i2c-1-mux (chan_id 10)" + ], + "chip": { + "dps460-i2c-*-58": ["2", "R"], + "dps460-i2c-*-59": ["1", "L"] + } + } + }, + "MSN2700": { + "default": { + "bus": [ + "i2c-10", + "i2c-1-mux (chan_id 10)" + ], + "chip": { + "dps460-i2c-*-58": ["2", "R"], + "dps460-i2c-*-59": ["1", "L"] + } + } + }, + "MSN2700-A1": { + "default": { + "bus": [], + "chip": { + "dps460-i2c-*-58": ["2", "R"], + "dps460-i2c-*-59": ["1", "L"] + } + } + }, + "MSN2740": { + "default": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["2", "R"], + "dps460-i2c-*-59": ["1", "L"] + } + } + }, + "MSN3420": { + "default": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["2"], + "dps460-i2c-*-59": ["1"] + } + } + }, + "MSN3700": { + "default": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["2"], + "dps460-i2c-*-59": ["1"] + } + }, + "respin": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["1"], + "dps460-i2c-*-59": ["2"] + } + }, + "swb_respin": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["1"], + "dps460-i2c-*-59": ["2"] + } + } + }, + "MSN3700C": { + "default": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["2"], + "dps460-i2c-*-59": ["1"] + } + }, + "respin": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["1"], + "dps460-i2c-*-59": ["2"] + } + }, + "swb_respin": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["1"], + "dps460-i2c-*-59": ["2"] + } + } + }, + "MSN3800": { + "default": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["2"], + "dps460-i2c-*-59": ["1"] + } + } + }, + "MSN4410": { + "default": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["1", "L"], + "dps460-i2c-*-59": ["2", "R"] + } + }, + "a1": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["1", "L"], + "dps460-i2c-*-59": ["2", "R"] + } + } + }, + "MSN4600": { + "default": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["1", "L"], + "dps460-i2c-*-59": ["2", "R"] + } + } + }, + "MSN4600C": { + "default": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["2", "R"], + "dps460-i2c-*-59": ["1", "L"] + } + }, + "a1": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["2", "R"], + "dps460-i2c-*-59": ["1", "L"] + } + }, + "respin": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["2", "R"], + "dps460-i2c-*-59": ["1", "L"] + } + }, + "respin_a1": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["2", "R"], + "dps460-i2c-*-59": ["1", "L"] + } + } + }, + "MSN4700": { + "default": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["1", "L"], + "dps460-i2c-*-59": ["2", "R"] + } + }, + "a1": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["1", "L"], + "dps460-i2c-*-59": ["2", "R"] + } + } + }, + "SN2201": { + "default": { + "bus": [ + "i2c-3", + "i2c-1-mux (chan_id 1)" + ], + "chip": { + "pmbus-i2c-3-58": ["1"], + "pmbus-i2c-4-58": ["2"] + } + } + }, + "SN4800": { + "default": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-59": ["1", "R"], + "dps460-i2c-*-58": ["2", "R"], + "dps460-i2c-*-5b": ["3", "L"], + "dps460-i2c-*-5a": ["4", "L"] + } + } + }, + "SN5600": { + "default": { + "bus": [ + + ], + "chip": { + "dps460-i2c-*-59": ["1", "L"], + "dps460-i2c-*-5a": ["2", "R"] + } + } + } + }, + + "psu": { + "MTEF-AC-A": { + "label": [ + "in1 PSU 220V Rail (in)", + "in2 PSU 12V Rail (out)", + "fan1 PSU Fan 1", + "temp1 PSU Temp 1", + "temp2 PSU Temp 2", + "power1 PSU 220V Rail Pwr (in)", + "power2 PSU 12V Rail Pwr (out)", + "curr1 PSU 220V Rail Curr (in)", + "curr2 PSU 12V Rail Curr (out)" + ] + }, + "MTEF-AC-C": { + "label": [ + "in1 PSU 220V Rail (in)", + "in3 PSU 12V Rail (out)", + "fan1 PSU Fan 1", + "temp1 PSU Temp 1", + "temp2 PSU Temp 2", + "temp3 PSU Temp 3", + "power1 PSU 220V Rail Pwr (in)", + "power2 PSU 12V Rail Pwr (out)", + "curr1 PSU 220V Rail Curr (in)", + "curr2 PSU 12V Rail Curr (out)" + ], + "ignore": [ + "in2", + "fan2", + "fan3" + ], + "set": [ + "in3_lcrit in3_crit * 0.662", + "in3_min in3_crit * 0.745", + "in3_max in3_crit * 0.952" + ] + }, + "MTEF-AC-C-SS1": { + "label": [ + "in1 PSU 220V Rail (in)", + "in3 PSU 12V Rail (out)", + "fan1 PSU Fan 1", + "temp1 PSU Temp 1", + "temp2 PSU Temp 2", + "temp3 PSU Temp 3", + "power1 PSU 220V Rail Pwr (in)", + "power2 PSU 12V Rail Pwr (out)", + "curr1 PSU 220V Rail Curr (in)", + "curr2 PSU 12V Rail Curr (out)" + ], + "ignore": [ + "in2", + "fan2", + "fan3" + ], + "set": [ + "in3_lcrit in3_crit * 0.662", + "in3_min in3_crit * 0.745", + "in3_max in3_crit * 0.952" + ] + }, + "MTEF-AC-E": { + "label": [ + "in1 PSU 220V Rail (in)", + "in3 PSU 12V Rail (out)", + "fan1 PSU Fan 1", + "temp1 PSU Temp 1", + "temp2 PSU Temp 2", + "temp3 PSU Temp 3", + "power1 PSU 220V Rail Pwr (in)", + "power2 PSU 12V Rail Pwr (out)", + "curr1 PSU 220V Rail Curr (in)", + "curr2 PSU 12V Rail Curr (out)" + ] + }, + "MTEF-AC-F": { + "label": [ + "in1 PSU 220V Rail (in)", + "in3 PSU 12V Rail (out)", + "fan1 PSU Fan 1", + "temp1 PSU Temp 1", + "temp2 PSU Temp 2", + "temp3 PSU Temp 3", + "power1 PSU 220V Rail Pwr (in)", + "power2 PSU 12V Rail Pwr (out)", + "curr1 PSU 220V Rail Curr (in)", + "curr2 PSU 12V Rail Curr (out)" + ], + "ignore": [ + "in2" + ] + }, + "MTEF-AC-G-ACBEL": { + "label": [ + "in1 PSU 220V Rail (in)", + "in3 PSU 12V Rail (out)", + "fan1 PSU Fan 1", + "temp1 PSU Temp 1", + "temp2 PSU Temp 2", + "power1 PSU 220V Rail Pwr (in)", + "power2 PSU 12V Rail Pwr (out)", + "curr1 PSU 220V Rail Curr (in)", + "curr2 PSU 12V Rail Curr (out)" + ] + }, + "MTEF-AC-I": { + + }, + "MTEF-AC-M": { + "label": [ + "in1 PSU 220V Rail(in)", + "in2 PSU 12V Rail(out)", + "fan1 PSU Fan1", + "temp1 PSU Temp1", + "temp2 PSU Temp2", + "temp3 PSU Temp3", + "curr1 PSU 220V Rail Curr(in)", + "curr2 PSU 12V Rail Curr(out)", + "power1 PSU 220V Rail Pwr(in)", + "power2 PSU 12V Rail Pwr(out)" + ], + "ignore": [ + "in3", + "curr3", + "power3" + ] + }, + "930-9SPSU-00RA-00B" :{ + "label": [ + "in1 PSU 220V Rail (in)", + "in3 PSU 12V Rail (out)", + "fan1 PSU Fan 1", + "temp1 PSU Temp 1", + "temp2 PSU Temp 2", + "power1 PSU 220V Rail Pwr (in)", + "power2 PSU 12V Rail Pwr (out)", + "curr1 PSU 220V Rail Curr (in)", + "curr2 PSU 12V Rail Curr (out)" + ], + "ignore": [ + "in2" + ], + "set": [ + "power2_cap 0" + ] + } + } +} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater new file mode 100644 index 0000000000000..2833bae9e7337 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater @@ -0,0 +1,81 @@ +#!/bin/bash + +function update_psu_sensors_configuration() { + local SENSORS_CONFIG_FILE="/tmp/sensors.conf" + local PSU_SENSORS_CONFIG="/usr/share/sonic/platform/psu_sensors.json" + + if [ -f $SENSORS_CONFIG_FILE ]; then + rm $SENSORS_CONFIG_FILE + fi + + if [ -z "$1" ]; then + echo "psu_sensors_conf_updater ERROR: no sensors configuration file had been selected" + return + else + cp $1 $SENSORS_CONFIG_FILE + fi + + platform=$(jq -r '.chassis.name' /usr/share/sonic/platform/platform.json) + # built-in psu, no need for dynamic configruation + if [[ "$platform" == "MSN2100" || "$platform" == "MSN2010" ]]; then return; fi + # incase we don't have this platform's info + if [[ $(jq -r --arg platform "$platform" '.platform[$platform]' $PSU_SENSORS_CONFIG) == "null" ]]; then return; fi + + local rev=$(cat "$1" | grep "Hardware revision" | awk '{print $NF}') + # incase we don't find the revision number + if [ ! $rev ]; then return; fi + # incase we don't have that revision's data + if [[ $(jq -r --arg platform "$platform" --arg rev "$rev" '.platform[$platform][$rev]' $PSU_SENSORS_CONFIG) == "null" ]]; then return; fi + + start_marker_number=$(grep -n "Power supplies" $SENSORS_CONFIG_FILE | cut -f1 -d:) + end_marker_number=$(($(tail -n +$(($start_marker_number + 1)) $SENSORS_CONFIG_FILE | grep -n '^$' | head -n 1 | cut -d: -f1) + $start_marker_number)) + # In some cases, the PSU sensor section may be at the end of the file, + # so using grep alone may not match it. Let's set the end marker + # to the total number of lines in the file directly. + if [ "$end_marker_number" == "$start_marker_number" ]; then + end_marker_number=$(wc -l $SENSORS_CONFIG_FILE) + fi + + sed -i "${start_marker_number},${end_marker_number}d" $SENSORS_CONFIG_FILE + + echo "" >> $SENSORS_CONFIG_FILE + echo "# Power supplies" >> $SENSORS_CONFIG_FILE + + bus=$(jq -r --arg platform "$platform" --arg rev "$rev" '.platform[$platform][$rev].bus | map("\"" + . + "\"") | join(" ")' $PSU_SENSORS_CONFIG) + if [ "$bus" ]; then echo "bus $bus" >> $SENSORS_CONFIG_FILE; fi + + mapfile -t chips < <(jq -r --arg platform "$platform" --arg rev "$rev" '.platform[$platform][$rev].chip | to_entries[] | .key' $PSU_SENSORS_CONFIG ) + + for chip in "${chips[@]}"; do + number=$(jq -r --arg platform "$platform" --arg rev "$rev" --arg chip "$chip" '.platform[$platform][$rev].chip[$chip] | to_entries | .[0].value' $PSU_SENSORS_CONFIG) + side=$(jq -r --arg platform "$platform" --arg rev "$rev" --arg chip "$chip" '.platform[$platform][$rev].chip[$chip] | to_entries | .[1].value' $PSU_SENSORS_CONFIG) + psu=$(cat /var/run/hw-management/eeprom/psu${number}_vpd | grep "PN_VPD_FIELD" | cut -d ' ' -f 2 2>&1) + if [ ! "$psu" ]; then + echo "psu_sensors_conf_updater ERROR: Failed to read from /var/run/hw-management/eeprom/psu${number}_vpd" + # keep looking for the rest psus + continue + else + if [ "$psu" == "MTEF-PSF-AC-G" ]; then + vendor=$(cat /var/run/hw-management/eeprom/psu${number}_vpd | grep "MFR_NAME:" | cut -d ' ' -f 2 2>&1) + psu="${psu}-${vendor}" + fi + psu=$(echo "$psu" | sed -r 's/-PSR|-PSF//g') + + echo " chip \""$chip"\"" >> $SENSORS_CONFIG_FILE + mapfile -t opers < <(jq -r --arg psu "$psu" '.psu[$psu] | keys[]' $PSU_SENSORS_CONFIG) + for oper in "${opers[@]}"; do + if [ "$oper" == "label" ]; then + section=$(jq -r --arg psu "$psu" --arg oper "$oper" '.psu[$psu][$oper] | map(" " + $oper + " " + . + "\"") | join("\n")' $PSU_SENSORS_CONFIG) + if [[ ! "$side" || "$side" == "null" ]]; then + echo "$section" | sed "s/PSU/\"PSU-$number/g" >> $SENSORS_CONFIG_FILE + else + echo "$section" | sed "s/PSU/\"PSU-$number($side)/g" >> $SENSORS_CONFIG_FILE + fi + else + jq -r --arg psu "$psu" --arg oper "$oper" '.psu[$psu][$oper] | map(" " + $oper + " " + .) | join("\n")' $PSU_SENSORS_CONFIG >> $SENSORS_CONFIG_FILE + fi + done + fi + done + +} diff --git a/device/mellanox/x86_64-mlnx_msn2700a1-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn2700a1-r0/psu_sensors.json new file mode 120000 index 0000000000000..5816694317d6a --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700a1-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700a1-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn2700a1-r0/psu_sensors_conf_updater new file mode 120000 index 0000000000000..b9686d838e0f5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700a1-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn2740-r0/psu_sensors.json new file mode 120000 index 0000000000000..5816694317d6a --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn2740-r0/psu_sensors_conf_updater new file mode 120000 index 0000000000000..b9686d838e0f5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3420-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn3420-r0/psu_sensors.json new file mode 120000 index 0000000000000..5816694317d6a --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3420-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3420-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn3420-r0/psu_sensors_conf_updater new file mode 120000 index 0000000000000..b9686d838e0f5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3420-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn3700-r0/psu_sensors.json new file mode 120000 index 0000000000000..5816694317d6a --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn3700-r0/psu_sensors_conf_updater new file mode 120000 index 0000000000000..b9686d838e0f5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3700c-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn3700c-r0/psu_sensors.json new file mode 120000 index 0000000000000..5816694317d6a --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3700c-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3700c-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn3700c-r0/psu_sensors_conf_updater new file mode 120000 index 0000000000000..b9686d838e0f5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3700c-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn3800-r0/psu_sensors.json new file mode 120000 index 0000000000000..5816694317d6a --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn3800-r0/psu_sensors_conf_updater new file mode 120000 index 0000000000000..b9686d838e0f5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4410-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn4410-r0/psu_sensors.json new file mode 120000 index 0000000000000..5816694317d6a --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4410-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4410-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn4410-r0/psu_sensors_conf_updater new file mode 120000 index 0000000000000..b9686d838e0f5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4410-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn4600-r0/psu_sensors.json new file mode 120000 index 0000000000000..5816694317d6a --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn4600-r0/psu_sensors_conf_updater new file mode 120000 index 0000000000000..b9686d838e0f5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn4600c-r0/psu_sensors.json new file mode 120000 index 0000000000000..5816694317d6a --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn4600c-r0/psu_sensors_conf_updater new file mode 120000 index 0000000000000..b9686d838e0f5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn4700-r0/psu_sensors.json new file mode 120000 index 0000000000000..5816694317d6a --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn4700-r0/psu_sensors_conf_updater new file mode 120000 index 0000000000000..b9686d838e0f5 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/psu_sensors.json b/device/mellanox/x86_64-nvidia_sn2201-r0/psu_sensors.json new file mode 120000 index 0000000000000..5816694317d6a --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-nvidia_sn2201-r0/psu_sensors_conf_updater new file mode 120000 index 0000000000000..b9686d838e0f5 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn4800-r0/psu_sensors.json b/device/mellanox/x86_64-nvidia_sn4800-r0/psu_sensors.json new file mode 120000 index 0000000000000..5816694317d6a --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn4800-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-nvidia_sn4800-r0/psu_sensors_conf_updater new file mode 120000 index 0000000000000..b9686d838e0f5 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn5600-r0/psu_sensors.json b/device/mellanox/x86_64-nvidia_sn5600-r0/psu_sensors.json new file mode 120000 index 0000000000000..5816694317d6a --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn5600-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-nvidia_sn5600-r0/psu_sensors_conf_updater new file mode 120000 index 0000000000000..b9686d838e0f5 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/dockers/docker-platform-monitor/docker_init.j2 b/dockers/docker-platform-monitor/docker_init.j2 index 46766b5fd1719..0b344328cbbcd 100755 --- a/dockers/docker-platform-monitor/docker_init.j2 +++ b/dockers/docker-platform-monitor/docker_init.j2 @@ -94,6 +94,14 @@ fi if [ -e $SENSORS_CONF_FILE ]; then HAVE_SENSORS_CONF=1 mkdir -p /etc/sensors.d + PSU_SENSORS_CONF_UPDATER="/usr/share/sonic/platform/psu_sensors_conf_updater" + if [ -e $PSU_SENSORS_CONF_UPDATER ]; then + source $PSU_SENSORS_CONF_UPDATER + update_psu_sensors_configuration $SENSORS_CONF_FILE + if [ -f /tmp/sensors.conf ]; then + SENSORS_CONF_FILE="/tmp/sensors.conf" + fi + fi /bin/cp -f $SENSORS_CONF_FILE /etc/sensors.d/sensors.conf fi