diff --git a/html/includes/graphs/application/ceph_osd_performance.inc.php b/html/includes/graphs/application/ceph_osd_performance.inc.php
new file mode 100644
index 000000000..58381a978
--- /dev/null
+++ b/html/includes/graphs/application/ceph_osd_performance.inc.php
@@ -0,0 +1,25 @@
+ 'Pool stats',
+ 'ceph_osdperf' => 'OSD Performance',
+ 'ceph_df' => 'Usage',
+);
+
+$rrddir = $config['rrd_dir'].'/'.$device['hostname'];
+
+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($rrddir."/app-ceph-".$app['app_id']."-pool-*") as $rrd_filename) {
+ if (preg_match("/.*-pool-(.+)\.rrd$/", $rrd_filename, $pools)) {
+ $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 ' |
';
+
+ 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($rrddir."/app-ceph-".$app['app_id']."-osd-*") as $rrd_filename) {
+ 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($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 'Cluster Usage
';
+ $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['type'] = 'application_ceph_pool_df';
+ $graph_array['pool'] = $pool;
+
+ echo "| ";
+ include 'includes/print-graphrow.inc.php';
+ echo ' |
';
+
+ echo ''.$pool.' Objects
';
+ $graph_array['type'] = 'application_ceph_pool_objects';
+ $graph_array['pool'] = $pool;
+
+ echo "| ";
+ include 'includes/print-graphrow.inc.php';
+ echo ' |
';
+ }
+ }
+ }
+ }
+
+}
diff --git a/includes/common.php b/includes/common.php
index 248285600..2f7a7aedc 100644
--- a/includes/common.php
+++ b/includes/common.php
@@ -774,3 +774,24 @@ function can_ping_device($attribs) {
return false;
}
} // end can_ping_device
+
+/**
+ * Constructs the path to an RRD for the Ceph application
+ * @param string $gtype The type of rrd we're looking for
+ * @return string
+**/
+function ceph_rrd($gtype) {
+ global $device;
+ global $vars;
+ global $config;
+
+ if ($gtype == "osd") {
+ $var = $vars['osd'];
+ }
+ else {
+ $var = $vars['pool'];
+ }
+
+ $rrd = join('-', array('app', 'ceph', $vars['id'], $gtype, $var)).'.rrd';
+ return join('/', array($config['rrd_dir'], $device['hostname'], $rrd));
+}
diff --git a/includes/polling/applications/ceph.inc.php b/includes/polling/applications/ceph.inc.php
new file mode 100644
index 000000000..08413c881
--- /dev/null
+++ b/includes/polling/applications/ceph.inc.php
@@ -0,0 +1,71 @@
+', $section);
+ if ($section == "poolstats") {
+ foreach (explode("\n", $data) as $line) {
+ if (empty($line))
+ continue;
+ list($pool,$ops,$wrbytes,$rbytes) = explode(':', $line);
+ $ceph_rrd = $ceph_rrddir.'/app-ceph-'.$app['app_id'].'-pool-'.$pool.'.rrd';
+ if (!is_file($ceph_rrd)) {
+ rrdtool_create(
+ $ceph_rrd,
+ '--step 300 \
+ DS:ops:GAUGE:600:0:U \
+ DS:wrbytes:GAUGE:600:0:U \
+ DS:rbytes:GAUGE:600:0:U '.$config['rrd_rra']
+ );
+ }
+
+ print "Ceph Pool: $pool, IOPS: $ops, Wr bytes: $wrbytes, R bytes: $rbytes\n";
+ rrdtool_update($ceph_rrd, array("ops" => $ops, "wrbytes" => $wrbytes, "rbytes" => $rbytes));
+ }
+ }
+ elseif ($section == "osdperformance") {
+ foreach (explode("\n", $data) as $line) {
+ if (empty($line))
+ continue;
+ list($osd,$apply,$commit) = explode(':', $line);
+ $ceph_rrd = $ceph_rrddir.'/app-ceph-'.$app['app_id'].'-osd-'.$osd.'.rrd';
+ if (!is_file($ceph_rrd)) {
+ rrdtool_create(
+ $ceph_rrd,
+ '--step 300 \
+ DS:apply_ms:GAUGE:600:0:U \
+ DS:commit_ms:GAUGE:600:0:U '.$config['rrd_rra']
+ );
+ }
+
+ print "Ceph OSD: $osd, Apply: $apply, Commit: $commit\n";
+ rrdtool_update($ceph_rrd, array("apply_ms" => $apply, "commit_ms" => $commit));
+ }
+ }
+ elseif ($section == "df") {
+ foreach (explode("\n", $data) as $line) {
+ if (empty($line))
+ continue;
+ list($pool,$avail,$used,$objects) = explode(':', $line);
+ $ceph_rrd = $ceph_rrddir.'/app-ceph-'.$app['app_id'].'-df-'.$pool.'.rrd';
+ if (!is_file($ceph_rrd)) {
+ rrdtool_create(
+ $ceph_rrd,
+ '--step 300 \
+ DS:avail:GAUGE:600:0:U \
+ DS:used:GAUGE:600:0:U \
+ DS:objects:GAUGE:600:0:U '.$config['rrd_rra']
+ );
+ }
+
+ print "Ceph Pool DF: $pool, Avail: $avail, Used: $used, Objects: $objects\n";
+ rrdtool_update($ceph_rrd, array("avail" => $avail, "used" => $used, "objects" => $objects));
+ }
+ }
+ }
+}
diff --git a/includes/polling/unix-agent.inc.php b/includes/polling/unix-agent.inc.php
index 0bdfae836..18d30e58e 100644
--- a/includes/polling/unix-agent.inc.php
+++ b/includes/polling/unix-agent.inc.php
@@ -51,6 +51,7 @@ if ($device['os_group'] == 'unix') {
$agentapps = array(
"apache",
+ "ceph",
"mysql",
"nginx",
"bind",
@@ -104,7 +105,7 @@ if ($device['os_group'] == 'unix') {
if (file_exists("includes/polling/applications/$key.inc.php")) {
d_echo("Enabling $key for ".$device['hostname']." if not yet enabled\n");
- if (in_array($key, array('apache', 'mysql', 'nginx', 'proxmox'))) {
+ if (in_array($key, array('apache', 'mysql', 'nginx', 'proxmox', 'ceph'))) {
if (dbFetchCell('SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ?', array($device['device_id'], $key)) == '0') {
echo "Found new application '$key'\n";
dbInsert(array('device_id' => $device['device_id'], 'app_type' => $key), 'applications');