Skip to content

Commit

Permalink
Merge pull request #15 from simonmeggle/crosshair
Browse files Browse the repository at this point in the history
Added SharedCrosshair option
  • Loading branch information
Griesbacher authored Oct 19, 2017
2 parents 05324a9 + 8787ca2 commit 2a3fec6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion histou/grafana/dashboard/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ abstract class Dashboard
@param string $title name of the dashboard.
@return null
**/
public function __construct($title)
public function __construct($title, $sharedCrosshair)
{
$this->data['title'] = $title;
$this->data['sharedCrosshair'] = $sharedCrosshair;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions histou/grafana/dashboard/dashboardelasticsearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ class DashboardElasticsearch extends Dashboard
@param string $title name of the dashboard.
@return null
**/
public function __construct($title)
public function __construct($title, $sharedCrosshair)
{
parent::__construct($title);
parent::__construct($title,$sharedCrosshair);
}

public function addAnnotation($name, $query, $title, $text, $tags, $iconColor = '#751975', $lineColor = '#751975', $datasource = ELASTICSEARCH_INDEX, $enabled = SHOW_ANNOTATION, $iconSize = 13)
Expand Down
8 changes: 4 additions & 4 deletions histou/grafana/dashboard/dashboardfactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ class DashboardFactory
Returns depending on the Database_Type a dashboard.
@returns a dashboard
**/
public static function generateDashboard($title)
public static function generateDashboard($title, $sharedCrosshair=false)
{
if (DATABASE_TYPE == INFLUXDB) {
return new \histou\grafana\dashboard\DashboardInfluxDB($title);
return new \histou\grafana\dashboard\DashboardInfluxDB($title, $sharedCrosshair);
} elseif (DATABASE_TYPE == ELASTICSEARCH) {
return new \histou\grafana\dashboard\DashboardElasticsearch($title);
return new \histou\grafana\dashboard\DashboardElasticsearch($title, $sharedCrosshair);
} else {
throw new \InvalidArgumentException("The given Database is unkown:".DATABASE_TYPE);
}
}
}
}
4 changes: 2 additions & 2 deletions histou/grafana/dashboard/dashboardinfluxdb.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class DashboardInfluxDB extends Dashboard
@param string $title name of the dashboard.
@return null
**/
public function __construct($title)
public function __construct($title, $sharedCrosshair)
{
parent::__construct($title);
parent::__construct($title,$sharedCrosshair);
}

public function addAnnotation($name, $query, $title, $text, $tags, $iconColor = '#751975', $lineColor = '#751975', $datasource = INFLUXDB_DB, $enabled = SHOW_ANNOTATION, $iconSize = 13)
Expand Down
2 changes: 1 addition & 1 deletion templates/default/check_sakuli.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
$caseColors = array ('#DEEBF7','#C6DBEF','#9ECAE1','#6BAED6','#4292C6','#2171B5','#08519C','#08306B');
$stepColors = array ('#9E0142','#D53E4F','#F46D43','#FDAE61','#FEE08B','#E6F598','#ABDDA4','#66C2A5','#3288BD','#5E4FA2');

$dashboard = \histou\grafana\dashboard\DashboardFactory::generateDashboard($perfData['host'].' '.$perfData['service']);
$dashboard = \histou\grafana\dashboard\DashboardFactory::generateDashboard($perfData['host'].' '.$perfData['service'], true);
$dashboard->addDefaultAnnotations($perfData['host'], $perfData['service']);
$dashboard->addAnnotation(
"errors",
Expand Down

0 comments on commit 2a3fec6

Please sign in to comment.