Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
this updates the README to include usage instructions for the changes to the
Page class.
  • Loading branch information
mrtazz committed Nov 18, 2015
1 parent 746e945 commit 9fe9b21
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ advanced features I'd recommend checking that out.
- Graphite

## Installation
- clone the repo
- 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` file included which will just include all
Graphite graphs you have in an array called `$metrics`:
There is a generic `Page.php` class included which can just include all
Graphite graphs you have in an array called `$metrics` like this:

```
<?php
Expand All @@ -40,7 +41,8 @@ $metrics = array(
'carbon.agents.foo_example_com-a.updateOperations',
);
include_once("../phplib/page.php");
$page = new Page($CONFIG);
$page->render_full_page_with_metrics($metrics);
```

### Display CollectD host data
Expand Down Expand Up @@ -71,9 +73,16 @@ And then drop something like this into e.g. `htdocs/hosts.php`:
```
<?php
require __DIR__ . '/../vendor/autoload.php';
include_once("../config.php");
require_once "../phplib/CollectdHost.php";
include_once("../phplib/header.php");
use Yagd\CollectdHost;
use Yagd\Page;
$page = new Page($CONFIG);
echo $page->get_header($CONFIG["title"],
$CONFIG["navitems"]);
foreach($CONFIG["hosts"] as $host => $data) {
Expand All @@ -86,7 +95,7 @@ foreach($CONFIG["hosts"] as $host => $data) {
$server->render();
}
include_once("../phplib/footer.php");
echo $page->get_footer();
```

Expand All @@ -108,7 +117,10 @@ $selectbox .= " <select name='hostname' onchange='this.form.submit()'>";
$selectbox .= "</select>";
$selectbox .= "</form>";
include_once("../phplib/header.php");
$page = new Page($CONFIG);
echo $page->get_header($CONFIG["title"],
$CONFIG["navitems"],
$selectbox);
if (empty($_GET["hostname"])) {
$hosts = $CONFIG["hosts"];
Expand Down

0 comments on commit 9fe9b21

Please sign in to comment.