Skip to content

MonitoringPlugin

Łukasz Domeradzki edited this page Apr 14, 2024 · 16 revisions

Note

Monitoring plugin is not available just yet, this is a pre-release wiki page.


MonitoringPlugin

MonitoringPlugin is an official ASF plugin, which allows you to monitor ASF process via Prometheus time-series database.

screenshot


Requirements

Due to technical constraints, this plugin requires generic variant of ASF.


Enabling the plugin

ASF does not come with MonitoringPlugin bundled by default, however, it's included as optional addition in every ASF release. Download the plugin from the official release that matches your ASF version, then create a dedicated plugins/ArchiSteamFarm.OfficialPlugins.Monitoring directory for the plugin, and finally extract the archive there.

On the next launch of ASF, the logs will indicate that the plugin has been successfully loaded through standard ASF logging mechanism. You can also verify this by navigating to /Api/metrics URL in your IPC interface. If you are using IPC password, you'll need proper authorization, e.g. appending ?password=<YourIPCPassword> to the /Api/metrics URL. The content you see should look similar to below:

# TYPE asf_ipc_banned_ips gauge
# HELP asf_ipc_banned_ips Number of IP addresses currently banned by ASFs IPC module
asf_ipc_banned_ips{otel_scope_name="ArchiSteamFarm",otel_scope_version="6.0.1.21"} 0 1712215803518
# TYPE asf_active_plugins gauge
# HELP asf_active_plugins Number of plugins currently loaded in ASF
asf_active_plugins{otel_scope_name="ArchiSteamFarm",otel_scope_version="6.0.1.21"} 4 1712215803518
# TYPE asf_bots gauge
# HELP asf_bots Number of bots that are currently loaded in ASF
asf_bots{otel_scope_name="ArchiSteamFarm",otel_scope_version="6.0.1.21",state="configured"} 5 1712215803518
asf_bots{otel_scope_name="ArchiSteamFarm",otel_scope_version="6.0.1.21",state="online"} 4 1712215803518
asf_bots{otel_scope_name="ArchiSteamFarm",otel_scope_version="6.0.1.21",state="offline"} 1 1712215803518
asf_bots{otel_scope_name="ArchiSteamFarm",otel_scope_version="6.0.1.21",state="farming"} 0 1712215803518
(...)

Metrics regarding ASF and the bots have dedicated prefix asf_ in their name. Other metrics e.g. regarding the .NET runtime or ASF's HttpClient are automatically generated based on universal .NET process rules and do not carry such prefix.


Prometheus config

Once you verified the plugin is working correctly, you can add a scrape configuration to your Prometheus instance as such:

scrape_configs:
  - job_name: ArchiSteamFarm
    metrics_path: /Api/metrics
    params:
      - password:
          - YourIPCPassword
    static_configs:
      - targets:
          - 127.0.0.1:1242

Naturally, you need to ensure that your hosted Prometheus instance is able to reach ASF's IPC interface, adapt password and targets accordingly to your usage. If you do not have IPC password set (which is not recommended), you can skip the addition of the params section. In case you're running multiple ASF instances with different IPC passwords, you can add additional scrape configurations, one per instance, as the query parameters can not be set on a per-target basis. Otherwise, you can declare several targets if they share the same password.


Grafana dashboard

Once your metrics are gathered by Prometheus, it's possible to use Grafana for visualization. Below you can find example dashboard that you can import into your Grafana instance:

TODO
Clone this wiki locally