Search by

robo-finance / grafana-table-reports

dmitrjuk

There is no license information available for the latest version (v0.3) of this package.

This package's canonical repository appears to be gone and the package has been frozen as a result. Email us for help if needed.

Package info

github.com/RoboFinance/grafana-table-reports

pkg:composer/robo-finance/grafana-table-reports

Statistics

Installs: 4 674

Dependents: 0

Suggesters: 0

Stars: 4

Open Issues: 1

v0.3 2021-04-20 04:26 UTC

This package is auto-updated.

Last update: 2022-02-20 06:23:48 UTC


README

The package uses Grafana API to export table data as raw array or csv. Optimized to Laravel 5.5+ and framework-independent.

Installation

composer require robo-finance/grafana-table-reports

Configuration Laravel 5.5+

php artisan vendor:publish --provider="RoboFinance\GrafanaTableReporter\Laravel\GrafanaTableReporterServiceProvider"

See and edit the following in grafana_table_reporter.php or kindly use .env variables:

[
      'base_url' => env('GRAFANA_TABLE_REPORTER_BASE_URL', 'https://test.com'), // Grafana base url
      'api_token' => env('GRAFANA_TABLE_REPORTER_API_TOKEN', '') //Grafana Api  token
]

Using with Laravel

class IndexController extends Controller
{
    public function index(GrafanaTableReporter $reporter)
    {
        $reporter->getData(now()->subDays(30), now(), 'tiTI4O2ic', 21);
        ...

How to use code as framework-independent

$reporter = new GrafanaTableReporter($baseUrl, $apiToken);
$from = \Carbon\Carbon::now()->subDays(10);
$to = \Carbon\Carbon::now();
$panelId = 1;
$format = 'csv-resource';
$dashboardId = 'tiTI4O2ic';
$reporter->getData($from, $to, $dashboardId, $panelId, $format);

Required parameters

License

Source code is release under MIT license. Read LICENSE file for more information.