2017 © Pedro Peláez
 

library yagd

Yet another graphite dashboard

image

mrtazz/yagd

Yet another graphite dashboard

  • Tuesday, June 21, 2016
  • by mrtazz
  • Repository
  • 3 Watchers
  • 8 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

yagd

Build Status Coverage Status Code Climate Latest Stable Version Latest Unstable Version MIT license, (*1)

Overview

Yet Another Graphite Dashboard - because why not? It's heavily inspired by the Etsy dashboard framework but only provides a very small subset of features. If you have a lot of hosts or need advanced features I'd recommend checking that out., (*2)

Look

yagd look, (*3)

Requirements

  • PHP >= 5.5
  • Graphite

Installation

  • in your dashboards repo, run: composer require mrtazz/yagd
  • copy config.example.php to config.php and adapt it
  • write php to create your dashboards

Usage examples

Generic dashboards

There is a generic Page.php class included which can just include all Graphite graphs you have in an array called $metrics like this:, (*4)

<?php

$metrics = array(
    'carbon.agents.foo_example_com-a.committedPoints',
    'carbon.agents.foo_example_com-a.cpuUsage',
    'carbon.agents.foo_example_com-a.avgUpdateTime',
    'carbon.agents.foo_example_com-a.creates',
    'carbon.agents.foo_example_com-a.errors',
    'carbon.agents.foo_example_com-a.metricsReceived',
    'carbon.agents.foo_example_com-a.pointsPerUpdate',
    'carbon.agents.foo_example_com-a.updateOperations',
);

$page = new Page($CONFIG);
$page->renderFullPageWithMetrics($metrics);

Display CollectD host data

If you are using collectd to gather system level graphs you can draw basic information onto a dashboard like this:, (*5)

Configure hosts in your config.php, (*6)

$CONFIG['hosts'] = [
        "foo.example.com" => [
            "cpus" => 2,
            "filesystems" => [ 'root', 'var', ]
            ],
            "additional_metrics" => [
                "disk temp" => [
                "disk temperature" => "collectd.foo_example_com.disktemp-ada*.current",
                ]
            ],
        ]
    ];

And then drop something like this into e.g. htdocs/hosts.php:, (*7)

<?php

require __DIR__ . '/../vendor/autoload.php';

include_once("../config.php");

use Yagd\CollectdHost;
use Yagd\Page;

$page = new Page($CONFIG);
echo $page->getHeader($CONFIG["title"],
    $CONFIG["navitems"]);

foreach($CONFIG["hosts"] as $host => $data) {

    $fss = empty($data["filesystems"]) ? [] : $data["filesystems"];

    $server = new CollectdHost($host, $data["cpus"], $fss,
                               $data["interfaces"]);
    $server->setGraphiteConfiguration($CONFIG["graphite"]["host"]);
    echo "<h2> {$host} </h2>";
    $server->render();
}

echo $page->getFooter();

Inject a select box into the navbar

For the host page for example you might wanna have an easy way to only show one host. For that you can inject a select box into the header navbar like this:, (*8)

<?php

$selectbox = "";
$selectbox .= "

"; $selectbox .= " "; $selectbox .= "
"; $page = new Page($CONFIG); echo $page->getHeader($CONFIG["title"], $CONFIG["navitems"], $selectbox); if (empty($_GET["hostname"])) { $hosts = $CONFIG["hosts"]; } else { $hosts = [ $_GET["hostname"] => $CONFIG["hosts"][$_GET["hostname"]] ]; }

This will show the content of $selectbox in the header and only show the actually selected host (if one was selected) on the page., (*9)

The Versions

21/06 2016

dev-master

9999999-dev http://code.mrtazz.com/yagd

Yet another graphite dashboard

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-filter >=0.11.0

 

The Development Requires

dashboard graphite graphs

14/12 2015

1.0.1

1.0.1.0 http://code.mrtazz.com/yagd

Yet another graphite dashboard

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

dashboard graphite graphs

14/12 2015

1.0.0

1.0.0.0 http://code.mrtazz.com/yagd

Yet another graphite dashboard

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

dashboard graphite graphs