bbar-SimpleHealthcheck icon

SimpleHealthcheck

A lightweight Valheim server mod to call webhooks and support simple health monitoring via HTTP.

Last updated 10 months ago
Total downloads 482
Total rating 0 
Categories Tweaks Server-side Utility Hildir's Request Update
Dependency string bbar-SimpleHealthcheck-2.0.0
Dependants 0 other packages depend on this package

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2202 icon
denikson-BepInExPack_Valheim

BepInEx pack for Valheim. Preconfigured and includes unstripped Unity DLLs.

Preferred version: 5.4.2202

README

Valheim Server Simple HealthCheck

A lightweight Valheim server mod to call webhooks and support simple health monitoring via HTTP.

Features

The goal of this mod is to provide some simple server monitoring tools with low overhead and not bring in a whole bunch of other dependencies. While other server notification mods are usually tightly coupled with a specific service (e.g. a discord event notifier), this mod supports calling any arbitrary webhook you provide when certain events happen on the server. For example, when a player joins my server, this mod calls an IFTTT webhook to start a routine that sends a discord notification to two different discord servers, and triggers a blink(1) device.

See the configuration section for more information. Please submit any suggestions for more events to support as an issue.

This mod also creates a lightweight webserver that allows external uptime monitoring tools (e.g. UptimeRobot) to monitor the status of your Valheim server by responding to incoming HTTP requests. As with the webhooks, there are other solutions out there, but they often work by parsing server logs and require starting up a node.js instance or other beefier infrastructure.

The web server will respond to HEAD and GET method requests only. You can also specify a keyword to send in the response body to facilitate keyword monitoring, if desired (and supported by your monitoring service). See the Confgiuration section for more customization info.

The simplest way to use the webserver is to run the mod with your Valheim server, then point a reverse proxy to it on the same machine.

Configuration

WebHooks

This section of the config file contains settings that allow you to set a URL that the plugin will call when some event happens.

By default the plugin sends a GET request, but this can be changed by prefixing the URL with an HTTP method seperated from the URL with a ;. Supported methods are: GET, HEAD, PUT, POST, and DELETE. If an invalid or no method is specified, GET will be used.

For example, to specify a POST request:

ServerStarted = POST;http://example.com/endpoint

Additionally, some webhooks support substituting occurrences of a special string with a value coming from the plugin. This allows you to pass some data along about the event. Substitutions specific to a hook will be noted in the entry in config file. All hooks support the substitution {HookName}, which is replaced with the name of the entry in the config file.

For example, in the following URL the string {PlayerName} will be replaced by the name of the player who joined the server, and {HookName} will be replaced with "PlayerJoined":

PlayerJoined = GET;http://example.com/trigger?event={HookName}&player={PlayerName}

See the config file for documentation about each webhook.

Heartbeat

A heartbeat is just a special webhook that is called at a regular interval to indicate that the server is still running. You can specify the heartbeat URL as well as the interval in the config file.

WebServer

  • EnableWebServer
    • Default: true
    • If the webserver should be enabled and respond to external requests or not.
  • HttpHost
    • Default: localhost
    • The HTTP host or address to bind to.
  • HttpPort
    • Default: 5080
    • The HTTP port to use.
  • ResponseKeyword
    • Default: VALHEIM_SERVER
    • A keyword to return in GET requests to service keyword based monitoring.
  • SuccessCode
    • Default: 200
    • The HTTP status code to respond with to indicate server is running.

Installation

BepinEx for Valheim is required for this plugin to work.

Install from your favorite mod manager, or manually by following these instructions:

  1. Download and extract the build artifact for the latest release
  2. Place the bbar.Mods.SimpleHealthCheck.dll file into <GameDirectory>\Bepinex\plugins
  3. The first time the game starts with the plugin loaded, it will generate a config file: <GameDirectory>\BepinEx\config\bbar.Mods.SimpleHealthCheck.cfg
  4. Open the cfg file to change configuration as needed. Any manual changes to that file will require a restart. The plugin is also compatible with the BepinEx configuration manager.

Quick Links

Attributions