diff options
Diffstat (limited to 'core/modules/hardware-stats/data/opt/openslx/system-check/hooks.d/50-hardware-report')
-rwxr-xr-x | core/modules/hardware-stats/data/opt/openslx/system-check/hooks.d/50-hardware-report | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/core/modules/hardware-stats/data/opt/openslx/system-check/hooks.d/50-hardware-report b/core/modules/hardware-stats/data/opt/openslx/system-check/hooks.d/50-hardware-report index 31b0b26f..6d137f40 100755 --- a/core/modules/hardware-stats/data/opt/openslx/system-check/hooks.d/50-hardware-report +++ b/core/modules/hardware-stats/data/opt/openslx/system-check/hooks.d/50-hardware-report @@ -12,11 +12,12 @@ disable_remote_logging() { # sends the hardware information of this machine generated by # systemd-hardware_stats_gather in /run/hwreport and /run/hwinfo report_hardware_info() { + local uptime hwreport hwinfo uuid model subnet ret runmode if [ -z "$SLX_REMOTE_LOG" ]; then disable_remote_logging return 1 fi - local hwreport="/run/hwreport" + hwreport="/run/hwreport" if [ ! -s "$hwreport" ]; then echo "Missing hwreport file: $hwreport" # TODO send data without? @@ -24,7 +25,7 @@ report_hardware_info() { fi # Read generated data and current uptime and send it - local hwinfo="/run/hwinfo" + hwinfo="/run/hwinfo" if [ ! -s "$hwinfo" ]; then echo "Missing hwinfo file: $hwinfo" return 1 @@ -32,21 +33,27 @@ report_hardware_info() { . "$hwinfo" # got everything, get the last infos - local uptime=$(grep -oE '^[0-9]+' /proc/uptime) + uptime=$(grep -oE '^[0-9]+' /proc/uptime) uuid=$(cat /etc/system-uuid) if [ -z "$uuid" ] || [ "${#uuid}" -ne "36" ]; then echo "No/malformed UUID, aborting" >&2 exit 1 fi + runmode="$SLX_RUNMODE_MODULE" + if [ -n "$SLX_EXAM" ]; then + # This isn't an actual runmode, but in case exam mode is active on a client you definitely want + # to know about it, more than other runmodes actually + runmode="exams" + fi # Combine manufacturer and model name (for displaying purposes) - local model="$HW_MODEL" + model="$HW_MODEL" if [ "$HW_MANUF" != "Unknown" ]; then model="$model ($HW_MANUF)" fi # Get IP/subnet size - local subnet="$( ip -o -f inet addr show br0 | awk '/scope global/ {print $4}' )" + subnet="$( ip -o -f inet addr show br0 | awk '/scope global/ {print $4}' )" # just assume the uuid/mac dumped are valid here (its checked often enough :)) echo -n "Submitting to '$SLX_REMOTE_LOG' ... " curl --retry 4 --retry-connrefused --max-time 5 --retry-max-time 15 \ @@ -54,7 +61,7 @@ report_hardware_info() { --data-urlencode "uptime=$uptime" --data-urlencode "realcores=$HW_CORES" --data-urlencode "mbram=$HW_MBRAM" \ --data-urlencode "kvmstate=$HW_KVM" --data-urlencode "cpumodel=$HW_CPUMODEL" --data-urlencode "id44mb=$HW_ID44" \ --data-urlencode "badsectors=$HW_BADSECTORS" --data-urlencode "systemmodel=$model" --data-urlencode "subnet=$subnet" \ - --data-urlencode "data@$hwreport" "$SLX_REMOTE_LOG" | grep -q "RESULT=0" + --data-urlencode "runmode=$runmode" --data-urlencode "data@$hwreport" "$SLX_REMOTE_LOG" | grep -q "RESULT=0" local ret=$? if [ "$ret" -ne 0 ]; then echo "failed." |