用于普罗米修斯监测的xonotic metrics出口商
xonotic-exporter的Python项目详细描述
用于Prometheus monitoring system的xonotic度量导出器。 度量是通过rcon(status 1command)查询服务器获得的。
安装
- execute ^{tt2}$
- or run ^{tt3}$ to install latest development version from github
配置
xnotic exporter由文件和cli选项配置。cli选项用于 指定要侦听的端口或地址、要使用的配置以及 配置文件用于指定度量将从何处开始的服务器 出口。配置文件是yaml字典,其中键是服务器名 (instancelabel in prometheus)和values是服务器连接选项。 下面是配置示例:
public: server: 172.16.254.1 port: 26000 rcon_password: "secretpassword" rcon_mode: 1 private: server: private.example.com rcon_password: "secret" ipv6-server: server: 2001:db8:85a3::8a2e:370:7334 port: 26001 rcon_mode: 2 rcon_password: "password"
连接选项没有几个必需的字段(server,rcon_password)和 还有一些具有默认值的可选字段(port,rcon_mode)。 服务器字段可能包含IPv4或IPv6地址或DNS名称。如果你正在使用 dns名称,每次向服务器发出请求之前都会解析它,因此如果 更改DNS记录不需要重新启动导出程序即可使用新IP。 有关配置文件格式的详细信息,可以检查it’s JSON schema。 此外,还可以使用--validatecli选项检查配置的正确性。
如果编辑配置文件,则无需重新启动即可更新配置 xNotic导出程序,只需发送HUP信号来处理或发送post请求到 /-/reload终结点。
例如:
$ kill -HUP 4429 # 4429 is exporters PID $ curl -XPOST http://localhost:9260/-/reload
普罗米修斯配置
导出器需要将服务器名称作为目标参数传递。它类似于 blackbox和snmp出口商。
普罗米修斯配置示例:
scrape_configs: - job_name: 'xonotic_exporter' relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 127.0.0.1:9260 static_configs: - targets: ['public', 'private', 'ipv6-server'] # server names
其他功能
而不是使用配置文件,您可以使用 python api。了解更多信息see this code。这让你有能力 动态配置和服务器自动发现。
如果要使用systemd check examples文件夹部署此服务,则 是此服务的示例systemd unit。