machour/yii2-prometheus
最新稳定版本:2.0.1
Composer 安装命令:
composer require machour/yii2-prometheus
包简介
Prometheus exporter for Yii 2
README 文档
README
Prometheus Extension for Yii 2
This extension provides a Prometheus exporter component for Yii framework 2.0 applications.
This extension uses the textfile collector of Node Exporter for Prometheus.
Installation
The preferred way to install this extension is through composer.
composer require --prefer-dist machour/yii2-prometheus
Configuration
In order to exploit the metrics files generated by this extension, you must run the node exporter using the
--collector.textfile.directory flag, and point it to a valid directory.
If using systemd to manage your scrappers, your node_exporter.service file may look something like this:
node_exporter.service
[Unit]
Description=Node Exporter
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
ExecStart=/usr/local/bin/node_exporter --collector.textfile.directory /var/lib/node_exporter/textfile_collector --web.listen-address="127.0.0.1:9100"
[Install]
WantedBy=default.target
Once the extension is installed, simply modify your application configuration as follows:
return [ 'components' => [ 'prometheusExporter' => [ 'class' => 'machour\yii2\prometheus\components\Exporter', // Point this to your collector directory. Defaults to '/var/lib/node_exporter/textfile_collector/' // 'collectorDir' => '/var/lib/node_exporter/textfile_collector/', // The default prom file to create if not specified in exportMetric() // 'defaultFile' => 'yii2-prometheus-exporter.prom', ], // ... ], ... ];
统计信息
- 总下载量: 3.11k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2021-10-18