Browse Source

feat: add virtual environment to info_distro, info_game, and info_stats modules

- Added code to retrieve the virtual environment using systemd-detect-virt command.
- Updated the condition for RHEL based distros in info_distro module.
- Removed code related to country code retrieval from external IP address in info_game module.
- Added virtual environment field to the payload sent to Google Analytics and LinuxGSM API in info_stats module.
pull/4295/head
Daniel Gibbs 2 years ago
parent
commit
8ee03daf03
  1. 7
      lgsm/modules/info_distro.sh
  2. 14
      lgsm/modules/info_game.sh
  3. 6
      lgsm/modules/info_stats.sh

7
lgsm/modules/info_distro.sh

@ -73,7 +73,12 @@ for distro_info in "${distro_info_array[@]}"; do
fi
done
# some RHEL based distros use 8.4 instead of just 8.
# Get virtual environment
if [ "$(command -v systemd-detect-virt 2> /dev/null)" ]; then
virtualenvironment="$(systemd-detect-virt)"
fi
# Some RHEL based distros use 8.4 instead of just 8.
if [[ "${distroidlike}" == *"rhel"* ]] || [ "${distroid}" == "rhel" ]; then
distroversioncsv="${distroversionrh}"
else

14
lgsm/modules/info_game.sh

@ -2397,20 +2397,6 @@ else
extip="$(cat "${tmpdir}/extip.txt")"
fi
# Country code of external IP address
if [ ! -f "${tmpdir}/countrycode.txt" ]; then
countrycode="$(curl --connect-timeout 10 -s https://ipapi.co/country 2> /dev/null)"
exitcode=$?
# if curl passes add extip to externalip.txt
if [ "${exitcode}" == "0" ]; then
echo "${countrycode}" > "${tmpdir}/countrycode.txt"
else
echo "Unable to get external IP address"
fi
else
countrycode="$(cat "${tmpdir}/countrycode.txt")"
fi
# Alert IP address
if [ "${displayip}" ]; then
alertip="${displayip}"

6
lgsm/modules/info_stats.sh

@ -82,7 +82,8 @@ curl -X POST "https://www.google-analytics.com/mp/collect?api_secret=A-OzP02TSMW
\"uuidhardware\": \"${uuidhardware}\",
\"uuidinstall\": \"${uuidinstall}\",
\"uuidinstance\": \"${uuidinstance}\",
\"version\": \"${version}\"
\"version\": \"${version}\",
\"virtualenvironment\": \"${virtualenvironment}\"
}
}
]
@ -108,7 +109,8 @@ curl -i -X POST https://stats.linuxgsm.com/api/event \
\"servercpufreq\": \"${cpufreqency} x${cpucores}\",
\"serverdisk\": \"${totalspace}\",
\"serverram\": \"${physmemtotal}\",
\"version\": \"${version}\"
\"version\": \"${version}\",
\"virtualenvironment\": \"${virtualenvironment}\"
}"
## Alert Stats.

Loading…
Cancel
Save