Browse Source

feat: add LinuxGSM stats tracking

This commit adds functionality to track LinuxGSM server statistics using Google Analytics and a custom API. The code now sends POST requests to both services, providing information such as CPU usage, memory usage, disk space, server hardware details, and game-specific data. Additionally, the commit includes an alert feature that sends event data to Discord if enabled.

Co-authored-by: [Author Name]
pull/4295/head
Daniel Gibbs 2 years ago
parent
commit
2aa219566b
  1. 2
      lgsm/modules/info_stats.sh

2
lgsm/modules/info_stats.sh

@ -89,6 +89,7 @@ curl -X POST "https://www.google-analytics.com/mp/collect?api_secret=A-OzP02TSMW
}"
curl -i -X POST https://stats.linuxgsm.com/api/event \
-H 'User-Agent: curl' \
-H 'Content-Type: application/json' \
--data "{\"name\":\"linuxgsm\",
\"url\":\"https://stats.linuxgsm.com\",
@ -109,6 +110,7 @@ curl -i -X POST https://stats.linuxgsm.com/api/event \
\"serverram\": \"${physmemtotal}\",
\"version\": \"${version}\"
}"
## Alert Stats.
if [ "${discordalert}" == "on" ]; then
curl https://www.google-analytics.com/collect -d "tid=UA-165287622-1" -d "aip=1" -d "cid=${uuidinstance}" -d "t=event" -d "ec=alert" -d "ea=Discord" -d "el=${gamename}" -d "v=1" > /dev/null 2>&1

Loading…
Cancel
Save