Add Ceph support

This commit is contained in:
Mark Schouten
2015-11-10 11:06:03 +01:00
parent 923990d451
commit a4eb4391c5
8 changed files with 319 additions and 1 deletions

View File

@@ -0,0 +1,27 @@
<?php
$ds_in = 'apply_ms';
$ds_out = 'commit_ms';
$in_text = 'Apply';
$out_text = 'Commit';
$rrd = join('-', array('app', 'ceph', $vars['id'], 'osd', $vars['osd'])).'.rrd';
$ceph_osd_rrd = join('/', array($config['rrd_dir'], $device['hostname'], $rrd));
if (is_file($ceph_osd_rrd)) {
$rrd_filename = $ceph_osd_rrd;
}
$colour_area_in = 'FF3300';
$colour_line_in = 'FF0000';
$colour_area_out = 'FF6633';
$colour_line_out = 'CC3300';
$colour_area_in_max = 'FF6633';
$colour_area_out_max = 'FF9966';
$unit_text = 'Miliseconds';
require 'includes/graphs/generic_duplex.inc.php';

View File

@@ -0,0 +1,58 @@
<?php
require 'includes/graphs/common.inc.php';
$rrd = join('-', array('app', 'ceph', $vars['id'], 'df', $vars['pool'])).'.rrd';
$ceph_pool_rrd = join('/', array($config['rrd_dir'], $device['hostname'], $rrd));
if (is_file($ceph_pool_rrd)) {
$rrd_filename = $ceph_pool_rrd;
}
$rrd_options .= ' -l 0 -b 1024 ';
$rrd_options .= " 'COMMENT:Bytes Min Cur Max\\n'";
$usedc = 'CC0000';
$availc = '008C00';
$totalc = 'e5e5e5';
if ($vars['pool'] != "c") {
$rrd_options .= " DEF:poolfree=$rrd_filename:avail:AVERAGE ";
$rrd_options .= " DEF:poolused=$rrd_filename:used:AVERAGE ";
$rrd_options .= " CDEF:pooltotal=poolused,poolfree,+ ";
$rrd_options .= " LINE1:poolused#".$usedc;
$rrd_options .= " LINE1:poolfree#".$availc.'::STACK';
$rrd_options .= " AREA:poolused#".$usedc.'30:Used ';
$rrd_options .= " GPRINT:poolused:MIN:%7.2lf%sB";
$rrd_options .= ' GPRINT:poolused:LAST:%7.2lf%sB';
$rrd_options .= ' GPRINT:poolused:MAX:%7.2lf%sB\n';
$rrd_options .= " AREA:poolfree#".$availc.'30:Free:STACK';
$rrd_options .= " GPRINT:poolfree:MIN:%7.2lf%sB";
$rrd_options .= ' GPRINT:poolfree:LAST:%7.2lf%sB';
$rrd_options .= ' GPRINT:poolfree:MAX:%7.2lf%sB\n';
$rrd_options .= " LINE1:pooltotal#000000:Total";
$rrd_options .= " GPRINT:pooltotal:MIN:%6.2lf%sB";
$rrd_options .= " GPRINT:pooltotal:LAST:%7.2lf%sB";
$rrd_options .= ' GPRINT:pooltotal:MAX:%7.2lf%sB\n';
} else {
$rrd_options .= " DEF:poolsize=$rrd_filename:avail:AVERAGE ";
$rrd_options .= " DEF:poolused=$rrd_filename:used:AVERAGE ";
$rrd_options .= " DEF:poolfree=$rrd_filename:objects:AVERAGE ";
$rrd_options .= " LINE1:poolused#".$usedc;
$rrd_options .= " AREA:poolused#".$usedc.'30:Used';
$rrd_options .= " GPRINT:poolused:MIN:%7.2lf%sB";
$rrd_options .= ' GPRINT:poolused:LAST:%7.2lf%sB';
$rrd_options .= ' GPRINT:poolused:MAX:%7.2lf%sB\n';
$rrd_options .= " AREA:poolfree#".$availc.'30:Free:STACK';
$rrd_options .= " GPRINT:poolfree:MIN:%7.2lf%sB";
$rrd_options .= ' GPRINT:poolfree:LAST:%7.2lf%sB';
$rrd_options .= ' GPRINT:poolfree:MAX:%7.2lf%sB\n';
$rrd_options .= " LINE1:poolsize#000000:Total";
$rrd_options .= " GPRINT:poolsize:MIN:%6.2lf%sB";
$rrd_options .= ' GPRINT:poolsize:LAST:%7.2lf%sB';
$rrd_options .= ' GPRINT:poolsize:MAX:%7.2lf%sB\n';
}

View File

@@ -0,0 +1,28 @@
<?php
$ds_in = 'rbytes';
$in_text = 'Read';
$ds_out = 'wrbytes';
$out_text = 'Write';
$format = 'bytes';
$rrd = join('-', array('app', 'ceph', $vars['id'], 'pool', $vars['pool'])).'.rrd';
$ceph_pool_rrd = join('/', array($config['rrd_dir'], $device['hostname'], $rrd));
if (is_file($ceph_pool_rrd)) {
$rrd_filename = $ceph_pool_rrd;
}
$colour_area_in = 'FF3300';
$colour_line_in = 'FF0000';
$colour_area_out = 'FF6633';
$colour_line_out = 'CC3300';
$colour_area_in_max = 'FF6633';
$colour_area_out_max = 'FF9966';
$unit_text = 'Bytes I/O';
require 'includes/graphs/generic_duplex.inc.php';

View File

@@ -0,0 +1,26 @@
<?php
$scale_min = 0;
require 'includes/graphs/common.inc.php';
$rrd = join('-', array('app', 'ceph', $vars['id'], 'pool', $vars['pool'])).'.rrd';
$ceph_pool_rrd = join('/', array($config['rrd_dir'], $device['hostname'], $rrd));
if (is_file($ceph_pool_rrd)) {
$rrd_filename = $ceph_pool_rrd;
}
$ds = 'ops';
$colour_area = 'EEEEEE';
$colour_line = '36393D';
$colour_area_max = 'FFEE99';
$graph_max = 1;
$unit_text = 'Operations';
require 'includes/graphs/generic_simplex.inc.php';

View File

@@ -0,0 +1,24 @@
<?php
$scale_min = 0;
require 'includes/graphs/common.inc.php';
$rrd = join('-', array('app', 'ceph', $vars['id'], 'df', $vars['pool'])).'.rrd';
$ceph_pool_rrd = join('/', array($config['rrd_dir'], $device['hostname'], $rrd));
if (is_file($ceph_pool_rrd)) {
$rrd_filename = $ceph_pool_rrd;
}
$ds = 'objects';
$colour_area = 'EEEEEE';
$colour_line = '36393D';
$colour_area_max = 'FFEE99';
$unit_text = 'Objects';
require 'includes/graphs/generic_simplex.inc.php';

View File

@@ -0,0 +1,85 @@
<?php
$graphs = array(
'ceph_poolstats' => 'Pool stats',
'ceph_osdperf' => 'OSD Performance',
'ceph_df' => 'Usage',
);
$rrddir = $config['rrd_dir'].'/'.$device['hostname'];
foreach ($graphs as $key => $text) {
echo '<h3>'.$text.'</h3>';
$graph_array['height'] = '100';
$graph_array['width'] = '215';
$graph_array['to'] = $config['time']['now'];
$graph_array['id'] = $app['app_id'];
if ($key == "ceph_poolstats") {
foreach (glob($rrddir."/app-ceph-".$app['app_id']."-pool-*") as $rrd_filename) {
if (preg_match("/.*-pool-(.+)\.rrd$/", $rrd_filename, $pools)) {
$pool = $pools[1];
echo '<h3>'.$pool.' Reads/Writes</h3>';
$graph_array['type'] = 'application_ceph_pool_io';
$graph_array['pool'] = $pool;
echo "<tr bgcolor='$row_colour'><td colspan=5>";
include 'includes/print-graphrow.inc.php';
echo '</td></tr>';
echo '<h3>'.$pool.' IOPS</h3>';
$graph_array['type'] = 'application_ceph_pool_iops';
$graph_array['pool'] = $pool;
echo "<tr bgcolor='$row_colour'><td colspan=5>";
include 'includes/print-graphrow.inc.php';
echo '</td></tr>';
}
}
} elseif ($key == "ceph_osdperf") {
foreach (glob($rrddir."/app-ceph-".$app['app_id']."-osd-*") as $rrd_filename) {
if (preg_match("/.*-osd-(.+)\.rrd$/", $rrd_filename, $osds)) {
$osd = $osds[1];
echo '<h3>'.$osd.' Latency</h3>';
$graph_array['type'] = 'application_ceph_osd_performance';
$graph_array['osd'] = $osd;
echo "<tr bgcolor='$row_colour'><td colspan=5>";
include 'includes/print-graphrow.inc.php';
echo '</td></tr>';
}
}
} elseif ($key == "ceph_df") {
foreach (glob($rrddir."/app-ceph-".$app['app_id']."-df-*") as $rrd_filename) {
if (preg_match("/.*-df-(.+)\.rrd$/", $rrd_filename, $pools)) {
$pool = $pools[1];
if ($pool == "c") {
echo '<h3>Cluster Usage</h3>';
$graph_array['type'] = 'application_ceph_pool_df';
$graph_array['pool'] = $pool;
echo "<tr bgcolor='$row_colour'><td colspan=5>";
include 'includes/print-graphrow.inc.php';
echo '</td></tr>';
} else {
echo '<h3>'.$pool.' Usage</h3>';
$graph_array['type'] = 'application_ceph_pool_df';
$graph_array['pool'] = $pool;
echo "<tr bgcolor='$row_colour'><td colspan=5>";
include 'includes/print-graphrow.inc.php';
echo '</td></tr>';
echo '<h3>'.$pool.' Objects</h3>';
$graph_array['type'] = 'application_ceph_pool_objects';
$graph_array['pool'] = $pool;
echo "<tr bgcolor='$row_colour'><td colspan=5>";
include 'includes/print-graphrow.inc.php';
echo '</td></tr>';
}
}
}
}
}