Package Data | |
---|---|
Maintainer Username: | casperboone |
Maintainer Contact: | mail@casperboone.nl (Casper Boone) |
Package Create Date: | 2017-04-01 |
Package Last Update: | 2021-10-20 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-02-07 15:05:07 |
Package Statistics | |
---|---|
Total Downloads: | 2,345 |
Monthly Downloads: | 18 |
Daily Downloads: | 1 |
Total Stars: | 10 |
Total Watchers: | 4 |
Total Forks: | 5 |
Total Open Issues: | 1 |
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.
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.
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.
Please see CHANGELOG for more information what has changed recently.
$ composer test
Please see CONTRIBUTING for details.
If you discover any security related issues, please email mail@casperboone.nl instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.