We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Keibi Setup Documentation
Quick Navigation
Setting up keibid.sh
The keibid.sh
script collects and sends system metrics to the Keibi API. Here's how to set it up:
Basic Setup
- Download the
keibid.sh
script to your server - Make it executable:
chmod +x keibid.sh
- Set required environment variables (see Environment Variables section)
- Run the script:
./keibid.sh
Script Functionality
The script collects the following metrics:
- CPU usage percentage
- Memory usage (used/total)
- Disk space (used/total/percentage)
- Instance name and IP address
- Rails-specific metrics (when available)
- Fly.io platform details (when deployed on Fly.io)
Script Overview
The script includes the following key components:
- Environment variable validation (KEIBI_API_URL, KEIBI_API_KEY)
- Default settings for interval (10 minutes) and service identification
- Functions for collecting system metrics (CPU, memory, disk)
- Smart instance name detection (with Fly.io integration)
- JSON payload construction for API submission
- Error handling and reporting
#!/bin/bash
# Environment variables required:
# - KEIBI_API_URL: The Keibi API endpoint
# - KEIBI_API_KEY: Your API key
# - SERVICE_ID: Optional service identifier
# - INTERVAL: Optional reporting interval in seconds (default: 600)
# Main loop collects and sends metrics at the specified interval
# See the downloaded script for the full implementation
Configuring supervisord.conf
Supervisor ensures that the keibid script keeps running reliably. Here's the configuration:
[supervisord]
nodaemon=true
user=root
logfile=/dev/stdout
logfile_maxbytes=0
pidfile=/var/run/supervisord.pid
[program:keibid]
command=/app/keibid.sh
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
environment=
KEIBI_API_URL="%(ENV_KEIBI_API_URL)s",
SERVICE_ID="%(ENV_SERVICE_ID)s",
INTERVAL="%(ENV_INTERVAL)s",
KEIBI_API_KEY="%(ENV_KEIBI_API_KEY)s"
Installation Steps
- Install Supervisor:
apt-get install supervisor
(Ubuntu/Debian) oryum install supervisor
(CentOS/RHEL) - Copy the configuration to
/etc/supervisor/conf.d/keibid.conf
- Reload Supervisor:
supervisorctl reload
- Check status:
supervisorctl status keibid
Using the Dockerfile
For containerized deployments, use our Dockerfile to set up the Keibi agent:
FROM alpine:3.19
# Install required packages
RUN apk add --no-cache \
bash \
curl \
procps \
supervisor
# Create app directory
WORKDIR /app
# Copy our script
COPY keibid.sh keibid.sh
RUN chmod +x keibid.sh
# Create supervisor config
RUN mkdir -p /etc/supervisor/conf.d
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Set environment variables with defaults (these can be overridden at runtime)
ENV API_ENDPOINT="http://host.docker.internal:4000/api/readings" \
SERVICE_ID="default" \
INTERVAL=60 \
KEIBI_API_KEY="" \
KEIBI_INSTANCE_NAME=""
# Run supervisord
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
Docker Build and Run
# Build the Docker image
docker build -t keibi-agent .
# Run the container with your API key
docker run -d --name keibi-agent \
-e API_ENDPOINT="https://your-keibi-server.com/api/readings" \
-e KEIBI_API_KEY="your-api-key" \
-e SERVICE_ID="your-service-id" \
keibi-agent
Environment Variables
Configure the Keibi agent using these environment variables:
Variable | Required | Default | Description |
---|---|---|---|
API_ENDPOINT | Yes | None | URL of the Keibi API endpoint |
KEIBI_API_KEY | Yes | None | Your API key for authentication |
SERVICE_ID | No | "default" | Service identifier in Keibi |
INTERVAL | No | 60 | Reporting interval in seconds |
KEIBI_INSTANCE_NAME | No | Auto-detected | Override for instance name |
Need Help?
If you encounter any issues setting up Keibi, please contact our support team or check out these resources: