1<?php 2 3$graphs = [ 4 'ceph_poolstats' => 'Pool stats', 5 'ceph_osdperf' => 'OSD Performance', 6 'ceph_df' => 'Usage', 7]; 8 9foreach ($graphs as $key => $text) { 10 echo '<h3>' . $text . '</h3>'; 11 $graph_array['height'] = '100'; 12 $graph_array['width'] = '215'; 13 $graph_array['to'] = \LibreNMS\Config::get('time.now'); 14 $graph_array['id'] = $app['app_id']; 15 16 if ($key == 'ceph_poolstats') { 17 foreach (glob(Rrd::name($device['hostname'], ['app', 'ceph', $app['app_id'], 'pool'], '-*.rrd')) as $rrd_filename) { 18 if (preg_match("/.*-pool-(.+)\.rrd$/", $rrd_filename, $pools)) { 19 $graph_array['to'] = \LibreNMS\Config::get('time.now'); 20 $graph_array['id'] = $app['app_id']; 21 $pool = $pools[1]; 22 echo '<h3>' . $pool . ' Reads/Writes</h3>'; 23 $graph_array['type'] = 'application_ceph_pool_io'; 24 $graph_array['pool'] = $pool; 25 26 echo "<tr bgcolor='$row_colour'><td colspan=5>"; 27 include 'includes/html/print-graphrow.inc.php'; 28 echo '</td></tr>'; 29 30 $graph_array['to'] = \LibreNMS\Config::get('time.now'); 31 $graph_array['id'] = $app['app_id']; 32 echo '<h3>' . $pool . ' IOPS</h3>'; 33 $graph_array['type'] = 'application_ceph_pool_iops'; 34 $graph_array['pool'] = $pool; 35 36 echo "<tr bgcolor='$row_colour'><td colspan=5>"; 37 include 'includes/html/print-graphrow.inc.php'; 38 echo '</td></tr>'; 39 } 40 } 41 } elseif ($key == 'ceph_osdperf') { 42 foreach (glob(Rrd::name($device['hostname'], ['app', 'ceph', $app['app_id'], 'osd'], '-*.rrd')) as $rrd_filename) { 43 $graph_array['to'] = \LibreNMS\Config::get('time.now'); 44 $graph_array['id'] = $app['app_id']; 45 if (preg_match("/.*-osd-(.+)\.rrd$/", $rrd_filename, $osds)) { 46 $osd = $osds[1]; 47 echo '<h3>' . $osd . ' Latency</h3>'; 48 $graph_array['type'] = 'application_ceph_osd_performance'; 49 $graph_array['osd'] = $osd; 50 51 echo "<tr bgcolor='$row_colour'><td colspan=5>"; 52 include 'includes/html/print-graphrow.inc.php'; 53 echo '</td></tr>'; 54 } 55 } 56 } elseif ($key == 'ceph_df') { 57 foreach (glob(Rrd::name($device['hostname'], ['app', 'ceph', $app['app_id'], 'df'], '-*.rrd')) as $rrd_filename) { 58 if (preg_match("/.*-df-(.+)\.rrd$/", $rrd_filename, $pools)) { 59 $pool = $pools[1]; 60 if ($pool == 'c') { 61 echo '<h3>Cluster Usage</h3>'; 62 $graph_array['to'] = \LibreNMS\Config::get('time.now'); 63 $graph_array['id'] = $app['app_id']; 64 $graph_array['type'] = 'application_ceph_pool_df'; 65 $graph_array['pool'] = $pool; 66 67 echo "<tr bgcolor='$row_colour'><td colspan=5>"; 68 include 'includes/html/print-graphrow.inc.php'; 69 echo '</td></tr>'; 70 } else { 71 echo '<h3>' . $pool . ' Usage</h3>'; 72 $graph_array['to'] = \LibreNMS\Config::get('time.now'); 73 $graph_array['id'] = $app['app_id']; 74 $graph_array['type'] = 'application_ceph_pool_df'; 75 $graph_array['pool'] = $pool; 76 77 echo "<tr bgcolor='$row_colour'><td colspan=5>"; 78 include 'includes/html/print-graphrow.inc.php'; 79 echo '</td></tr>'; 80 81 echo '<h3>' . $pool . ' Objects</h3>'; 82 $graph_array['to'] = \LibreNMS\Config::get('time.now'); 83 $graph_array['id'] = $app['app_id']; 84 $graph_array['type'] = 'application_ceph_pool_objects'; 85 $graph_array['pool'] = $pool; 86 87 echo "<tr bgcolor='$row_colour'><td colspan=5>"; 88 include 'includes/html/print-graphrow.inc.php'; 89 echo '</td></tr>'; 90 } 91 } 92 } 93 } 94} 95