-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0bb505a
commit 5543232
Showing
4 changed files
with
49 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
windows_linux_custom_gameserver_metrics/PF_StartupScript.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
set -o errexit # script exits when a command fails == set -e | ||
set -o nounset # script exits when tries to use undeclared variables == set -u | ||
set -o xtrace # trace what's executed == set -x (useful for debugging) | ||
set -o pipefail # causes pipelines to retain / set the last non-zero status | ||
|
||
# get script's path | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
# install telegraf | ||
sudo apt-get -yq --no-install-recommends install "${DIR}"/telegraf.deb | ||
|
||
systemctl stop telegraf | ||
|
||
# remove \r\n in-place | ||
sed -i -e 's/\r$//' ${DIR}/telegraf.conf | ||
|
||
mkdir -p /etc/telegraf || echo 'Warning: /etc/telegraf already exists' | ||
|
||
# add PF_TITLE_ID, PF_BUILD_ID, PF_VM_ID to telegraf.conf as dimensions | ||
sed -e "s/_%PF_TITLE_ID%_/${PF_TITLE_ID}/g" -e "s/_%PF_BUILD_ID%_/${PF_BUILD_ID}/g" -e "s/_%PF_VM_ID%_/${PF_VM_ID}/g" -e "s/_%PF_REGION%_/${PF_REGION}/g" ${DIR}/telegraf.conf > /etc/telegraf/telegraf.conf | ||
|
||
# add user telegraf to group docker so telegraf daemon can read docker logs | ||
sudo usermod -a -G docker telegraf | ||
|
||
systemctl restart telegraf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters