Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

95 lines
4.1 KiB
PHP
Raw Permalink Normal View History

2015-11-10 11:06:03 +01:00
<?php
$graphs = [
'ceph_poolstats' => 'Pool stats',
'ceph_osdperf' => 'OSD Performance',
'ceph_df' => 'Usage',
];
foreach ($graphs as $key => $text) {
echo '<h3>' . $text . '</h3>';
$graph_array['height'] = '100';
$graph_array['width'] = '215';
2019-06-23 00:29:12 -05:00
$graph_array['to'] = \LibreNMS\Config::get('time.now');
2015-11-10 11:06:03 +01:00
$graph_array['id'] = $app['app_id'];
if ($key == 'ceph_poolstats') {
2021-03-28 17:25:30 -05:00
foreach (glob(Rrd::name($device['hostname'], ['app', 'ceph', $app['app_id'], 'pool'], '-*.rrd')) as $rrd_filename) {
2015-11-10 11:06:03 +01:00
if (preg_match("/.*-pool-(.+)\.rrd$/", $rrd_filename, $pools)) {
2019-06-23 00:29:12 -05:00
$graph_array['to'] = \LibreNMS\Config::get('time.now');
$graph_array['id'] = $app['app_id'];
2015-11-10 11:06:03 +01:00
$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>";
2019-04-11 23:26:42 -05:00
include 'includes/html/print-graphrow.inc.php';
2015-11-10 11:06:03 +01:00
echo '</td></tr>';
2019-06-23 00:29:12 -05:00
$graph_array['to'] = \LibreNMS\Config::get('time.now');
$graph_array['id'] = $app['app_id'];
2015-11-10 11:06:03 +01:00
echo '<h3>' . $pool . ' IOPS</h3>';
$graph_array['type'] = 'application_ceph_pool_iops';
$graph_array['pool'] = $pool;
echo "<tr bgcolor='$row_colour'><td colspan=5>";
2019-04-11 23:26:42 -05:00
include 'includes/html/print-graphrow.inc.php';
2015-11-10 11:06:03 +01:00
echo '</td></tr>';
}
}
2016-08-18 20:28:22 -05:00
} elseif ($key == 'ceph_osdperf') {
2021-03-28 17:25:30 -05:00
foreach (glob(Rrd::name($device['hostname'], ['app', 'ceph', $app['app_id'], 'osd'], '-*.rrd')) as $rrd_filename) {
2019-06-23 00:29:12 -05:00
$graph_array['to'] = \LibreNMS\Config::get('time.now');
$graph_array['id'] = $app['app_id'];
2015-11-10 11:06:03 +01:00
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>";
2019-04-11 23:26:42 -05:00
include 'includes/html/print-graphrow.inc.php';
2015-11-10 11:06:03 +01:00
echo '</td></tr>';
}
}
2016-08-18 20:28:22 -05:00
} elseif ($key == 'ceph_df') {
2021-03-28 17:25:30 -05:00
foreach (glob(Rrd::name($device['hostname'], ['app', 'ceph', $app['app_id'], 'df'], '-*.rrd')) as $rrd_filename) {
2015-11-10 11:06:03 +01:00
if (preg_match("/.*-df-(.+)\.rrd$/", $rrd_filename, $pools)) {
$pool = $pools[1];
if ($pool == 'c') {
echo '<h3>Cluster Usage</h3>';
2019-06-23 00:29:12 -05:00
$graph_array['to'] = \LibreNMS\Config::get('time.now');
$graph_array['id'] = $app['app_id'];
2015-11-10 11:06:03 +01:00
$graph_array['type'] = 'application_ceph_pool_df';
$graph_array['pool'] = $pool;
echo "<tr bgcolor='$row_colour'><td colspan=5>";
2019-04-11 23:26:42 -05:00
include 'includes/html/print-graphrow.inc.php';
2015-11-10 11:06:03 +01:00
echo '</td></tr>';
2016-08-18 20:28:22 -05:00
} else {
2015-11-10 11:06:03 +01:00
echo '<h3>' . $pool . ' Usage</h3>';
2019-06-23 00:29:12 -05:00
$graph_array['to'] = \LibreNMS\Config::get('time.now');
$graph_array['id'] = $app['app_id'];
2015-11-10 11:06:03 +01:00
$graph_array['type'] = 'application_ceph_pool_df';
$graph_array['pool'] = $pool;
echo "<tr bgcolor='$row_colour'><td colspan=5>";
2019-04-11 23:26:42 -05:00
include 'includes/html/print-graphrow.inc.php';
2015-11-10 11:06:03 +01:00
echo '</td></tr>';
echo '<h3>' . $pool . ' Objects</h3>';
2019-06-23 00:29:12 -05:00
$graph_array['to'] = \LibreNMS\Config::get('time.now');
$graph_array['id'] = $app['app_id'];
2015-11-10 11:06:03 +01:00
$graph_array['type'] = 'application_ceph_pool_objects';
$graph_array['pool'] = $pool;
2016-08-12 14:42:57 -05:00
2015-11-10 11:06:03 +01:00
echo "<tr bgcolor='$row_colour'><td colspan=5>";
2019-04-11 23:26:42 -05:00
include 'includes/html/print-graphrow.inc.php';
2015-11-10 11:06:03 +01:00
echo '</td></tr>';
}
}
}
}
}