Improve testAction

Add charts to test logarithmic scale, use less annoying colors
This commit is contained in:
Matthias Jentsch 2015-01-13 18:26:39 +01:00
parent 76d3e5435f
commit be7e3f98e9
1 changed files with 21 additions and 17 deletions

View File

@ -42,7 +42,7 @@ class Monitoring_ChartController extends Controller
$chart->drawLines( $chart->drawLines(
array( array(
'label' => 'Random 1', 'label' => 'Random 1',
'color' => 'red', 'color' => '#F56',
'data' => $data1, 'data' => $data1,
'showPoints' => true 'showPoints' => true
) )
@ -50,7 +50,7 @@ class Monitoring_ChartController extends Controller
$chart->drawLines( $chart->drawLines(
array( array(
'label' => 'Random 2', 'label' => 'Random 2',
'color' => 'blue', 'color' => '#fa4',
'data' => $data2, 'data' => $data2,
'showPoints' => true 'showPoints' => true
) )
@ -58,7 +58,7 @@ class Monitoring_ChartController extends Controller
$chart->drawLines( $chart->drawLines(
array( array(
'label' => 'Random 3', 'label' => 'Random 3',
'color' => 'green', 'color' => '#4b7',
'data' => $data3, 'data' => $data3,
'showPoints' => true 'showPoints' => true
) )
@ -81,7 +81,7 @@ class Monitoring_ChartController extends Controller
$chart->drawLines( $chart->drawLines(
array( array(
'label' => 'f(x): sign(x) * 10^|x|', 'label' => 'f(x): sign(x) * 10^|x|',
'color' => 'red', 'color' => '#F56',
'data' => $data, 'data' => $data,
'showPoints' => true 'showPoints' => true
) )
@ -103,7 +103,7 @@ class Monitoring_ChartController extends Controller
$chart->drawLines( $chart->drawLines(
array( array(
'label' => 'f(x): sign(x) * 10^|x|', 'label' => 'f(x): sign(x) * 10^|x|',
'color' => 'red', 'color' => '#F56',
'data' => $data, 'data' => $data,
'showPoints' => true 'showPoints' => true
) )
@ -119,7 +119,7 @@ class Monitoring_ChartController extends Controller
$data1 = array(); $data1 = array();
$data2 = array(); $data2 = array();
$data3 = array(); $data3 = array();
for ($i = 0; $i < 25; $i++) { for ($i = 0; $i < 50; $i++) {
$data3[] = array('Label ' . $i, rand(0, 30)); $data3[] = array('Label ' . $i, rand(0, 30));
} }
@ -127,13 +127,13 @@ class Monitoring_ChartController extends Controller
$this->chart->drawLines( $this->chart->drawLines(
array( array(
'label' => 'Nr of outtakes', 'label' => 'Nr of outtakes',
'color' => 'red', 'color' => '#F56',
'width' => '5', 'width' => '5',
'data' => $data 'data' => $data
), array( ), array(
'label' => 'Some line', 'label' => 'Some line',
'color' => 'blue', 'color' => '#fa4',
'width' => '4', 'width' => '4',
'data' => $data3, 'data' => $data3,
@ -144,7 +144,7 @@ class Monitoring_ChartController extends Controller
$this->chart->drawBars( $this->chart->drawBars(
array( array(
'label' => 'A big amount of data', 'label' => 'A big amount of data',
'color' => 'green', 'color' => '#4b7',
'data' => $data3, 'data' => $data3,
'showPoints' => true 'showPoints' => true
) )
@ -280,18 +280,15 @@ class Monitoring_ChartController extends Controller
$upBars = array(); $upBars = array();
$downBars = array(); $downBars = array();
$unreachableBars = array(); $unreachableBars = array();
foreach ($query as $hostgroup) { for ($i = 0; $i < 50; $i++) {
$upBars[] = array( $upBars[] = array(
$hostgroup->hostgroup, (string)$i, rand(1, 200), rand(1, 200)
$hostgroup->hosts_up
); );
$downBars[] = array( $downBars[] = array(
$hostgroup->hostgroup, (string)$i, rand(1, 200), rand(1, 200)
$hostgroup->hosts_down_unhandled
); );
$unreachableBars[] = array( $unreachableBars[] = array(
$hostgroup->hostgroup, (string)$i, rand(1, 200), rand(1, 200)
$hostgroup->hosts_unreachable_unhandled
); );
} }
$tooltip = mt('monitoring', '<b>{title}:</b><br> {value} of {sum} hosts are {label}'); $tooltip = mt('monitoring', '<b>{title}:</b><br> {value} of {sum} hosts are {label}');
@ -367,7 +364,14 @@ class Monitoring_ChartController extends Controller
(int) $query->hosts_unreachable_unhandled, (int) $query->hosts_unreachable_unhandled,
(int) $query->hosts_pending (int) $query->hosts_pending
), ),
'colors' => array('#44bb77', '#ff4444', '#ff0000', '#E066FF', '#f099FF', '#fefefe'), 'colors' => array(
'#44bb77', // 'Ok'
'#ff4444', // 'Warning'
'#ff0000', // 'WarningHandled'
'#E066FF',
'#f099FF',
'#fefefe'
),
'labels'=> array( 'labels'=> array(
(int) $query->hosts_up . mt('monitoring', ' Up Hosts'), (int) $query->hosts_up . mt('monitoring', ' Up Hosts'),
(int) $query->hosts_down_handled . mt('monitoring', ' Down Hosts (Handled)'), (int) $query->hosts_down_handled . mt('monitoring', ' Down Hosts (Handled)'),