{"id":15374675,"url":"https://github.com/mrtazz/yagd","last_synced_at":"2025-04-15T15:12:15.482Z","repository":{"id":17362975,"uuid":"20134704","full_name":"mrtazz/yagd","owner":"mrtazz","description":"super simple dashboard framework in PHP","archived":false,"fork":false,"pushed_at":"2016-06-21T02:39:49.000Z","size":70,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-15T15:12:06.669Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://code.mrtazz.com/yagd/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrtazz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-24T16:55:48.000Z","updated_at":"2023-07-25T13:51:57.000Z","dependencies_parsed_at":"2022-09-04T18:22:34.618Z","dependency_job_id":null,"html_url":"https://github.com/mrtazz/yagd","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtazz%2Fyagd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtazz%2Fyagd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtazz%2Fyagd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrtazz%2Fyagd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrtazz","download_url":"https://codeload.github.com/mrtazz/yagd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249094932,"owners_count":21211837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T13:59:28.949Z","updated_at":"2025-04-15T15:12:15.453Z","avatar_url":"https://github.com/mrtazz.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yagd\n\n[![Build Status](https://travis-ci.org/mrtazz/yagd.svg?branch=master)](https://travis-ci.org/mrtazz/yagd)\n[![Coverage Status](https://coveralls.io/repos/mrtazz/yagd/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/mrtazz/yagd?branch=master)\n[![Code Climate](https://codeclimate.com/github/mrtazz/yagd/badges/gpa.svg)](https://codeclimate.com/github/mrtazz/yagd)\n[![Latest Stable Version](https://poser.pugx.org/mrtazz/yagd/v/stable)](https://packagist.org/packages/mrtazz/yagd)\n[![Latest Unstable Version](https://poser.pugx.org/mrtazz/yagd/v/unstable)](https://packagist.org/packages/mrtazz/yagd) [![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT)\n\n## Overview\nYet Another Graphite Dashboard - because why not? It's heavily inspired by\n[the Etsy dashboard framework](https://github.com/etsy/dashboard) but only\nprovides a very small subset of features. If you have a lot of hosts or need\nadvanced features I'd recommend checking that out.\n\n## Look\n![yagd look](http://s3itch.unwiredcouch.com/Dashboards-20151108-214111.jpg)\n\n## Requirements\n- PHP \u003e= 5.5\n- Graphite\n\n## Installation\n- in your dashboards repo, run: `composer require mrtazz/yagd`\n- copy `config.example.php` to `config.php` and adapt it\n- write php to create your dashboards\n\n## Usage examples\n\n### Generic dashboards\nThere is a generic `Page.php` class included which can just include all\nGraphite graphs you have in an array called `$metrics` like this:\n\n```\n\u003c?php\n\n$metrics = array(\n    'carbon.agents.foo_example_com-a.committedPoints',\n    'carbon.agents.foo_example_com-a.cpuUsage',\n    'carbon.agents.foo_example_com-a.avgUpdateTime',\n    'carbon.agents.foo_example_com-a.creates',\n    'carbon.agents.foo_example_com-a.errors',\n    'carbon.agents.foo_example_com-a.metricsReceived',\n    'carbon.agents.foo_example_com-a.pointsPerUpdate',\n    'carbon.agents.foo_example_com-a.updateOperations',\n);\n\n$page = new Page($CONFIG);\n$page-\u003erenderFullPageWithMetrics($metrics);\n```\n\n### Display CollectD host data\nIf you are using collectd to gather system level graphs you can draw basic\ninformation onto a dashboard like this:\n\nConfigure hosts in your `config.php`\n\n```\n$CONFIG['hosts'] = [\n        \"foo.example.com\" =\u003e [\n            \"cpus\" =\u003e 2,\n            \"filesystems\" =\u003e [ 'root', 'var', ]\n            ],\n            \"additional_metrics\" =\u003e [\n                \"disk temp\" =\u003e [\n                \"disk temperature\" =\u003e \"collectd.foo_example_com.disktemp-ada*.current\",\n                ]\n            ],\n        ]\n    ];\n```\n\nAnd then drop something like this into e.g. `htdocs/hosts.php`:\n\n\n```\n\u003c?php\n\nrequire __DIR__ . '/../vendor/autoload.php';\n\ninclude_once(\"../config.php\");\n\nuse Yagd\\CollectdHost;\nuse Yagd\\Page;\n\n$page = new Page($CONFIG);\necho $page-\u003egetHeader($CONFIG[\"title\"],\n    $CONFIG[\"navitems\"]);\n\nforeach($CONFIG[\"hosts\"] as $host =\u003e $data) {\n\n    $fss = empty($data[\"filesystems\"]) ? [] : $data[\"filesystems\"];\n\n    $server = new CollectdHost($host, $data[\"cpus\"], $fss,\n                               $data[\"interfaces\"]);\n    $server-\u003esetGraphiteConfiguration($CONFIG[\"graphite\"][\"host\"]);\n    echo \"\u003ch2\u003e {$host} \u003c/h2\u003e\";\n    $server-\u003erender();\n}\n\necho $page-\u003egetFooter();\n\n```\n\n### Inject a select box into the navbar\nFor the host page for example you might wanna have an easy way to only show\none host. For that you can inject a select box into the header navbar like\nthis:\n\n```\n\u003c?php\n\n$selectbox = \"\";\n$selectbox .= \"\u003cform method='get' action='hosts.php' style='margin-top: 15px'class='pull-right'\u003e\";\n$selectbox .= \"   \u003cselect name='hostname' onchange='this.form.submit()'\u003e\";\n    foreach ($CONFIG[\"hosts\"] as $host =\u003e $data) {\n        $selected = ($_GET[\"hostname\"] == $host) ? \"selected\" : \"\";\n        $selectbox .= \"\u003coption value='{$host}' {$selected}\u003e{$host}\u003c/option\u003e\";\n}\n$selectbox .= \"\u003c/select\u003e\";\n$selectbox .= \"\u003c/form\u003e\";\n\n$page = new Page($CONFIG);\necho $page-\u003egetHeader($CONFIG[\"title\"],\n    $CONFIG[\"navitems\"],\n    $selectbox);\n\nif (empty($_GET[\"hostname\"])) {\n    $hosts = $CONFIG[\"hosts\"];\n} else {\n    $hosts = [ $_GET[\"hostname\"] =\u003e $CONFIG[\"hosts\"][$_GET[\"hostname\"]] ];\n}\n```\n\nThis will show the content of `$selectbox` in the header and only show the\nactually selected host (if one was selected) on the page.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrtazz%2Fyagd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrtazz%2Fyagd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrtazz%2Fyagd/lists"}