定制 machour/yii2-prometheus 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

machour/yii2-prometheus

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.

Latest Stable Version Total Downloads Build Status

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.93k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2021-10-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固