chore: Update infrastructure agent installation script and documentation

This commit is contained in:
Simon Larsen
2024-05-14 17:55:15 +01:00
parent 0e3eb81ae4
commit b30bb4c95e
4 changed files with 9 additions and 67 deletions

View File

@@ -4,14 +4,8 @@ The OneUptime Infrastructure Agent is a lightweight, open-source agent that coll
## Installation
Download the Installation Script
```bash
curl -O https://raw.githubusercontent.com/anxuanzi/oneuptime-infrastructure-agent-go/main/install.sh
```
Run the Installation Script
```bash
chmod +x install.sh && ./install.sh
curl -s https://oneuptime.com/docs/static/scripts/infrastructure-agent/install.sh | bash
```
## Configure the agent
@@ -19,6 +13,7 @@ chmod +x install.sh && ./install.sh
Configure the agent as a system service
- You can change the host to your own host if you're self hosting the OneUptime platform.
- You can find the secret key on OneUptime Dashboard. Click on "View Monitor" and go to "Settings" tab.
```bash
oneuptime-infrastructure-agent configure --secret-key=YOUR_SECRET_KEY --oneuptime-url=https://oneuptime.com
```
@@ -28,6 +23,7 @@ oneuptime-infrastructure-agent configure --secret-key=YOUR_SECRET_KEY --oneuptim
```
oneuptime-infrastructure-agent start
```
Once its up and running you should see the metrics on the OneUptime Dashboard.
## Stopping the agent

View File

@@ -1,77 +0,0 @@
#!/bin/sh
set -e
usage() {
echo "Usage: $0 [-b bindir] [-d]"
echo " -b sets the directory for the binary installation, default is ./bin"
echo " -d enables debug mode"
exit 1
}
# Default parameters
BINDIR=/usr/bin
DEBUG=0
# Parse command-line options
while getopts "b:d" opt; do
case ${opt} in
b )
BINDIR=$OPTARG
;;
d )
set -x
DEBUG=1
;;
\? )
usage
;;
esac
done
echo "Installing to ${BINDIR}"
mkdir -p "${BINDIR}"
# Detect platform and architecture
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case $ARCH in
x86_64)
ARCH=amd64
;;
aarch64)
ARCH=arm64
;;
*arm*)
ARCH=arm
;;
*)
echo "Architecture $ARCH is not supported"
exit 1
;;
esac
# Fetch the latest release tag from GitHub
REPO="oneuptime/oneuptime"
API_URL="https://api.github.com/repos/${REPO}/releases/latest"
TAG=$(curl -s ${API_URL} | grep '"tag_name":' | sed -E 's/.*"tag_name": "([^"]+)".*/\1/')
if [ "$TAG" = "" ]; then
echo "Failed to find the latest release. Please check your internet connection or GitHub API limits."
exit 1
fi
echo "Fetching the latest release: $TAG"
# Construct the URL for the binary release
URL="https://github.com/${REPO}/releases/download/${TAG}/oneuptime-infrastructure-agent_${OS}_${ARCH}.tar.gz"
# Download and extract the binary
curl -sL "${URL}" | tar xz -C "${BINDIR}"
# Check if the binary is executable
if [ ! -x "${BINDIR}/oneuptime-infrastructure-agent" ]; then
echo "Failed to install oneuptime-infrastructure-agent"
exit 1
fi
echo "oneuptime-infrastructure-agent installed successfully to ${BINDIR}. Please configure the agent using 'oneuptime-infrastructure-agent configure'."