承接 mcrinquand/zabbix_monitoring 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

mcrinquand/zabbix_monitoring

Composer 安装命令:

composer require mcrinquand/zabbix_monitoring

包简介

README 文档

README

This repository aims to provide easy way to implement monitoring with Zabbix.

Installation

Add the bundle as dependency with Composer

$ php composer.phar require mcrinquand/zabbix_monitoring

Enable the bundle in the kernel

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = [
        // ...
        new MCD\ZabbixMonitoringBundle\MCDZabbixMonitoringBundle(),
    ];
}

Configure

Then You have to configure the bundle.

mcd_zabbix_monitoring:
    default: zabbix
    collectors:
        zabbix:
            type: zabbix
            prefix: apache
            host: localhost
            port: 10051

Type is zabbix only for the moment.

Usage

It allows you to monitor data like a counter.

The monitoring is split in two part : first is aggregation of data and then sending of data.

Record data

For the first part, you have to create a class to monitor your data. This class must extends MCD\ZabbixMonitoringBundle\Zabbix\Monitoring\AbstractMonitoring and be defined as service. It expect a filepath into constructor. This parameter is the path to the file where the data will be stored waiting to be send to your Zabbix server.

Here's an example of visitor monitorer.

<?php

namespace AppBundle\Monitorer;

use MCD\ZabbixMonitoringBundle\Zabbix\Monitoring\AbstractMonitoring;

class VisitorMonitorer extends AbstractMonitoring
{
}

Set VisitorMonitorer as service with filepath to save data :

services:
    AppBundle\Monitorer\VisitorMonitorer:
        class: 'AppBundle\Monitorer\VisitorMonitorer'
        public: true
        arguments:
            $filepath: '%kernel.root_dir%/../var/monitoring/visitor.txt'

Record one ot four visitors :

$monitorer = $this->get('AppBundle\Monitorer\VisitorMonitorer');
// record one visitor
$monitorer->incrementValue();

// record four visitor
$monitorer->incrementValue(4);

Send data

Then you can define the task to send monitored data to your Zabbix server.

You have to define a Command make it extends MCD\ZabbixMonitoringBundle\Zabbix\Command\AbstractMonitoringCommand and declare it as service. Give it the Monitoring class you want to send as second argument.

Then you can declare the command into you crontab to send value to Zabbix.

When the command send data, it "clear" the current count.

Authors

The bundle was originally created by Matthieu Crinquand. See the list of contributors.

This bundle is inspired by the beberlei/metrics bundle.

统计信息

  • 总下载量: 19
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-10-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固