Git Product home page Git Product logo

laravel-zabbix-graph's Introduction

๐Ÿ“ˆ Laravel Zabbix Graph

Latest Version on Packagist Software License StyleCI Build Status SensioLabsInsight Quality Score Code Coverage

Get a graph from Zabbix to display on a webpage or to save to a file. If you are not using Laravel, then please check out this repository.

Installation

You can install the package via composer:

composer require casperboone/laravel-zabbix-graph

You must install the service provider:

// config/app.php
'providers' => [
    ...
    CasperBoone\LaravelZabbixGraph\ZabbixGraphServiceProvider::class,
],

If you want to, you can also add the facade:

// config/app.php
'aliases' => [
    ...
    'ZabbixGraph' => CasperBoone\LaravelZabbixGraph\ZabbixGraphFacade::class,
],

You can publish the config file with (the default config file will suffice in most cases):

php artisan vendor:publish --provider="CasperBoone\LaravelZabbixGraph\ZabbixGraphServiceProvider"

Make sure to update the config file or your .env file with the details of your Zabbix server.

Usage

Output a Zabbix graph to an HTTP endpoint (using method injection):

<?php

namespace App\Http\Controllers;

use Carbon\Carbon;
use Illuminate\Http\Request;
use CasperBoone\ZabbixGraph\ZabbixGraph;

class GraphsController extends Controller
{
    public function show(Request $request, ZabbixGraph $zabbixGraph, $id)
    {
        $graph = $zabbixGraph->startTime(Carbon::now()->subDay())
            ->width($request->input('width', 1000))
            ->height($request->input('height', 200))
            ->find($id);

        return response($graph)
            ->header('Content-Type', 'image/png');
    }
}

You can also use the facade, if you prefer:

<?php

namespace App\Http\Controllers;

use ZabbixGraph;
use Carbon\Carbon;
use Illuminate\Http\Request;

class GraphsController extends Controller
{
    public function show(Request $request, $id)
    {
        $graph = ZabbixGraph::startTime(Carbon::now()->subDay())
            ->width($request->input('width', 1000))
            ->height($request->input('height', 200))
            ->find($id);

        return response($graph)
            ->header('Content-Type', 'image/png');
    }
}

For all available methods and options, see casperboone/zabbix-graph.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

laravel-zabbix-graph's People

Contributors

casperboone avatar yvesnetalis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

laravel-zabbix-graph's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.