Skip to content

MonitoringPlugin pt BR

ArchiBot edited this page Jul 9, 2024 · 6 revisions

MonitoringPlugin

MonitoringPlugin é um plugin oficial do ASF, que permite que você monitore o processo do ASF através do Prometheus que é um banco de dados de cronogramas.


Capturas de tela

Show

screenshot


Requisitos

Devido a restrições técnicas, esse plugin requer a variante generic do ASF.


Ativando o Plugin

O ASF não vem com o MonitoringPlugin agrupado por padrão, no entanto, ele está incluso como adição opcional toda versão do ASF. 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.

Na próxima inicialização do ASF, os logs indicarão que o plugin foi carregado com sucesso através do mecanismo padrão de logs do ASF. Você também pode verificar isso navegando até a URL /Api/metrics na sua interface IPC. Se você está usando a senha IPC, você precisará de autorização adequada, acrescentando ?password=<YourIPCPassword> à URL /Api/metrics. O conteúdo que você vê deve se parecer com o mesmo conteúdo abaixo:

# TYPE asf_build_info gauge
# HELP asf_build_info Build information about ASF in form of label values
asf_build_info{variant="source",version="6.0.2.5"} 1 1713715703686

# TYPE asf_runtime_info gauge
# HELP asf_runtime_info Runtime information about ASF in form of label values
asf_runtime_info{framework=".NET 8.0.4",operating_system="Debian GNU/Linux trixie/sid",runtime="linux-x64"} 1 1713715703686
(...)

Métricas do ASF e os bots dedicaram o prefixo asf_ no seu nome. 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.


Configuração do Prometheus

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.


Painel do Grafana

Once your metrics are gathered by Prometheus, it's possible to use Grafana for visualization. The plugin comes with /grafana-dashboard.json file served by standard IPC mechanisms, so assuming you're running your ASF instance with default settings, you can download it here. Alternatively, you can also grab the JSON file from our repository as well.

Clone this wiki locally