ServerMetrics

v1.0.0 Discord

A Discord bot that monitors and displays Rust server performance metrics from InfluxDB. It automatically posts updated graphs and summaries for players, FPS, frame time, entity counts, and network I/O to a designated Discord channel. Users with appropriate roles can also request specific metric graphs via slash commands.

Gallery

ServerMetrics

Version: 1.0.0 | Discord Bot
Back to Bots
ServerMetrics

Key Features

  • Automatic periodic updates of server metrics in a Discord channel.
  • Visual graphs for player counts, server FPS, frame times, entity counts, and network I/O.
  • Configurable display for each graph type in automated posts.
  • Slash commands for on-demand graph generation: /server_players, /server_fps, /server_frametime, /server_entities, /server_network.
  • Role-based access control for slash commands.
  • Support for multiple servers, with an option to exclude specific servers from display.
  • Configurable time period for data queries (e.g., last 24h, 7d).
  • Configurable graph update interval.
  • Timezone awareness for graph display.
  • Intelligently updates existing Discord messages to avoid channel spam and preserve history.
  • Bot presence dynamically indicates overall server status (player count, players joining).

Installation

ServerMetricsBot requires Python 3.8+ and an InfluxDB instance (1.x or 2.x with compatibility API) populated with Rust Server Metrics.

pip install -r requirements.txt

Installation Steps

  1. Clone the repository or download the bot files.
  2. Install required dependencies using pip (see above).
  3. Create a Discord bot via the Discord Developer Portal.
  4. Copy the Discord bot token and set up the configuration file.
  5. Configure your database and other settings (see Configuration section).
  6. Start the bot using the run command.

Configuration

The bot's configuration is managed through a central configuration file. Create a .env file with the following settings:

CORE_SETTINGS (.env file) = {
    'DISCORD_TOKEN': 'Your Discord bot token.',
    'DISCORD_CHANNEL_ID': 'The ID of the Discord channel where metrics will be posted.',
    'ALLOWED_ROLE_ID': 'The ID of the Discord role allowed to use slash commands.',
    'QUERY_TIME_PERIOD': 'Default time period for data queries (e.g., 24h, 7d, 30d). Used for scheduled updates and default for commands.',
    'GRAPH_UPDATE_INTERVAL_MINUTES': 'How often the bot automatically updates the metrics in Discord (e.g., 5 for every 5 minutes).',
    'GRAPH_TIMEZONE': 'Timezone for graph x-axis labels (e.g., UTC, America/New_York).',
    'EXCLUDED_SERVERS': 'Optional: Comma-separated list of server names (as they appear in InfluxDB) to exclude from metrics.',
}

INFLUXDB_SETTINGS (.env file) = {
    'INFLUXDB_HOST': 'Hostname or IP address of your InfluxDB server.',
    'INFLUXDB_PORT': 'Port number for your InfluxDB server (usually 8086).',
    'INFLUXDB_USERNAME': 'Username for InfluxDB authentication (leave blank if none).',
    'INFLUXDB_PASSWORD': 'Password for InfluxDB authentication (leave blank if none).',
    'INFLUXDB_DATABASE': 'Name of the InfluxDB database containing server metrics.',
}

GRAPH_VISIBILITY (.env file) = {
    'SHOW_PLAYERS_GRAPH': 'Set to True or False to show/hide the player count graph in automated posts.',
    'SHOW_FPS_GRAPH': 'Set to True or False to show/hide the FPS graph in automated posts.',
    'SHOW_FRAMETIME_GRAPH': 'Set to True or False to show/hide the frame time graph in automated posts.',
    'SHOW_ENTITIES_GRAPH': 'Set to True or False to show/hide the entity count graph in automated posts.',
    'SHOW_NETWORK_GRAPH': 'Set to True or False to show/hide the network I/O graph in automated posts.',
}

Configuration Options

Option Description
CORE_SETTINGS (.env file)
Configuration object with the following properties:
  • DISCORD_TOKEN: Your Discord bot token.
  • DISCORD_CHANNEL_ID: The ID of the Discord channel where metrics will be posted.
  • ALLOWED_ROLE_ID: The ID of the Discord role allowed to use slash commands.
  • QUERY_TIME_PERIOD: Default time period for data queries (e.g., 24h, 7d, 30d). Used for scheduled updates and default for commands.
  • GRAPH_UPDATE_INTERVAL_MINUTES: How often the bot automatically updates the metrics in Discord (e.g., 5 for every 5 minutes).
  • GRAPH_TIMEZONE: Timezone for graph x-axis labels (e.g., UTC, America/New_York).
  • EXCLUDED_SERVERS: Optional: Comma-separated list of server names (as they appear in InfluxDB) to exclude from metrics.
INFLUXDB_SETTINGS (.env file)
Configuration object with the following properties:
  • INFLUXDB_HOST: Hostname or IP address of your InfluxDB server.
  • INFLUXDB_PORT: Port number for your InfluxDB server (usually 8086).
  • INFLUXDB_USERNAME: Username for InfluxDB authentication (leave blank if none).
  • INFLUXDB_PASSWORD: Password for InfluxDB authentication (leave blank if none).
  • INFLUXDB_DATABASE: Name of the InfluxDB database containing server metrics.
GRAPH_VISIBILITY (.env file)
Configuration object with the following properties:
  • SHOW_PLAYERS_GRAPH: Set to True or False to show/hide the player count graph in automated posts.
  • SHOW_FPS_GRAPH: Set to True or False to show/hide the FPS graph in automated posts.
  • SHOW_FRAMETIME_GRAPH: Set to True or False to show/hide the frame time graph in automated posts.
  • SHOW_ENTITIES_GRAPH: Set to True or False to show/hide the entity count graph in automated posts.
  • SHOW_NETWORK_GRAPH: Set to True or False to show/hide the network I/O graph in automated posts.

Bot Commands

Admin Commands

Command Description
/server_players [server] [period] Shows the server player count graph. Optionally filter by server name and specify time period (e.g., 6h, 1d, 7d).
/server_fps [server] [period] Shows the server FPS graph. Optionally filter by server name and specify time period.
/server_frametime [server] [period] Shows the server frame time graph. Optionally filter by server name and specify time period.
/server_entities [server] [period] Shows the server entity count graph. Optionally filter by server name and specify time period.
/server_network [server] [period] Shows the server network I/O graph. Optionally filter by server name and specify time period.

Scheduled Tasks

This bot runs the following automated tasks:

Task Frequency Description
Server Metrics Update Every [GRAPH_UPDATE_INTERVAL_MINUTES] minutes (configurable in .env). Automatically fetches the latest server performance data from InfluxDB, generates updated graphs (Players, FPS, Frame Time, Entities, Network I/O based on visibility settings), and posts/updates them in the configured Discord channel. Also updates the bot's presence with live player counts.

Bot Information

Version 1.0.0
Language Python
Platform Discord
License Custom
Integration InfluxDB, Rust Servers

Need Bot Hosting?

For optimal performance, we recommend hosting your ServerMetricsBot on our specialized Discord bot hosting platform. Our Python hosting plans provide the perfect environment for running your bot with 24/7 uptime and easy management through the Pterodactyl panel.

View Hosting Plans

Get This Bot

Interested in using this Discord bot for your game server?

This bot is available for free. Click below to download.

7 downloads

Additional Information

This bot is designed specifically for Discord integration with Rust game servers and communities.

Requirements

  • Python 3.8 or higher
  • Discord Bot Token
  • InfluxDB Details & Setup

Support

For support with bot implementation or customization, please contact us.