'Pool stats',
    'ceph_osdperf'      => 'OSD Performance',
    'ceph_df'           => 'Usage',
);
foreach ($graphs as $key => $text) {
    echo '
'.$text.'
';
    $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(rrd_name($device['hostname'], array('app', 'ceph', $app['app_id'], 'pool'), '-*.rrd')) as $rrd_filename) {
            if (preg_match("/.*-pool-(.+)\.rrd$/", $rrd_filename, $pools)) {
                $graph_array['to']     = $config['time']['now'];
                $graph_array['id']     = $app['app_id'];
                $pool = $pools[1];
                echo ''.$pool.' Reads/Writes
';
                $graph_array['type']   = 'application_ceph_pool_io';
                $graph_array['pool']   = $pool;
                echo "| ";
                include 'includes/print-graphrow.inc.php';
                echo ' | 
';
                $graph_array['to']     = $config['time']['now'];
                $graph_array['id']     = $app['app_id'];
                echo ''.$pool.' IOPS
';
                $graph_array['type']   = 'application_ceph_pool_iops';
                $graph_array['pool']   = $pool;
                echo "| ";
                include 'includes/print-graphrow.inc.php';
                echo ' | 
';
            }
        }
    } elseif ($key == "ceph_osdperf") {
        foreach (glob(rrd_name($device['hostname'], array('app', 'ceph', $app['app_id'], 'osd'), '-*.rrd')) as $rrd_filename) {
            $graph_array['to']     = $config['time']['now'];
            $graph_array['id']     = $app['app_id'];
            if (preg_match("/.*-osd-(.+)\.rrd$/", $rrd_filename, $osds)) {
                $osd = $osds[1];
                echo ''.$osd.' Latency
';
                $graph_array['type']   = 'application_ceph_osd_performance';
                $graph_array['osd']    = $osd;
                echo "| ";
                include 'includes/print-graphrow.inc.php';
                echo ' | 
';
            }
        }
    } elseif ($key == "ceph_df") {
        foreach (glob(rrd_name($device['hostname'], array('app', 'ceph', $app['app_id'], 'df'), '-*.rrd')) as $rrd_filename) {
            if (preg_match("/.*-df-(.+)\.rrd$/", $rrd_filename, $pools)) {
                $pool = $pools[1];
                if ($pool == "c") {
                    echo 'Cluster Usage
';
                    $graph_array['to']     = $config['time']['now'];
                    $graph_array['id']     = $app['app_id'];
                    $graph_array['type']   = 'application_ceph_pool_df';
                    $graph_array['pool']   = $pool;
                    echo "| ";
                    include 'includes/print-graphrow.inc.php';
                    echo ' | 
';
                } else {
                    echo ''.$pool.' Usage
';
                    $graph_array['to']     = $config['time']['now'];
                    $graph_array['id']     = $app['app_id'];
                    $graph_array['type']   = 'application_ceph_pool_df';
                    $graph_array['pool']   = $pool;
                    echo "| ";
                    include 'includes/print-graphrow.inc.php';
                    echo ' | 
';
                    echo ''.$pool.' Objects
';
                    $graph_array['to']     = $config['time']['now'];
                    $graph_array['id']     = $app['app_id'];
                    $graph_array['type']   = 'application_ceph_pool_objects';
                    $graph_array['pool']   = $pool;
                    echo "| ";
                    include 'includes/print-graphrow.inc.php';
                    echo ' | 
';
                }
            }
        }
    }
}