2017 © Pedro Peláez
 

symfony-bundle monitoring-bundle

Bundle for monitoring the simple parameters in yours projects

image

studiosite/monitoring-bundle

Bundle for monitoring the simple parameters in yours projects

  • Monday, April 23, 2018
  • by fromtuba
  • Repository
  • 1 Watchers
  • 0 Stars
  • 34 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 21 % Grown

The README.md

StudioSiteMonitoringBundle

Sometimes it becomes necessary to monitor some parameters using external monitoring systems (for example, zabbix). The bundle makes it very easy, (*1)

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:, (*2)

$ composer require studiosite/monitoring-bundle

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:, (*3)

<?php
// app/AppKernel.php

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new StudioSite\MonitoringBundle\StudioSiteMonitoringBundle(),
        );
    }
}

Step 3: Configuration

studio_site_monitoring:
    # path to console file for zabbix config generator
    # usually the bundle finds the desired path
    console: "%kernel.root_dir%/../bin/console"

Example of use

Consider an example service that provides values of parameters, (*4)

<?php
// AppBundle/Service/SomeService.php

class SomeService
{
    // Your magic...

    public function getSomeValue()
    {
        return 'teststring';
    }

    public function getCount()
    {
        return 100;
    }

    public function getSum($a, $b)
    {
        return $a + $b;
    }
}

The service description in DI, (*5)

services:
    app_bundle.some_service:
        class: AppBundle\Service\SomeService
        tags:
            - { name: studiosite_monitoring.parameter, method: getSomeValue, key: app.some_value }
            - { name: studiosite_monitoring.parameter, method: getCount, key: app.count }
            - { name: studiosite_monitoring.parameter, method: getSum, key: app.sum }

Now you can get parameter values, (*6)

# To see a list of available parameters:
$ php bin/console studiosite:monitoring:get

The list of available parameters:
    app.some_value
    app.count
    app.sum <a> <b>

# To get the value of the parameter:

$ php bin/console studiosite:monitoring:get app.some_value
teststring

$ php bin/console studiosite:monitoring:get app.sum 100 100
200

Generate zabbix user parameter config

The bundle can generate a configuration for all the collected parameters in zabbix userparameter format, (*7)

$ php bin/console studiosite:monitoring:zabbix /etc/zabbix/conf.d/symfony.conf
Write config to /etc/zabbix/conf.d/symfony.conf? y

$ cat /etc/zabbix/conf.d/symfony.conf
UserParameter=app.some_value[*], /var/www/dev/bin/console studiosite:monitoring:get app.some_value --no-debug -e prod
UserParameter=app.count[*], /var/www/dev/bin/console studiosite:monitoring:get app.count --no-debug -e prod
UserParameter=app.sum[*], /var/www/dev/bin/console studiosite:monitoring:get app.sum $1 $2 --no-debug -e prod

The Versions

23/04 2018

dev-master

9999999-dev https://github.com/eugenekkh/MonitoringBundle

Bundle for monitoring the simple parameters in yours projects

  Sources   Download

MIT

The Requires

 

The Development Requires

by Evgeny Kukharik

monitoring zabbix

23/04 2018

1.0.1

1.0.1.0 https://github.com/eugenekkh/MonitoringBundle

Bundle for monitoring the simple parameters in yours projects

  Sources   Download

MIT

The Requires

 

The Development Requires

by Evgeny Kukharik

monitoring zabbix

18/09 2017

1.0.0

1.0.0.0 https://github.com/eugenekkh/MonitoringBundle

Bundle for monitoring the simple parameters in yours projects

  Sources   Download

MIT

The Requires

 

The Development Requires

by Evgeny Kukharik

monitoring zabbix